1
0
forked from pool/mutt
mutt/mutt-1.5.13.sidebar-fix.dif

158 lines
3.3 KiB
Plaintext

--- buffy.c
+++ buffy.c 2006-11-16 11:26:51.000000000 +0000
@@ -267,7 +267,7 @@
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)
@@ -302,8 +302,6 @@
for (tmp = Incoming; tmp; tmp = tmp->next)
{
- if ( tmp->new == 1 )
- tmp->has_new = 1;
#ifdef USE_IMAP
if (tmp->magic != M_IMAP)
#endif
@@ -357,14 +355,18 @@
)
{
+ 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;
@@ -379,10 +381,11 @@
*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;
}
#ifdef BUFFY_SIZE
else
@@ -391,11 +394,11 @@
tmp->size = (long) sb.st_size;
}
#endif
- 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:
@@ -414,16 +417,25 @@
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
@@ -447,25 +459,25 @@
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 11:26:58.000000000 +0000
@@ -29,7 +29,6 @@
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 */