From 61333b001c09fb24709398d2ad2dae16b8451080 Mon Sep 17 00:00:00 2001 From: Thomas Roessler Date: Mon, 31 Jul 2000 07:18:28 +0000 Subject: Brendan Cully's SASL patch. I hope I didn't miss any files. --- account.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) (limited to 'account.c') diff --git a/account.c b/account.c index 52bb58a1..f095763e 100644 --- a/account.c +++ b/account.c @@ -52,3 +52,57 @@ int mutt_account_match (const ACCOUNT* a1, const ACCOUNT* a2) return 1; } + +/* mutt_account_getuser: retrieve username into ACCOUNT, if neccessary */ +int mutt_account_getuser (ACCOUNT* account) +{ + /* already set */ + if (account->flags & M_ACCT_USER) + return 0; +#ifdef USE_IMAP + else if ((account->type == M_ACCT_TYPE_IMAP) && ImapUser) + strfcpy (account->user, ImapUser, sizeof (account->user)); +#endif +#ifdef USE_POP + else if ((account->type == M_ACCT_TYPE_POP) && PopUser) + strfcpy (account->user, PopUser, sizeof (account->user)); +#endif + /* prompt (defaults to unix username), copy into account->user */ + else + { + strfcpy (account->user, NONULL (Username), sizeof (account->user)); + if (mutt_get_field (_("Username: "), account->user, + sizeof (account->user), 0)) + return -1; + } + + account->flags |= M_ACCT_USER; + + return 0; +} + +/* mutt_account_getpass: fetch password into ACCOUNT, if neccessary */ +int mutt_account_getpass (ACCOUNT* account) +{ + if (account->flags & M_ACCT_PASS) + return 0; +#ifdef USE_IMAP + else if ((account->type == M_ACCT_TYPE_IMAP) && ImapPass) + strfcpy (account->pass, ImapPass, sizeof (account->pass)); +#endif +#ifdef USE_POP + else if ((account->type == M_ACCT_TYPE_POP) && PopPass) + strfcpy (account->pass, PopPass, sizeof (account->pass)); +#endif + else + { + account->pass[0] = '\0'; + if (mutt_get_field (_("Password: "), account->pass, + sizeof (account->pass), M_PASS)) + return -1; + } + + account->flags |= M_ACCT_PASS; + + return 0; +} -- cgit v1.2.3