]> granicus.if.org Git - mutt/commitdiff
Suppress new mail notification from mailbox just left. Closes #3290.
authorBrendan Cully <brendan@kublai.com>
Mon, 6 Jul 2009 01:36:49 +0000 (18:36 -0700)
committerBrendan Cully <brendan@kublai.com>
Mon, 6 Jul 2009 01:36:49 +0000 (18:36 -0700)
ChangeLog
buffy.c
buffy.h
mx.c

index 9d9d5e7bcbd0e781b624ce13072a1c95a0655061..75b7b945821f5126f15e2c450cf09d020cd218a5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,19 +1,18 @@
-2009-07-02 20:13 +0200  Rocco Rutte  <pdmef@gmx.net>  (a7ef17e2e493)
+2009-07-02 20:42 +0200  Rocco Rutte  <pdmef@gmx.net>  (042f2ce0b870)
+
+       * doc/manual.xml.head: Manual: minor fixes
+
+       * doc/manual.xml.head, doc/mutt.css: Manual: Render
+       comments in examples a lighter for readability
 
        * doc/manual.xml.head, doc/manual.xml.tail: Manual: Reformat
        paragraphs, fix &tilde; -> ~ breakage
 
-2009-07-02 19:36 +0200  Rocco Rutte  <pdmef@gmx.net>  (d40e288e3fbf)
-
        * doc/manual.xml.head: Manual: rework MIME chapter a bit
 
-2009-07-02 16:20 +0200  Rocco Rutte  <pdmef@gmx.net>  (705534ee1479)
-
        * doc/gen-map-doc, doc/manual.xml.tail, functions.h: Manual: Generate
        more pretty titles/ids for key binding tables
 
-2009-07-02 13:02 +0200  Rocco Rutte  <pdmef@gmx.net>  (4771a4fb4c0e)
-
        * doc/manual.xml.head: Manual: fix supported version
        numbers for mixmaster
 
@@ -29,8 +28,6 @@
        if input is required in batch mode. Replaces [0a3de4d9a009]. See
        #3289.
 
-2009-07-01 23:24 +0200  Rocco Rutte  <pdmef@gmx.net>  (9a5f4364c166)
-
        * doc/manual.xml.head: Manual: Add detailed section on charset
        handling
 
diff --git a/buffy.c b/buffy.c
index cd460e019f2ad51f1b2a8d024dde02c53d81fbfe..8cb0dec104c7b735e84b56c704af1e31f8f77988 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -45,6 +45,8 @@ time_t BuffyDoneTime = 0;     /* last time we knew for sure how much mail there was.
 static short BuffyCount = 0;   /* how many boxes with new mail */
 static short BuffyNotify = 0;  /* # of unnotified new boxes */
 
+static BUFFY* buffy_get (const char *path);
+
 /* Find the last message in the file. 
  * upon success return 0. If no message found - return -1 */
 
@@ -497,6 +499,17 @@ int mutt_buffy_list (void)
   return (0);
 }
 
+void mutt_buffy_setnotified (const char *path)
+{
+  BUFFY *buffy;
+
+  buffy = buffy_get(path);
+  if (!buffy)
+    return;
+
+  buffy->notified = 1;
+}
+
 int mutt_buffy_notify (void)
 {
   if (mutt_buffy_check (0) && BuffyNotify)
@@ -541,3 +554,30 @@ void mutt_buffy (char *s, size_t slen)
   /* no folders with new mail */
   *s = '\0';
 }
+
+/* fetch buffy object for given path, if present */
+static BUFFY* buffy_get (const char *path)
+{
+  BUFFY *cur;
+  char *epath;
+
+  if (!path)
+    return NULL;
+
+  epath = safe_strdup(path);
+  mutt_expand_path(epath, mutt_strlen(epath));
+
+  for (cur = Incoming; cur; cur = cur->next)
+  {
+    /* must be done late because e.g. IMAP delimiter may change */
+    mutt_expand_path (cur->path, sizeof (cur->path));
+    if (!mutt_strcmp(cur->path, path))
+    {
+      FREE (&epath);
+      return cur;
+    }
+  }
+
+  FREE (&epath);
+  return NULL;
+}
diff --git a/buffy.h b/buffy.h
index d7ff3b4fa896f5d8e65c8a9ca5fbe54549056f6c..f88bd27ffe4502d55fe2e4d46c4944602569dbe0 100644 (file)
--- a/buffy.h
+++ b/buffy.h
@@ -43,3 +43,6 @@ void mutt_update_mailbox (BUFFY * b);
 /* fixes up atime + mtime after mbox/mmdf mailbox was modified
    according to stat() info taken before a modification */
 void mutt_buffy_cleanup (const char *buf, struct stat *st);
+
+/* mark mailbox just left as already notified */
+void mutt_buffy_setnotified (const char *path);
diff --git a/mx.c b/mx.c
index 9cf245ec7f07fd8a263ab54181f1b529ad35f22f..27d827acbf77a60cb390f5dc181120a8ede790ec 100644 (file)
--- a/mx.c
+++ b/mx.c
@@ -705,6 +705,10 @@ void mx_fastclose_mailbox (CONTEXT *ctx)
   if(!ctx) 
     return;
 
+  /* never announce that a mailbox we've just left has new mail. #3290
+   * XXX: really belongs in mx_close_mailbox, but this is a nice hook point */
+  mutt_buffy_setnotified(ctx->path);
+
   if (ctx->mx_close)
     ctx->mx_close (ctx);