1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
|
--- PATCHES Dec 2002 17:44:54 -0000 3.6
+++ PATCHES Feb 2004 13:19:42 -0000
@@ -0,0 +1 @@
+patch-1.5.6.dw.maildir-mtime.1
--- browser.c.orig Mon Aug 2 18:54:46 2004
+++ browser.c Mon Aug 2 19:00:01 2004
@@ -30,6 +30,7 @@
#ifdef USE_NNTP
#include "nntp.h"
#endif
+#include "mx.h"
#include <stdlib.h>
#include <dirent.h>
@@ -423,9 +424,11 @@
#endif /* USE_NNTP */
static void add_folder (MUTTMENU *m, struct browser_state *state,
- const char *name, const struct stat *s,
- void *data, int new)
+ const char *name, struct stat *s,
+ void *data, BUFFY *mbuf)
{
+ int new = (mbuf) ? mbuf->new : 0;
+
if (state->entrylen == state->entrymax)
{
/* need to allocate more space */
@@ -437,6 +440,9 @@
m->data = state->entry;
}
+ if (mbuf && mbuf->magic == M_MAILDIR && mbuf->mtime)
+ s->st_mtime = mbuf->mtime;
+
if (s != NULL)
{
(state->entry)[state->entrylen].mode = s->st_mode;
@@ -495,7 +501,7 @@
continue;
if (!((regexec (Mask.rx, data->group, 0, NULL, 0) == 0) ^ Mask.not))
continue;
- add_folder (menu, state, data->group, NULL, data, data->new);
+ add_folder (menu, state, data->group, NULL, data, tmp);
}
}
else
@@ -561,7 +567,7 @@
tmp = Incoming;
while (tmp && mutt_strcmp (buffer, tmp->path))
tmp = tmp->next;
- add_folder (menu, state, de->d_name, &s, NULL, (tmp) ? tmp->new : 0);
+ add_folder (menu, state, de->d_name, &s, NULL, tmp);
}
closedir (dp);
}
@@ -589,7 +595,7 @@
{
if ((data = (NNTP_DATA *) tmp->data) != NULL && (data->new ||
(data->subscribed && (!option (OPTSHOWONLYUNREAD) || data->unread))))
- add_folder (menu, state, data->group, NULL, data, data->new);
+ add_folder (menu, state, data->group, NULL, data, tmp);
}
}
else
@@ -608,21 +614,21 @@
#ifdef USE_IMAP
if (mx_is_imap (tmp->path))
{
- add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
+ add_folder (menu, state, tmp->path, NULL, NULL, tmp);
continue;
}
#endif
#ifdef USE_POP
if (mx_is_pop (tmp->path))
{
- add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
+ add_folder (menu, state, tmp->path, NULL, NULL, tmp);
continue;
}
#endif
#ifdef USE_NNTP
if (mx_is_nntp (tmp->path))
{
- add_folder (menu, state, tmp->path, NULL, NULL, tmp->new);
+ add_folder (menu, state, tmp->path, NULL, NULL, tmp);
continue;
}
#endif
@@ -636,7 +642,7 @@
strfcpy (buffer, NONULL(tmp->path), sizeof (buffer));
mutt_pretty_mailbox (buffer);
- add_folder (menu, state, buffer, &s, NULL, tmp->new);
+ add_folder (menu, state, buffer, &s, NULL, tmp);
}
while ((tmp = tmp->next));
}
@@ -1555,7 +1561,7 @@
if (regexec (rx, nd->group, 0, NULL, 0) == 0)
{
mutt_newsgroup_subscribe (news, nd->group);
- add_folder (menu, &state, nd->group, NULL, nd, nd->new);
+ add_folder (menu, &state, nd->group, NULL, nd, nd);
}
}
}
--- buffy.c Feb 2004 17:50:43 -0000 3.9
+++ buffy.c Feb 2004 13:19:42 -0000
@@ -229,2 +229,3 @@ int mutt_parse_mailboxes (BUFFER *path,
(*tmp)->newly_created = 0;
+ (*tmp)->mtime = 0;
@@ -260,2 +261,3 @@ int mutt_buffy_check (int force)
struct stat sb;
+ struct stat smd;
struct dirent *de;
@@ -299,2 +301,3 @@ int mutt_buffy_check (int force)
tmp->new = 0;
+ tmp->mtime = 0;
@@ -383,6 +386,13 @@ int mutt_buffy_check (int force)
{
- /* one new and undeleted message is enough */
- BuffyCount++;
- tmp->new = 1;
- break;
+ if (!tmp->new)
+ {
+ /* one new and undeleted message is enough */
+ BuffyCount++;
+ tmp->new = 1;
+ }
+ snprintf (path, sizeof (path), "%s/new/%s", tmp->path, de->d_name);
+ if (!stat (path, &smd) && smd.st_mtime > tmp->mtime)
+ {
+ tmp->mtime = smd.st_mtime;
+ }
}
--- buffy.h Dec 2002 11:19:39 -0000 3.2
+++ buffy.h Feb 2004 13:19:42 -0000
@@ -29,2 +29,3 @@ typedef struct buffy_t
struct buffy_t *next;
+ time_t mtime; /* for maildirs...time of newest entry */
short new; /* mailbox has new mail */
|