From: Yoshiki Vázquez Baeza Date: Sat, 23 Apr 2016 20:33:50 +0000 (-0700) Subject: feature: new-mail X-Git-Tag: neomutt-20160822~37^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=6eca9b12e4262479f4f2a41581a892d7e5e1329d;p=neomutt feature: new-mail This setting executes a command when new mail is received. --- diff --git a/curs_main.c b/curs_main.c index 8e0f52ad8..e06901c71 100644 --- a/curs_main.c +++ b/curs_main.c @@ -577,6 +577,12 @@ int mutt_index_menu (void) mutt_message _("New mail in this mailbox."); if (option (OPTBEEPNEW)) beep (); + if (NewMailCmd) + { + char cmd[LONG_STRING]; + menu_status_line(cmd, sizeof(cmd), menu, NONULL(NewMailCmd)); + mutt_system(cmd); + } } else if (check == MUTT_FLAGS) mutt_message _("Mailbox was externally modified."); @@ -603,6 +609,12 @@ int mutt_index_menu (void) menu->redraw |= REDRAW_STATUS; if (option (OPTBEEPNEW)) beep(); + if (NewMailCmd) + { + char cmd[LONG_STRING]; + menu_status_line(cmd, sizeof(cmd), menu, NONULL(NewMailCmd)); + mutt_system(cmd); + } } } else diff --git a/globals.h b/globals.h index 95a6869ba..2a0d13738 100644 --- a/globals.h +++ b/globals.h @@ -111,6 +111,7 @@ WHERE char *Postponed; WHERE char *PostponeEncryptAs; WHERE char *Prefix; WHERE char *PrintCmd; +WHERE char *NewMailCmd; WHERE char *QueryCmd; WHERE char *QueryFormat; WHERE char *Realname; diff --git a/init.h b/init.h index 3f3f96d9d..11bfa9c83 100644 --- a/init.h +++ b/init.h @@ -293,6 +293,13 @@ struct option_t MuttVars[] = { { "beep", DT_BOOL, R_NONE, OPTBEEP, 1 }, /* ** .pp + ** If \fIset\fP, Mutt will call this command after a new message is received. + ** See the $$status_format documentation for the values that can be formatted + ** into this command. + */ + { "new_mail_command", DT_PATH, R_NONE, UL &NewMailCmd, UL NULL }, + /* + ** .pp ** When this variable is \fIset\fP, mutt will beep when an error occurs. */ { "beep_new", DT_BOOL, R_NONE, OPTBEEPNEW, 0 },