+ char prompt[STRING];
+
+ if (account->has_pass)
+ return 0;
+ else if ((account->type == M_ACCT_TYPE_IMAP) && !m_strisempty(ImapPass))
+ m_strcpy(account->pass, sizeof(account->pass), ImapPass);
+ else if ((account->type == M_ACCT_TYPE_POP) && !m_strisempty(PopPass))
+ m_strcpy(account->pass, sizeof(account->pass), PopPass);
+#ifdef USE_NNTP
+ else if ((account->type == M_ACCT_TYPE_NNTP) && !m_strisempty(NntpPass))
+ m_strcpy(account->pass, sizeof(account->pass), NntpPass);
+#endif
+ else {
+ snprintf(prompt, sizeof(prompt), _("Password for %s@%s: "),
+ account->has_login ? account->login : account->user,
+ account->host);
+ account->pass[0] = '\0';
+ if (mutt_get_field_unbuffered(prompt, account->pass,
+ sizeof(account->pass), M_PASS))
+ return -1;
+ }
+
+ account->has_pass = 1;
+
+ return 0;