snprintf (prompt, sizeof (prompt), _("Password for %s@%s: "),
account->user, account->host);
account->pass[0] = '\0';
- if (mutt_get_field (prompt, account->pass, sizeof (account->pass), M_PASS))
+ if (mutt_get_password (prompt, account->pass, sizeof (account->pass)))
return -1;
}
refresh ();
}
-event_t mutt_getch (void)
+event_t _mutt_getch (int flags)
{
int ch;
event_t err = {-1, OP_NULL }, ret;
- if (UngetCount)
+ if (!(flags & M_KM_UNBUFFERED) && UngetCount)
return (KeyEvent[--UngetCount]);
SigInt = 0;
}
mutt_refresh ();
- if ((ch = km_dokey (MENU_EDITOR)) == -1)
+ if ((ch = _km_dokey (MENU_EDITOR, pass ? M_KM_UNBUFFERED : 0)) == -1)
{
rv = -1;
goto bye;
* OP_NULL no function bound to key sequence
* -1 error occured while reading input
*/
-int km_dokey (int menu)
+int _km_dokey (int menu, int flags)
{
event_t tmp;
struct keymap_t *map = Keymaps[menu];
if (menu != MENU_EDITOR)
timeout ((Timeout > 0 ? Timeout : 60) * 1000);
- tmp = mutt_getch();
+ tmp = _mutt_getch(flags);
if (menu != MENU_EDITOR)
timeout (-1); /* restore blocking operation */
void km_bind (char *, int, int, char *, char *);
void km_bindkey (char *, int, int);
-int km_dokey (int);
+#define km_dokey(menu) _km_dokey(menu, 0)
+int _km_dokey (int, int);
/* entry in the keymap tree */
struct keymap_t
#define M_TOKEN_COMMENT (1<<5) /* don't reap comments */
#define M_TOKEN_SEMICOLON (1<<6) /* don't treat ; as special */
+/* flags for km_dokey() */
+#define M_KM_UNBUFFERED 1 /* don't read from the key buffer */
+
typedef struct
{
char *data; /* pointer to data */
#define CI_is_return(c) ((c) == '\r' || (c) == '\n')
#endif
-event_t mutt_getch (void);
+#define mutt_getch() _mutt_getch(0)
+event_t _mutt_getch (int);
void mutt_endwin (const char *);
void mutt_flushinp (void);