diff options
author | Thomas Roessler <roessler@does-not-exist.org> | 2000-07-31 07:18:28 +0000 |
---|---|---|
committer | Thomas Roessler <roessler@does-not-exist.org> | 2000-07-31 07:18:28 +0000 |
commit | 61333b001c09fb24709398d2ad2dae16b8451080 (patch) | |
tree | c9cfc5f76b32aa8f3a2780d213079be6f68a0c30 /account.c | |
parent | e15e685b533f3817a9adb99824f03f03342c64d9 (diff) |
Brendan Cully's SASL patch. I hope I didn't miss any files.
Diffstat (limited to 'account.c')
-rw-r--r-- | account.c | 54 |
1 files changed, 54 insertions, 0 deletions
@@ -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; +} |