]> granicus.if.org Git - neomutt/commitdiff
Start to fix sidebar buffy modifications.
authorKevin McCarthy <kevin@8t8.us>
Sat, 4 Jun 2016 18:32:12 +0000 (11:32 -0700)
committerKevin McCarthy <kevin@8t8.us>
Sat, 4 Jun 2016 18:32:12 +0000 (11:32 -0700)
The extended buffy for mh had incorrect placement of the loop
brackets.  The counters weren't being incremented in the loop.

Fix extended buffy for maildir to count a maildir message as new if it
doesn't have the info delimeter.

Remove shortcircuits added to the basic buffy stating there is new
mail when (msg_unread > 0).  This is not necessarily true, depending
on $mail_check_recent.

Note: the extended buffy still needs more fixes, which will be done
when it is refactored into its own option.

buffy.c
mh.c

diff --git a/buffy.c b/buffy.c
index babc824fc65c9f0d948df0eed57edc46165eab9a..21917740962928866f1f44ce779d11e7c626f40e 100644 (file)
--- a/buffy.c
+++ b/buffy.c
@@ -336,13 +336,6 @@ static int buffy_maildir_dir_hasnew(BUFFY* mailbox, const char *dir_name)
       return 0;
   }
 
-#ifdef USE_SIDEBAR
-  if (option (OPTSIDEBAR) && mailbox->msg_unread > 0) {
-    mailbox->new = 1;
-    return 1;
-  }
-#endif
-
   if ((dirp = opendir (path)) == NULL)
   {
     mailbox->magic = 0;
@@ -441,6 +434,8 @@ buffy_maildir_update_dir (BUFFY *mailbox, const char *dir)
       if (strchr (p, 'F'))
         mailbox->msg_flagged++;
     }
+    else
+      mailbox->msg_unread++;
   }
 
   closedir (dirp);
@@ -485,11 +480,7 @@ static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
   else
     statcheck = sb->st_mtime > sb->st_atime
       || (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
-#ifdef USE_SIDEBAR
-  if ((!option (OPTSIDEBAR) && statcheck) || (option (OPTSIDEBAR) && mailbox->msg_unread > 0))
-#else
   if (statcheck)
-#endif
   {
     if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
     {
diff --git a/mh.c b/mh.c
index 23b7502ae91da6c2bface826ecefadd0cba82b4d..7b04305aa36c4d045a9f11956de1301039dea809 100644 (file)
--- a/mh.c
+++ b/mh.c
@@ -309,36 +309,35 @@ void mh_buffy(BUFFY *b)
 void
 mh_buffy_update (BUFFY *mailbox)
 {
-       if (!mailbox)
-               return;
+  int i;
+  struct mh_sequences mhs;
 
-       if (!option (OPTSIDEBAR))
-               return;
+  if (!mailbox)
+    return;
 
-       struct mh_sequences mhs;
-       memset (&mhs, 0, sizeof (mhs));
+  if (!option (OPTSIDEBAR))
+    return;
 
-       if (mh_read_sequences (&mhs, mailbox->path) < 0)
-               return;
+  memset (&mhs, 0, sizeof (mhs));
 
-       mailbox->msg_count   = 0;
-       mailbox->msg_unread  = 0;
-       mailbox->msg_flagged = 0;
+  if (mh_read_sequences (&mhs, mailbox->path) < 0)
+    return;
 
-       int i;
-       for (i = 0; i <= mhs.max; i++) {
-               mailbox->msg_count++;
-       }
-       if (mhs_check (&mhs, i) & MH_SEQ_UNSEEN) {
-               mailbox->msg_unread++;
-       }
-       if (mhs_check (&mhs, i) & MH_SEQ_FLAGGED) {
-               mailbox->msg_flagged++;
-       }
-       mhs_free_sequences (&mhs);
-       mailbox->sb_last_checked = time (NULL);
-}
+  mailbox->msg_count   = 0;
+  mailbox->msg_unread  = 0;
+  mailbox->msg_flagged = 0;
 
+  for (i = 0; i <= mhs.max; i++)
+  {
+    mailbox->msg_count++;
+    if (mhs_check (&mhs, i) & MH_SEQ_UNSEEN)
+      mailbox->msg_unread++;
+    if (mhs_check (&mhs, i) & MH_SEQ_FLAGGED)
+      mailbox->msg_flagged++;
+  }
+  mhs_free_sequences (&mhs);
+  mailbox->sb_last_checked = time (NULL);
+}
 #endif
 
 static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt)