]> granicus.if.org Git - neomutt/commitdiff
feature: new_mail_command
authorYoshiki Vázquez Baeza <yoshiki89@gmail.com>
Sat, 23 Apr 2016 20:33:50 +0000 (13:33 -0700)
committerRichard Russon <rich@flatcap.org>
Wed, 6 Jul 2016 23:41:34 +0000 (00:41 +0100)
This setting executes a command when new mail is received.

curs_main.c
doc/manual.xml.head
globals.h
init.h

index a76aac998e0fc94f303fa3e4730f197b56eb71f9..a7c0b918e81ccdfa9e0be32b68ced5c52e0a8e88 100644 (file)
@@ -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;
index b90908f001610306861479d3bc7440f848d5e17c..c1840fb777970e2d60860e16eb62099c431fae5a 100644 (file)
@@ -6047,7 +6047,10 @@ New mail for Maildir is assumed if there is one message in the
 <link linkend="maildir-trash">$maildir_trash</link>). For MH folders, a
 mailbox is considered having new mail if there's at least one message in
 the <quote>unseen</quote> sequence as specified by <link
-linkend="mh-seq-unseen">$mh_seq_unseen</link>.
++linkend="mh-seq-unseen">$mh_seq_unseen</link>. Optionally, <link
++linkend="new_mail_command">$new_mail_command</link> can be configured to
++execute an external program every time new mail is detected in the current
++inbox.
 </para>
 
 <para>
index abefade3d1423e253e8ec5422259d7759d03ea9f..557e6e314d615511fb4a9c27c8e4f3c3c205e34d 100644 (file)
--- 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 5a12ec0d06b7267b630e858b8393704ff85fb5cd..252b6157e88eaff3e0e182fd1134671f81d858d2 100644 (file)
--- 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 },