| | 55 | |
| | 56 | /* mutt_account_getuser: retrieve username into ACCOUNT, if neccessary */ |
| | 57 | int mutt_account_getuser (ACCOUNT* account) |
| | 58 | { |
| | 59 | /* already set */ |
| | 60 | if (account->flags & M_ACCT_USER) |
| | 61 | return 0; |
| | 62 | #ifdef USE_IMAP |
| | 63 | else if ((account->type == M_ACCT_TYPE_IMAP) && ImapUser) |
| | 64 | strfcpy (account->user, ImapUser, sizeof (account->user)); |
| | 65 | #endif |
| | 66 | #ifdef USE_POP |
| | 67 | else if ((account->type == M_ACCT_TYPE_POP) && PopUser) |
| | 68 | strfcpy (account->user, PopUser, sizeof (account->user)); |
| | 69 | #endif |
| | 70 | /* prompt (defaults to unix username), copy into account->user */ |
| | 71 | else |
| | 72 | { |
| | 73 | strfcpy (account->user, NONULL (Username), sizeof (account->user)); |
| | 74 | if (mutt_get_field (_("Username: "), account->user, |
| | 75 | sizeof (account->user), 0)) |
| | 76 | return -1; |
| | 77 | } |
| | 78 | |
| | 79 | account->flags |= M_ACCT_USER; |
| | 80 | |
| | 81 | return 0; |
| | 82 | } |
| | 83 | |
| | 84 | /* mutt_account_getpass: fetch password into ACCOUNT, if neccessary */ |
| | 85 | int mutt_account_getpass (ACCOUNT* account) |
| | 86 | { |
| | 87 | if (account->flags & M_ACCT_PASS) |
| | 88 | return 0; |
| | 89 | #ifdef USE_IMAP |
| | 90 | else if ((account->type == M_ACCT_TYPE_IMAP) && ImapPass) |
| | 91 | strfcpy (account->pass, ImapPass, sizeof (account->pass)); |
| | 92 | #endif |
| | 93 | #ifdef USE_POP |
| | 94 | else if ((account->type == M_ACCT_TYPE_POP) && PopPass) |
| | 95 | strfcpy (account->pass, PopPass, sizeof (account->pass)); |
| | 96 | #endif |
| | 97 | else |
| | 98 | { |
| | 99 | account->pass[0] = '\0'; |
| | 100 | if (mutt_get_field (_("Password: "), account->pass, |
| | 101 | sizeof (account->pass), M_PASS)) |
| | 102 | return -1; |
| | 103 | } |
| | 104 | |
| | 105 | account->flags |= M_ACCT_PASS; |
| | 106 | |
| | 107 | return 0; |
| | 108 | } |