summaryrefslogtreecommitdiffstats
path: root/account.c
diff options
context:
space:
mode:
authorThomas Roessler <roessler@does-not-exist.org>2000-07-31 07:18:28 +0000
committerThomas Roessler <roessler@does-not-exist.org>2000-07-31 07:18:28 +0000
commit61333b001c09fb24709398d2ad2dae16b8451080 (patch)
treec9cfc5f76b32aa8f3a2780d213079be6f68a0c30 /account.c
parente15e685b533f3817a9adb99824f03f03342c64d9 (diff)
Brendan Cully's SASL patch. I hope I didn't miss any files.
Diffstat (limited to 'account.c')
-rw-r--r--account.c54
1 files changed, 54 insertions, 0 deletions
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;
+}