File mutt-1.5.15.sidebar-fix.dif of Package mutt

--- buffy.c
+++ buffy.c	2007-06-01 13:37:02.671160950 +0200
@@ -259,7 +259,7 @@ int mutt_buffy_check (int force)
   char path[_POSIX_PATH_MAX];
   struct stat contex_sb;
   time_t t;
-  CONTEXT *ctx;
+
 #ifdef USE_IMAP
   /* update postponed count as well, on force */
   if (force)
@@ -294,8 +294,6 @@ int mutt_buffy_check (int force)
   
   for (tmp = Incoming; tmp; tmp = tmp->next)
   {
-    if ( tmp->new == 1 )
-      tmp->has_new = 1;
 #ifdef USE_IMAP
     if (tmp->magic != M_IMAP)
 #endif
@@ -347,14 +345,18 @@ int mutt_buffy_check (int force)
 	)
 	
     {
+      int check;
+
       switch (tmp->magic)
       {
       case M_MBOX:
       case M_MMDF:
 
-        {
-        if (STAT_CHECK || tmp->msgcount == 0)
+	check = STAT_CHECK;
+
+	if (option(OPTSIDEBAR) && (check || tmp->msgcount == 0))
 	{
+	  CONTEXT *ctx;
 	  BUFFY b = *tmp;
  	  int msgcount = 0;
  	  int msg_unread = 0;
@@ -369,21 +371,22 @@ int mutt_buffy_check (int force)
  	  *tmp = b;
  	  tmp->msgcount = msgcount;
  	  tmp->msg_unread = msg_unread;
- 	  if(STAT_CHECK) {
- 	    tmp->has_new = tmp->new = 1;
-	    BuffyCount++;
-          }  
+	}
+	if (check)
+	{
+	  BuffyCount++;
+	  tmp->new = 1;
 	}
 	else if (option(OPTCHECKMBOXSIZE))
 	{
 	  /* some other program has deleted mail from the folder */
 	  tmp->size = (long) sb.st_size;
 	}
-        if (tmp->newly_created &&
-            (sb.st_ctime != sb.st_mtime || sb.st_ctime != sb.st_atime))
-          tmp->newly_created = 0;
-        }
-        break;
+	if (tmp->newly_created &&
+	    (sb.st_ctime != sb.st_mtime || sb.st_ctime != sb.st_atime))
+	  tmp->newly_created = 0;
+
+	break;
 
       case M_MAILDIR:
 
@@ -402,16 +405,25 @@ int mutt_buffy_check (int force)
 	  if (*de->d_name != '.' && 
 	      (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')))
 	  {
- 	    tmp->has_new = tmp->new = 1;
+	    if (!option(OPTSIDEBAR))
+	    {
+	      BuffyCount++;
+	      tmp->new = 1;
+	      break;
+	    }
+ 	    tmp->new = 1;
             tmp->msgcount++;
             tmp->msg_unread++;
  	  }
  	}
         if(tmp->msg_unread)
           BuffyCount++;
- 
+
  	closedir (dirp);
  
+	if (!option(OPTSIDEBAR))
+	  break;
+
         /*
          * count read messages (for folderlist (sidebar) we also need to count
          * messages in cur so that we the total number of messages
@@ -435,25 +447,25 @@ int mutt_buffy_check (int force)
 	break;
 
       case M_MH:
-      {
-      DIR *dp;
-      struct dirent *de;
-      if ((tmp->new = mh_buffy (tmp->path)) > 0)
-        BuffyCount++;
-    
-      if ((dp = opendir (path)) == NULL)
-        break;
-      tmp->msgcount = 0;
-      while ((de = readdir (dp)))
-      {
-        if (mh_valid_message (de->d_name))
-        {
-	  tmp->msgcount++;
- 	  tmp->has_new = tmp->new = 1;
-        }
-      }
-      closedir (dp);
-      }
+
+	if ((tmp->new = mh_buffy (tmp->path)) > 0)
+	  BuffyCount++;
+	if (!option(OPTSIDEBAR))
+	  break;
+
+	if ((dirp = opendir (path)) == NULL)
+	  break;
+	tmp->msgcount = 0;
+	while ((de = readdir (dirp)))
+	{
+	  if (mh_valid_message (de->d_name))
+	  {
+	    tmp->msgcount++;
+ 	    tmp->new = 1;
+	  }
+	}
+	closedir (dirp);
+
 	break;
       }
     }
--- buffy.h
+++ buffy.h	2006-11-16 12:26:58.000000000 +0100
@@ -27,7 +27,6 @@ typedef struct buffy_t
   struct buffy_t *next;
   struct buffy_t *prev;
   short new;			/* mailbox has new mail */
-  short has_new;		/* set it new if new and not read */
   int msgcount;			/* total number of messages */
   int msg_unread;		/* number of unread messages */
   short notified;		/* user has been notified */
openSUSE Build Service is sponsored by