X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=account.c;h=ea1806a894790dc2616738377694cfb2570375ae;hp=3cc3a22f0d92e94af898d494eaddce35815a7649;hb=8e689b28eefc1a93797f299c33f7ec3e2e340329;hpb=0ac011f8eb41bab7808881ebf9802b4eb252fe3b diff --git a/account.c b/account.c index 3cc3a22..ea1806a 100644 --- a/account.c +++ b/account.c @@ -9,28 +9,18 @@ /* remote host account manipulation (POP/IMAP) */ -#if HAVE_CONFIG_H -# include "config.h" -#endif - -#include -#include -#include -#include +#include +#include +#include #include "mutt.h" -#include "enter.h" #include "account.h" -#include "url.h" - /* mutt_account_match: compare account info (host/port/user/login) */ int mutt_account_match (const ACCOUNT * a1, const ACCOUNT * a2) { - const char* user = NONULL (Username); -#ifdef USE_IMAP - const char* login = NONULL (Username); -#endif + const char* user = NONULL(MCore.username); + const char* login = NONULL(MCore.username); if (a1->type != a2->type) return 0; @@ -39,14 +29,12 @@ int mutt_account_match (const ACCOUNT * a1, const ACCOUNT * a2) 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; @@ -101,14 +89,12 @@ void mutt_account_tourl (ACCOUNT * account, ciss_url_t * url) 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) @@ -138,15 +124,13 @@ void mutt_account_tourl (ACCOUNT * account, ciss_url_t * url) /* mutt_account_getuser: retrieve username into ACCOUNT, if necessary */ int mutt_account_getuser (ACCOUNT * account) { - char prompt[SHORT_STRING]; + char prompt[STRING]; /* 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 @@ -156,7 +140,7 @@ int mutt_account_getuser (ACCOUNT * account) /* prompt (defaults to unix username), copy into account->user */ else { snprintf(prompt, sizeof(prompt), _("Username at %s: "), account->host); - m_strcpy(account->user, sizeof(account->user), NONULL(Username)); + m_strcpy(account->user, sizeof(account->user), NONULL(MCore.username)); if (mutt_get_field_unbuffered(prompt, account->user, sizeof(account->user), 0)) return -1; @@ -172,7 +156,6 @@ int mutt_account_getlogin (ACCOUNT* account) /* 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)) { @@ -180,7 +163,6 @@ int mutt_account_getlogin (ACCOUNT* account) account->flags |= M_ACCT_LOGIN; } } -#endif if (!(account->flags & M_ACCT_LOGIN)) { mutt_account_getuser (account); @@ -195,14 +177,12 @@ int mutt_account_getlogin (ACCOUNT* account) /* mutt_account_getpass: fetch password into ACCOUNT, if neccessary */ int mutt_account_getpass (ACCOUNT * account) { - char prompt[SHORT_STRING]; + char prompt[STRING]; 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 @@ -226,5 +206,5 @@ int mutt_account_getpass (ACCOUNT * account) void mutt_account_unsetpass (ACCOUNT * account) { - account->flags &= !M_ACCT_PASS; + account->flags &= ~M_ACCT_PASS; }