From: Yoshiki Vázquez Baeza Date: Sat, 23 Apr 2016 20:33:50 +0000 (-0700) Subject: feature: new_mail_command X-Git-Tag: neomutt-20160709~5^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=22ef61eaf04c74b38ac46c632a795362a4935b70;p=neomutt feature: new_mail_command This setting executes a command when new mail is received. --- diff --git a/curs_main.c b/curs_main.c index a76aac998..a7c0b918e 100644 --- a/curs_main.c +++ b/curs_main.c @@ -574,6 +574,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 == M_FLAGS) mutt_message _("Mailbox was externally modified."); @@ -595,8 +601,18 @@ int mutt_index_menu (void) menu->redraw |= REDRAW_STATUS; if (do_buffy_notify) { - if (mutt_buffy_notify () && option (OPTBEEPNEW)) - beep (); + if (mutt_buffy_notify ()) + { + 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 do_buffy_notify = 1; diff --git a/doc/manual.xml.head b/doc/manual.xml.head index b90908f00..c1840fb77 100644 --- a/doc/manual.xml.head +++ b/doc/manual.xml.head @@ -6047,7 +6047,10 @@ New mail for Maildir is assumed if there is one message in the $maildir_trash). For MH folders, a mailbox is considered having new mail if there's at least one message in the unseen sequence as specified by $mh_seq_unseen. ++linkend="mh-seq-unseen">$mh_seq_unseen. Optionally, $new_mail_command can be configured to ++execute an external program every time new mail is detected in the current ++inbox. diff --git a/globals.h b/globals.h index abefade3d..557e6e314 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 5a12ec0d0..252b6157e 100644 --- a/init.h +++ b/init.h @@ -290,6 +290,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 },