int mutt_account_match (const ACCOUNT * a1, const ACCOUNT * a2)
{
const char* user = NONULL (Username);
-#ifdef USE_IMAP
const char* login = NONULL (Username);
-#endif
if (a1->type != a2->type)
return 0;
if (a1->port != a2->port)
return 0;
-#ifdef USE_IMAP
if (a1->type == M_ACCT_TYPE_IMAP) {
if (ImapUser && (ImapUser[0] != '\0'))
user = ImapUser;
if (ImapLogin && (ImapLogin[0] != '\0'))
login = ImapLogin;
}
-#endif
if (a1->type == M_ACCT_TYPE_POP && PopUser)
user = PopUser;
url->pass = NULL;
url->port = 0;
-#ifdef USE_IMAP
if (account->type == M_ACCT_TYPE_IMAP) {
if (account->flags & M_ACCT_SSL)
url->scheme = U_IMAPS;
else
url->scheme = U_IMAP;
}
-#endif
if (account->type == M_ACCT_TYPE_POP) {
if (account->flags & M_ACCT_SSL)
/* already set */
if (account->flags & M_ACCT_USER)
return 0;
-#ifdef USE_IMAP
else if ((account->type == M_ACCT_TYPE_IMAP) && !m_strisempty(ImapUser))
m_strcpy(account->user, sizeof(account->user), ImapUser);
-#endif
else if ((account->type == M_ACCT_TYPE_POP) && !m_strisempty(PopUser))
m_strcpy(account->user, sizeof(account->user), PopUser);
#ifdef USE_NNTP
/* already set */
if (account->flags & M_ACCT_LOGIN)
return 0;
-#ifdef USE_IMAP
else if (account->type == M_ACCT_TYPE_IMAP)
{
if (!m_strisempty(ImapLogin)) {
account->flags |= M_ACCT_LOGIN;
}
}
-#endif
if (!(account->flags & M_ACCT_LOGIN)) {
mutt_account_getuser (account);
if (account->flags & M_ACCT_PASS)
return 0;
-#ifdef USE_IMAP
else if ((account->type == M_ACCT_TYPE_IMAP) && !m_strisempty(ImapPass))
m_strcpy(account->pass, sizeof(account->pass), ImapPass);
-#endif
else if ((account->type == M_ACCT_TYPE_POP) && !m_strisempty(PopPass))
m_strcpy(account->pass, sizeof(account->pass), PopPass);
#ifdef USE_NNTP