Link Here
|
1 |
Based on Gentoo's updated version of the Mutt Sidebar patch, |
1 |
Taken from http://lunar-linux.org/~tchan/mutt/patch-1.5.23.sidebar.20140412.txt |
2 |
rebased to apply to pristine Mutt sources. |
|
|
3 |
|
2 |
|
4 |
http://prefix.gentooexperimental.org:8000/mutt-patches/file/8117acc3edc0/sidebar.patch |
|
|
5 |
|
6 |
diff -uNp -r mutt-1.5.22.orig/OPS mutt-1.5.22/OPS |
7 |
--- mutt-1.5.22.orig/OPS Tue Feb 23 06:57:28 2010 |
8 |
+++ mutt-1.5.22/OPS Fri Oct 18 10:18:45 2013 |
9 |
@@ -179,3 +179,8 @@ OP_WHAT_KEY "display the keycode for a key press" |
10 |
OP_MAIN_SHOW_LIMIT "show currently active limit pattern" |
11 |
OP_MAIN_COLLAPSE_THREAD "collapse/uncollapse current thread" |
12 |
OP_MAIN_COLLAPSE_ALL "collapse/uncollapse all threads" |
13 |
+OP_SIDEBAR_SCROLL_UP "scroll the mailbox pane up 1 page" |
14 |
+OP_SIDEBAR_SCROLL_DOWN "scroll the mailbox pane down 1 page" |
15 |
+OP_SIDEBAR_NEXT "go down to next mailbox" |
16 |
+OP_SIDEBAR_PREV "go to previous mailbox" |
17 |
+OP_SIDEBAR_OPEN "open hilighted mailbox" |
18 |
diff -uNp -r mutt-1.5.22.orig/PATCHES mutt-1.5.22/PATCHES |
19 |
--- mutt-1.5.22.orig/PATCHES Sun Feb 21 05:51:26 2010 |
20 |
+++ mutt-1.5.22/PATCHES Fri Oct 18 10:19:14 2013 |
21 |
@@ -0,0 +1 @@ |
22 |
+patch-1.5.22.sidebar.gentoo-openbsd |
23 |
diff -uNp -r mutt-1.5.22.orig/buffy.c mutt-1.5.22/buffy.c |
3 |
diff -uNp -r mutt-1.5.22.orig/buffy.c mutt-1.5.22/buffy.c |
24 |
--- mutt-1.5.22.orig/buffy.c Mon Apr 22 07:14:53 2013 |
4 |
*** mutt-1.5.23-orig/buffy.c 2014-03-12 11:03:44.000000000 -0500 |
25 |
+++ mutt-1.5.22/buffy.c Fri Oct 18 10:18:45 2013 |
5 |
--- mutt-1.5.23/buffy.c 2014-04-12 15:33:54.000000000 -0500 |
26 |
@@ -161,6 +161,49 @@ void mutt_buffy_cleanup (const char *buf, struct stat |
6 |
*************** |
27 |
} |
7 |
*** 161,166 **** |
28 |
} |
8 |
--- 161,209 ---- |
29 |
|
9 |
} |
30 |
+static int buffy_compare_name(const void *a, const void *b) { |
10 |
} |
31 |
+ const BUFFY *b1 = * (BUFFY * const *) a; |
11 |
|
32 |
+ const BUFFY *b2 = * (BUFFY * const *) b; |
12 |
+ static int buffy_compare_name(const void *a, const void *b) { |
33 |
+ |
13 |
+ const BUFFY *b1 = * (BUFFY * const *) a; |
34 |
+ return mutt_strcoll(b1->path, b2->path); |
14 |
+ const BUFFY *b2 = * (BUFFY * const *) b; |
35 |
+} |
15 |
+ |
36 |
+ |
16 |
+ return mutt_strcoll(b1->path, b2->path); |
37 |
+static BUFFY *buffy_sort(BUFFY *b) |
17 |
+ } |
38 |
+{ |
18 |
+ |
39 |
+ BUFFY *tmp = b; |
19 |
+ static BUFFY *buffy_sort(BUFFY *b) |
40 |
+ int buffycount = 0; |
20 |
+ { |
41 |
+ BUFFY **ary; |
21 |
+ BUFFY *tmp = b; |
42 |
+ int i; |
22 |
+ int buffycount = 0; |
43 |
+ |
23 |
+ BUFFY **ary; |
44 |
+ if (!option(OPTSIDEBARSORT)) |
24 |
+ int i; |
45 |
+ return b; |
25 |
+ |
46 |
+ |
26 |
+ if (!option(OPTSIDEBARSORT)) |
47 |
+ for (; tmp != NULL; tmp = tmp->next) |
27 |
+ return b; |
48 |
+ buffycount++; |
28 |
+ |
49 |
+ |
29 |
+ for (; tmp != NULL; tmp = tmp->next) |
50 |
+ ary = (BUFFY **) safe_calloc(buffycount, sizeof (*ary)); |
30 |
+ buffycount++; |
51 |
+ |
31 |
+ |
52 |
+ tmp = b; |
32 |
+ ary = (BUFFY **) safe_calloc(buffycount, sizeof (*ary)); |
53 |
+ for (i = 0; tmp != NULL; tmp = tmp->next, i++) { |
33 |
+ |
54 |
+ ary[i] = tmp; |
34 |
+ tmp = b; |
55 |
+ } |
35 |
+ for (i = 0; tmp != NULL; tmp = tmp->next, i++) { |
56 |
+ |
36 |
+ ary[i] = tmp; |
57 |
+ qsort(ary, buffycount, sizeof(*ary), buffy_compare_name); |
37 |
+ } |
58 |
+ |
38 |
+ |
59 |
+ for (i = 0; i < buffycount - 1; i++) { |
39 |
+ qsort(ary, buffycount, sizeof(*ary), buffy_compare_name); |
60 |
+ ary[i]->next = ary[i+1]; |
40 |
+ |
61 |
+ } |
41 |
+ for (i = 0; i < buffycount - 1; i++) { |
62 |
+ ary[buffycount - 1]->next = NULL; |
42 |
+ ary[i]->next = ary[i+1]; |
63 |
+ for (i = 1; i < buffycount; i++) { |
43 |
+ } |
64 |
+ ary[i]->prev = ary[i-1]; |
44 |
+ ary[buffycount - 1]->next = NULL; |
65 |
+ } |
45 |
+ for (i = 1; i < buffycount; i++) { |
66 |
+ ary[0]->prev = NULL; |
46 |
+ ary[i]->prev = ary[i-1]; |
67 |
+ |
47 |
+ } |
68 |
+ tmp = ary[0]; |
48 |
+ ary[0]->prev = NULL; |
69 |
+ free(ary); |
49 |
+ |
70 |
+ return tmp; |
50 |
+ tmp = ary[0]; |
71 |
+} |
51 |
+ free(ary); |
72 |
+ |
52 |
+ return tmp; |
73 |
BUFFY *mutt_find_mailbox (const char *path) |
53 |
+ } |
74 |
{ |
54 |
+ |
75 |
BUFFY *tmp = NULL; |
55 |
BUFFY *mutt_find_mailbox (const char *path) |
76 |
@@ -282,6 +325,7 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, uns |
56 |
{ |
77 |
else |
57 |
BUFFY *tmp = NULL; |
78 |
(*tmp)->size = 0; |
58 |
*************** |
79 |
} |
59 |
*** 196,204 **** |
80 |
+ Incoming = buffy_sort(Incoming); |
60 |
--- 239,251 ---- |
81 |
return 0; |
61 |
static BUFFY *buffy_new (const char *path) |
82 |
} |
62 |
{ |
83 |
|
63 |
BUFFY* buffy; |
84 |
@@ -340,6 +384,68 @@ static int buffy_maildir_hasnew (BUFFY* mailbox) |
64 |
+ char rp[PATH_MAX]; |
85 |
return rc; |
65 |
+ char *r; |
86 |
} |
66 |
|
87 |
|
67 |
buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY)); |
88 |
+/* update message counts for the sidebar */ |
68 |
strfcpy (buffy->path, path, sizeof (buffy->path)); |
89 |
+void buffy_maildir_update (BUFFY* mailbox) |
69 |
+ r = realpath(path, rp); |
90 |
+{ |
70 |
+ strfcpy (buffy->realpath, r ? rp : path, sizeof (buffy->realpath)); |
91 |
+ char path[_POSIX_PATH_MAX]; |
71 |
buffy->next = NULL; |
92 |
+ DIR *dirp; |
72 |
buffy->magic = 0; |
93 |
+ struct dirent *de; |
73 |
|
94 |
+ char *p; |
74 |
*************** |
95 |
+ |
75 |
*** 243,250 **** |
96 |
+ mailbox->msgcount = 0; |
76 |
p = realpath (buf, f1); |
97 |
+ mailbox->msg_unread = 0; |
77 |
for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next)) |
98 |
+ mailbox->msg_flagged = 0; |
|
|
99 |
+ |
100 |
+ snprintf (path, sizeof (path), "%s/new", mailbox->path); |
101 |
+ |
102 |
+ if ((dirp = opendir (path)) == NULL) |
103 |
+ { |
104 |
+ mailbox->magic = 0; |
105 |
+ return; |
106 |
+ } |
107 |
+ |
108 |
+ while ((de = readdir (dirp)) != NULL) |
109 |
+ { |
110 |
+ if (*de->d_name == '.') |
111 |
+ continue; |
112 |
+ |
113 |
+ if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) { |
114 |
+ mailbox->new = 1; |
115 |
+ mailbox->msgcount++; |
116 |
+ mailbox->msg_unread++; |
117 |
+ } |
118 |
+ } |
119 |
+ |
120 |
+ closedir (dirp); |
121 |
+ snprintf (path, sizeof (path), "%s/cur", mailbox->path); |
122 |
+ |
123 |
+ if ((dirp = opendir (path)) == NULL) |
124 |
+ { |
125 |
+ mailbox->magic = 0; |
126 |
+ return; |
127 |
+ } |
128 |
+ |
129 |
+ while ((de = readdir (dirp)) != NULL) |
130 |
+ { |
131 |
+ if (*de->d_name == '.') |
132 |
+ continue; |
133 |
+ |
134 |
+ if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) { |
135 |
+ mailbox->msgcount++; |
136 |
+ if ((p = strstr (de->d_name, ":2,"))) { |
137 |
+ if (!strchr (p + 3, 'T')) { |
138 |
+ if (!strchr (p + 3, 'S')) |
139 |
+ mailbox->msg_unread++; |
140 |
+ if (strchr(p + 3, 'F')) |
141 |
+ mailbox->msg_flagged++; |
142 |
+ } |
143 |
+ } |
144 |
+ } |
145 |
+ } |
146 |
+ |
147 |
+ closedir (dirp); |
148 |
+} |
149 |
+ |
150 |
/* returns 1 if mailbox has new mail */ |
151 |
static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb) |
152 |
{ |
153 |
@@ -371,6 +477,20 @@ static int buffy_mbox_hasnew (BUFFY* mailbox, struct s |
154 |
return rc; |
155 |
} |
156 |
|
157 |
+/* update message counts for the sidebar */ |
158 |
+void buffy_mbox_update (BUFFY* mailbox) |
159 |
+{ |
160 |
+ CONTEXT *ctx = NULL; |
161 |
+ |
162 |
+ ctx = mx_open_mailbox(mailbox->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL); |
163 |
+ if(ctx) |
164 |
+ { |
165 |
+ mailbox->msgcount = ctx->msgcount; |
166 |
+ mailbox->msg_unread = ctx->unread; |
167 |
+ mx_close_mailbox(ctx, 0); |
168 |
+ } |
169 |
+} |
170 |
+ |
171 |
int mutt_buffy_check (int force) |
172 |
{ |
173 |
BUFFY *tmp; |
174 |
@@ -444,16 +564,19 @@ int mutt_buffy_check (int force) |
175 |
{ |
176 |
case M_MBOX: |
177 |
case M_MMDF: |
178 |
+ buffy_mbox_update (tmp); |
179 |
if (buffy_mbox_hasnew (tmp, &sb) > 0) |
180 |
BuffyCount++; |
181 |
break; |
182 |
|
183 |
case M_MAILDIR: |
184 |
+ buffy_maildir_update (tmp); |
185 |
if (buffy_maildir_hasnew (tmp) > 0) |
186 |
BuffyCount++; |
187 |
break; |
188 |
|
189 |
case M_MH: |
190 |
+ mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged); |
191 |
mh_buffy(tmp); |
192 |
if (tmp->new) |
193 |
BuffyCount++; |
194 |
diff -uNp -r mutt-1.5.22.orig/buffy.h mutt-1.5.22/buffy.h |
195 |
--- mutt-1.5.22.orig/buffy.h Mon Apr 22 07:14:53 2013 |
196 |
+++ mutt-1.5.22/buffy.h Fri Oct 18 10:18:45 2013 |
197 |
@@ -25,7 +25,11 @@ typedef struct buffy_t |
198 |
char path[_POSIX_PATH_MAX]; |
199 |
off_t size; |
200 |
struct buffy_t *next; |
201 |
+ struct buffy_t *prev; |
202 |
short new; /* mailbox has new mail */ |
203 |
+ int msgcount; /* total number of messages */ |
204 |
+ int msg_unread; /* number of unread messages */ |
205 |
+ int msg_flagged; /* number of flagged messages */ |
206 |
short notified; /* user has been notified */ |
207 |
short magic; /* mailbox type */ |
208 |
short newly_created; /* mbox or mmdf just popped into existence */ |
209 |
diff -uNp -r mutt-1.5.22.orig/color.c mutt-1.5.22/color.c |
210 |
--- mutt-1.5.22.orig/color.c Tue Jan 15 07:37:15 2013 |
211 |
+++ mutt-1.5.22/color.c Fri Oct 18 10:19:53 2013 |
212 |
@@ -93,6 +93,8 @@ static const struct mapping_t Fields[] = |
213 |
{ "bold", MT_COLOR_BOLD }, |
214 |
{ "underline", MT_COLOR_UNDERLINE }, |
215 |
{ "index", MT_COLOR_INDEX }, |
216 |
+ { "sidebar_new", MT_COLOR_NEW }, |
217 |
+ { "sidebar_flagged", MT_COLOR_FLAGGED }, |
218 |
{ NULL, 0 } |
219 |
}; |
220 |
|
221 |
diff -uNp -r mutt-1.5.22.orig/compose.c mutt-1.5.22/compose.c |
222 |
--- mutt-1.5.22.orig/compose.c Fri Oct 18 05:48:24 2013 |
223 |
+++ mutt-1.5.22/compose.c Fri Oct 18 10:22:12 2013 |
224 |
@@ -72,7 +72,7 @@ enum |
225 |
|
226 |
#define HDR_XOFFSET 10 |
227 |
#define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */ |
228 |
-#define W (COLS - HDR_XOFFSET) |
229 |
+#define W (COLS - HDR_XOFFSET - SidebarWidth) |
230 |
|
231 |
static const char * const Prompts[] = |
232 |
{ |
233 |
@@ -110,7 +110,7 @@ static void snd_entry (char *b, size_t blen, MUTTMENU |
234 |
|
235 |
static void redraw_crypt_lines (HEADER *msg) |
236 |
{ |
237 |
- mvaddstr (HDR_CRYPT, 0, "Security: "); |
238 |
+ mvaddstr (HDR_CRYPT, SidebarWidth, "Security: "); |
239 |
|
240 |
if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0) |
241 |
{ |
242 |
@@ -142,7 +142,7 @@ static void redraw_crypt_lines (HEADER *msg) |
243 |
} |
244 |
|
245 |
clrtoeol (); |
246 |
- move (HDR_CRYPTINFO, 0); |
247 |
+ move (HDR_CRYPTINFO, SidebarWidth); |
248 |
clrtoeol (); |
249 |
|
250 |
if ((WithCrypto & APPLICATION_PGP) |
251 |
@@ -159,7 +159,7 @@ static void redraw_crypt_lines (HEADER *msg) |
252 |
&& (msg->security & ENCRYPT) |
253 |
&& SmimeCryptAlg |
254 |
&& *SmimeCryptAlg) { |
255 |
- mvprintw (HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "), |
256 |
+ mvprintw (HDR_CRYPTINFO, SidebarWidth + 40, "%s%s", _("Encrypt with: "), |
257 |
NONULL(SmimeCryptAlg)); |
258 |
} |
259 |
} |
260 |
@@ -172,7 +172,7 @@ static void redraw_mix_line (LIST *chain) |
261 |
int c; |
262 |
char *t; |
263 |
|
264 |
- mvaddstr (HDR_MIX, 0, " Mix: "); |
265 |
+ mvaddstr (HDR_MIX, SidebarWidth, " Mix: "); |
266 |
|
267 |
if (!chain) |
268 |
{ |
269 |
@@ -187,7 +187,7 @@ static void redraw_mix_line (LIST *chain) |
270 |
if (t && t[0] == '0' && t[1] == '\0') |
271 |
t = "<random>"; |
272 |
|
273 |
- if (c + mutt_strlen (t) + 2 >= COLS) |
274 |
+ if (c + mutt_strlen (t) + 2 >= COLS - SidebarWidth) |
275 |
break; |
276 |
|
277 |
addstr (NONULL(t)); |
278 |
@@ -239,7 +239,7 @@ static void draw_envelope_addr (int line, ADDRESS *add |
279 |
|
280 |
buf[0] = 0; |
281 |
rfc822_write_address (buf, sizeof (buf), addr, 1); |
282 |
- mvprintw (line, 0, TITLE_FMT, Prompts[line - 1]); |
283 |
+ mvprintw (line, SidebarWidth, TITLE_FMT, Prompts[line - 1]); |
284 |
mutt_paddstr (W, buf); |
285 |
} |
286 |
|
287 |
@@ -249,10 +249,10 @@ static void draw_envelope (HEADER *msg, char *fcc) |
288 |
draw_envelope_addr (HDR_TO, msg->env->to); |
289 |
draw_envelope_addr (HDR_CC, msg->env->cc); |
290 |
draw_envelope_addr (HDR_BCC, msg->env->bcc); |
291 |
- mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]); |
292 |
+ mvprintw (HDR_SUBJECT, SidebarWidth, TITLE_FMT, Prompts[HDR_SUBJECT - 1]); |
293 |
mutt_paddstr (W, NONULL (msg->env->subject)); |
294 |
draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to); |
295 |
- mvprintw (HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]); |
296 |
+ mvprintw (HDR_FCC, SidebarWidth, TITLE_FMT, Prompts[HDR_FCC - 1]); |
297 |
mutt_paddstr (W, fcc); |
298 |
|
299 |
if (WithCrypto) |
300 |
@@ -263,7 +263,7 @@ static void draw_envelope (HEADER *msg, char *fcc) |
301 |
#endif |
302 |
|
303 |
SETCOLOR (MT_COLOR_STATUS); |
304 |
- mvaddstr (HDR_ATTACH - 1, 0, _("-- Attachments")); |
305 |
+ mvaddstr (HDR_ATTACH - 1, SidebarWidth, _("-- Attachments")); |
306 |
clrtoeol (); |
307 |
|
308 |
NORMAL_COLOR; |
309 |
@@ -299,7 +299,7 @@ static int edit_address_list (int line, ADDRESS **addr |
310 |
/* redraw the expanded list so the user can see the result */ |
311 |
buf[0] = 0; |
312 |
rfc822_write_address (buf, sizeof (buf), *addr, 1); |
313 |
- move (line, HDR_XOFFSET); |
314 |
+ move (line, HDR_XOFFSET+SidebarWidth); |
315 |
mutt_paddstr (W, buf); |
316 |
|
317 |
return 0; |
318 |
@@ -544,7 +544,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for |
319 |
if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) |
320 |
{ |
321 |
mutt_str_replace (&msg->env->subject, buf); |
322 |
- move (HDR_SUBJECT, HDR_XOFFSET); |
323 |
+ move (HDR_SUBJECT, HDR_XOFFSET + SidebarWidth); |
324 |
if (msg->env->subject) |
325 |
mutt_paddstr (W, msg->env->subject); |
326 |
else |
327 |
@@ -562,7 +562,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for |
328 |
{ |
329 |
strfcpy (fcc, buf, fcclen); |
330 |
mutt_pretty_mailbox (fcc, fcclen); |
331 |
- move (HDR_FCC, HDR_XOFFSET); |
332 |
+ move (HDR_FCC, HDR_XOFFSET + SidebarWidth); |
333 |
mutt_paddstr (W, fcc); |
334 |
fccSet = 1; |
335 |
} |
336 |
diff -uNp -r mutt-1.5.22.orig/curs_main.c mutt-1.5.22/curs_main.c |
337 |
--- mutt-1.5.22.orig/curs_main.c Tue Jan 15 07:37:15 2013 |
338 |
+++ mutt-1.5.22/curs_main.c Fri Oct 18 10:18:45 2013 |
339 |
@@ -26,7 +26,9 @@ |
340 |
#include "mailbox.h" |
341 |
#include "mapping.h" |
342 |
#include "sort.h" |
343 |
+#include "buffy.h" |
344 |
#include "mx.h" |
345 |
+#include "sidebar.h" |
346 |
|
347 |
#ifdef USE_POP |
348 |
#include "pop.h" |
349 |
@@ -519,8 +521,12 @@ int mutt_index_menu (void) |
350 |
menu->redraw |= REDRAW_STATUS; |
351 |
if (do_buffy_notify) |
352 |
{ |
78 |
{ |
353 |
- if (mutt_buffy_notify () && option (OPTBEEPNEW)) |
79 |
! q = realpath ((*tmp)->path, f2); |
354 |
- beep (); |
80 |
! if (mutt_strcmp (p ? p : buf, q ? q : (*tmp)->path) == 0) |
355 |
+ if (mutt_buffy_notify ()) |
81 |
{ |
356 |
+ { |
82 |
dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path)); |
357 |
+ menu->redraw |= REDRAW_FULL; |
83 |
break; |
358 |
+ if (option (OPTBEEPNEW)) |
84 |
--- 290,297 ---- |
359 |
+ beep (); |
85 |
p = realpath (buf, f1); |
|
|
86 |
for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next)) |
87 |
{ |
88 |
! q = (*tmp)->realpath; |
89 |
! if (mutt_strcmp (p ? p : buf, q) == 0) |
90 |
{ |
91 |
dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path)); |
92 |
break; |
93 |
*************** |
94 |
*** 282,287 **** |
95 |
--- 329,335 ---- |
96 |
else |
97 |
(*tmp)->size = 0; |
98 |
} |
99 |
+ Incoming = buffy_sort(Incoming); |
100 |
return 0; |
101 |
} |
102 |
|
103 |
*************** |
104 |
*** 306,311 **** |
105 |
--- 354,364 ---- |
106 |
return 0; |
107 |
} |
108 |
|
109 |
+ if (option(OPTSIDEBAR) && mailbox->msg_unread > 0) { |
110 |
+ mailbox->new = 1; |
111 |
+ return 1; |
112 |
+ } |
113 |
+ |
114 |
if ((dirp = opendir (path)) == NULL) |
115 |
{ |
116 |
mailbox->magic = 0; |
117 |
*************** |
118 |
*** 340,345 **** |
119 |
--- 393,464 ---- |
120 |
return rc; |
121 |
} |
122 |
|
123 |
+ /* update message counts for the sidebar */ |
124 |
+ void buffy_maildir_update (BUFFY* mailbox) |
125 |
+ { |
126 |
+ char path[_POSIX_PATH_MAX]; |
127 |
+ DIR *dirp; |
128 |
+ struct dirent *de; |
129 |
+ char *p; |
130 |
+ |
131 |
+ if(!option(OPTSIDEBAR)) |
132 |
+ return; |
133 |
+ |
134 |
+ mailbox->msgcount = 0; |
135 |
+ mailbox->msg_unread = 0; |
136 |
+ mailbox->msg_flagged = 0; |
137 |
+ |
138 |
+ snprintf (path, sizeof (path), "%s/new", mailbox->path); |
139 |
+ |
140 |
+ if ((dirp = opendir (path)) == NULL) |
141 |
+ { |
142 |
+ mailbox->magic = 0; |
143 |
+ return; |
144 |
+ } |
145 |
+ |
146 |
+ while ((de = readdir (dirp)) != NULL) |
147 |
+ { |
148 |
+ if (*de->d_name == '.') |
149 |
+ continue; |
150 |
+ |
151 |
+ if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) { |
152 |
+ mailbox->new = 1; |
153 |
+ mailbox->msgcount++; |
154 |
+ mailbox->msg_unread++; |
155 |
+ } |
156 |
+ } |
157 |
+ |
158 |
+ closedir (dirp); |
159 |
+ snprintf (path, sizeof (path), "%s/cur", mailbox->path); |
160 |
+ |
161 |
+ if ((dirp = opendir (path)) == NULL) |
162 |
+ { |
163 |
+ mailbox->magic = 0; |
164 |
+ return; |
165 |
+ } |
166 |
+ |
167 |
+ while ((de = readdir (dirp)) != NULL) |
168 |
+ { |
169 |
+ if (*de->d_name == '.') |
170 |
+ continue; |
171 |
+ |
172 |
+ if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) { |
173 |
+ mailbox->msgcount++; |
174 |
+ if ((p = strstr (de->d_name, ":2,"))) { |
175 |
+ if (!strchr (p + 3, 'T')) { |
176 |
+ if (!strchr (p + 3, 'S')) |
177 |
+ mailbox->msg_unread++; |
178 |
+ if (strchr(p + 3, 'F')) |
179 |
+ mailbox->msg_flagged++; |
180 |
+ } |
360 |
+ } |
181 |
+ } |
|
|
182 |
+ } |
183 |
+ } |
184 |
+ |
185 |
+ mailbox->sb_last_checked = time(NULL); |
186 |
+ closedir (dirp); |
187 |
+ } |
188 |
+ |
189 |
/* returns 1 if mailbox has new mail */ |
190 |
static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb) |
191 |
{ |
192 |
*************** |
193 |
*** 351,357 **** |
194 |
else |
195 |
statcheck = sb->st_mtime > sb->st_atime |
196 |
|| (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime); |
197 |
! if (statcheck) |
198 |
{ |
199 |
if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited) |
200 |
{ |
201 |
--- 470,476 ---- |
202 |
else |
203 |
statcheck = sb->st_mtime > sb->st_atime |
204 |
|| (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime); |
205 |
! if ((!option(OPTSIDEBAR) && statcheck) || (option(OPTSIDEBAR) && mailbox->msg_unread > 0)) |
206 |
{ |
207 |
if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited) |
208 |
{ |
209 |
*************** |
210 |
*** 371,376 **** |
211 |
--- 490,516 ---- |
212 |
return rc; |
213 |
} |
214 |
|
215 |
+ /* update message counts for the sidebar */ |
216 |
+ void buffy_mbox_update (BUFFY* mailbox, struct stat *sb) |
217 |
+ { |
218 |
+ CONTEXT *ctx = NULL; |
219 |
+ |
220 |
+ if(!option(OPTSIDEBAR)) |
221 |
+ return; |
222 |
+ if(mailbox->sb_last_checked > sb->st_mtime && mailbox->msgcount != 0) |
223 |
+ return; /* no check necessary */ |
224 |
+ |
225 |
+ ctx = mx_open_mailbox(mailbox->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL); |
226 |
+ if(ctx) |
227 |
+ { |
228 |
+ mailbox->msgcount = ctx->msgcount; |
229 |
+ mailbox->msg_unread = ctx->unread; |
230 |
+ mailbox->msg_flagged = ctx->flagged; |
231 |
+ mailbox->sb_last_checked = time(NULL); |
232 |
+ mx_close_mailbox(ctx, 0); |
233 |
+ } |
234 |
+ } |
235 |
+ |
236 |
int mutt_buffy_check (int force) |
237 |
{ |
238 |
BUFFY *tmp; |
239 |
*************** |
240 |
*** 444,460 **** |
241 |
{ |
242 |
case M_MBOX: |
243 |
case M_MMDF: |
244 |
if (buffy_mbox_hasnew (tmp, &sb) > 0) |
245 |
BuffyCount++; |
246 |
break; |
247 |
|
248 |
case M_MAILDIR: |
249 |
if (buffy_maildir_hasnew (tmp) > 0) |
250 |
BuffyCount++; |
251 |
break; |
252 |
|
253 |
case M_MH: |
254 |
! mh_buffy(tmp); |
255 |
if (tmp->new) |
256 |
BuffyCount++; |
257 |
break; |
258 |
--- 584,603 ---- |
259 |
{ |
260 |
case M_MBOX: |
261 |
case M_MMDF: |
262 |
+ buffy_mbox_update (tmp, &sb); |
263 |
if (buffy_mbox_hasnew (tmp, &sb) > 0) |
264 |
BuffyCount++; |
265 |
break; |
266 |
|
267 |
case M_MAILDIR: |
268 |
+ buffy_maildir_update (tmp); |
269 |
if (buffy_maildir_hasnew (tmp) > 0) |
270 |
BuffyCount++; |
271 |
break; |
272 |
|
273 |
case M_MH: |
274 |
! mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked); |
275 |
! mh_buffy(tmp); |
276 |
if (tmp->new) |
277 |
BuffyCount++; |
278 |
break; |
279 |
*** mutt-1.5.23-orig/buffy.h 2014-03-12 11:03:44.000000000 -0500 |
280 |
--- mutt-1.5.23/buffy.h 2014-04-11 10:14:01.000000000 -0500 |
281 |
*************** |
282 |
*** 23,35 **** |
283 |
--- 23,41 ---- |
284 |
typedef struct buffy_t |
285 |
{ |
286 |
char path[_POSIX_PATH_MAX]; |
287 |
+ char realpath[_POSIX_PATH_MAX]; |
288 |
off_t size; |
289 |
struct buffy_t *next; |
290 |
+ struct buffy_t *prev; |
291 |
short new; /* mailbox has new mail */ |
292 |
+ int msgcount; /* total number of messages */ |
293 |
+ int msg_unread; /* number of unread messages */ |
294 |
+ int msg_flagged; /* number of flagged messages */ |
295 |
short notified; /* user has been notified */ |
296 |
short magic; /* mailbox type */ |
297 |
short newly_created; /* mbox or mmdf just popped into existence */ |
298 |
time_t last_visited; /* time of last exit from this mailbox */ |
299 |
+ time_t sb_last_checked; /* time of last buffy check from sidebar */ |
300 |
} |
301 |
BUFFY; |
302 |
|
303 |
*** mutt-1.5.23-orig/color.c 2014-03-12 11:03:45.000000000 -0500 |
304 |
--- mutt-1.5.23/color.c 2014-04-11 10:14:01.000000000 -0500 |
305 |
*************** |
306 |
*** 93,98 **** |
307 |
--- 93,100 ---- |
308 |
{ "bold", MT_COLOR_BOLD }, |
309 |
{ "underline", MT_COLOR_UNDERLINE }, |
310 |
{ "index", MT_COLOR_INDEX }, |
311 |
+ { "sidebar_new", MT_COLOR_NEW }, |
312 |
+ { "sidebar_flagged", MT_COLOR_FLAGGED }, |
313 |
{ NULL, 0 } |
314 |
}; |
315 |
|
316 |
*** mutt-1.5.23-orig/compose.c 2014-03-12 11:03:45.000000000 -0500 |
317 |
--- mutt-1.5.23/compose.c 2014-04-12 12:15:56.000000000 -0500 |
318 |
*************** |
319 |
*** 72,78 **** |
320 |
|
321 |
#define HDR_XOFFSET 10 |
322 |
#define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */ |
323 |
! #define W (COLS - HDR_XOFFSET) |
324 |
|
325 |
static const char * const Prompts[] = |
326 |
{ |
327 |
--- 72,78 ---- |
328 |
|
329 |
#define HDR_XOFFSET 10 |
330 |
#define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */ |
331 |
! #define W (COLS - HDR_XOFFSET - SidebarWidth) |
332 |
|
333 |
static const char * const Prompts[] = |
334 |
{ |
335 |
*************** |
336 |
*** 110,116 **** |
337 |
|
338 |
static void redraw_crypt_lines (HEADER *msg) |
339 |
{ |
340 |
! mvaddstr (HDR_CRYPT, 0, "Security: "); |
341 |
|
342 |
if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0) |
343 |
{ |
344 |
--- 110,116 ---- |
345 |
|
346 |
static void redraw_crypt_lines (HEADER *msg) |
347 |
{ |
348 |
! mvaddstr (HDR_CRYPT, SidebarWidth, "Security: "); |
349 |
|
350 |
if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0) |
351 |
{ |
352 |
*************** |
353 |
*** 142,148 **** |
354 |
} |
355 |
|
356 |
clrtoeol (); |
357 |
! move (HDR_CRYPTINFO, 0); |
358 |
clrtoeol (); |
359 |
|
360 |
if ((WithCrypto & APPLICATION_PGP) |
361 |
--- 142,148 ---- |
362 |
} |
363 |
|
364 |
clrtoeol (); |
365 |
! move (HDR_CRYPTINFO, SidebarWidth); |
366 |
clrtoeol (); |
367 |
|
368 |
if ((WithCrypto & APPLICATION_PGP) |
369 |
*************** |
370 |
*** 159,165 **** |
371 |
&& (msg->security & ENCRYPT) |
372 |
&& SmimeCryptAlg |
373 |
&& *SmimeCryptAlg) { |
374 |
! mvprintw (HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "), |
375 |
NONULL(SmimeCryptAlg)); |
376 |
} |
377 |
} |
378 |
--- 159,165 ---- |
379 |
&& (msg->security & ENCRYPT) |
380 |
&& SmimeCryptAlg |
381 |
&& *SmimeCryptAlg) { |
382 |
! mvprintw (HDR_CRYPTINFO, SidebarWidth + 40, "%s%s", _("Encrypt with: "), |
383 |
NONULL(SmimeCryptAlg)); |
384 |
} |
385 |
} |
386 |
*************** |
387 |
*** 172,178 **** |
388 |
int c; |
389 |
char *t; |
390 |
|
391 |
! mvaddstr (HDR_MIX, 0, " Mix: "); |
392 |
|
393 |
if (!chain) |
394 |
{ |
395 |
--- 172,178 ---- |
396 |
int c; |
397 |
char *t; |
398 |
|
399 |
! mvaddstr (HDR_MIX, SidebarWidth, " Mix: "); |
400 |
|
401 |
if (!chain) |
402 |
{ |
403 |
*************** |
404 |
*** 187,193 **** |
405 |
if (t && t[0] == '0' && t[1] == '\0') |
406 |
t = "<random>"; |
407 |
|
408 |
! if (c + mutt_strlen (t) + 2 >= COLS) |
409 |
break; |
410 |
|
411 |
addstr (NONULL(t)); |
412 |
--- 187,193 ---- |
413 |
if (t && t[0] == '0' && t[1] == '\0') |
414 |
t = "<random>"; |
415 |
|
416 |
! if (c + mutt_strlen (t) + 2 >= COLS - SidebarWidth) |
417 |
break; |
418 |
|
419 |
addstr (NONULL(t)); |
420 |
*************** |
421 |
*** 239,245 **** |
422 |
|
423 |
buf[0] = 0; |
424 |
rfc822_write_address (buf, sizeof (buf), addr, 1); |
425 |
! mvprintw (line, 0, TITLE_FMT, Prompts[line - 1]); |
426 |
mutt_paddstr (W, buf); |
427 |
} |
428 |
|
429 |
--- 239,245 ---- |
430 |
|
431 |
buf[0] = 0; |
432 |
rfc822_write_address (buf, sizeof (buf), addr, 1); |
433 |
! mvprintw (line, SidebarWidth, TITLE_FMT, Prompts[line - 1]); |
434 |
mutt_paddstr (W, buf); |
435 |
} |
436 |
|
437 |
*************** |
438 |
*** 249,258 **** |
439 |
draw_envelope_addr (HDR_TO, msg->env->to); |
440 |
draw_envelope_addr (HDR_CC, msg->env->cc); |
441 |
draw_envelope_addr (HDR_BCC, msg->env->bcc); |
442 |
! mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]); |
443 |
mutt_paddstr (W, NONULL (msg->env->subject)); |
444 |
draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to); |
445 |
! mvprintw (HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]); |
446 |
mutt_paddstr (W, fcc); |
447 |
|
448 |
if (WithCrypto) |
449 |
--- 249,258 ---- |
450 |
draw_envelope_addr (HDR_TO, msg->env->to); |
451 |
draw_envelope_addr (HDR_CC, msg->env->cc); |
452 |
draw_envelope_addr (HDR_BCC, msg->env->bcc); |
453 |
! mvprintw (HDR_SUBJECT, SidebarWidth, TITLE_FMT, Prompts[HDR_SUBJECT - 1]); |
454 |
mutt_paddstr (W, NONULL (msg->env->subject)); |
455 |
draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to); |
456 |
! mvprintw (HDR_FCC, SidebarWidth, TITLE_FMT, Prompts[HDR_FCC - 1]); |
457 |
mutt_paddstr (W, fcc); |
458 |
|
459 |
if (WithCrypto) |
460 |
*************** |
461 |
*** 263,269 **** |
462 |
#endif |
463 |
|
464 |
SETCOLOR (MT_COLOR_STATUS); |
465 |
! mvaddstr (HDR_ATTACH - 1, 0, _("-- Attachments")); |
466 |
clrtoeol (); |
467 |
|
468 |
NORMAL_COLOR; |
469 |
--- 263,269 ---- |
470 |
#endif |
471 |
|
472 |
SETCOLOR (MT_COLOR_STATUS); |
473 |
! mvaddstr (HDR_ATTACH - 1, SidebarWidth, _("-- Attachments")); |
474 |
clrtoeol (); |
475 |
|
476 |
NORMAL_COLOR; |
477 |
*************** |
478 |
*** 299,305 **** |
479 |
/* redraw the expanded list so the user can see the result */ |
480 |
buf[0] = 0; |
481 |
rfc822_write_address (buf, sizeof (buf), *addr, 1); |
482 |
! move (line, HDR_XOFFSET); |
483 |
mutt_paddstr (W, buf); |
484 |
|
485 |
return 0; |
486 |
--- 299,305 ---- |
487 |
/* redraw the expanded list so the user can see the result */ |
488 |
buf[0] = 0; |
489 |
rfc822_write_address (buf, sizeof (buf), *addr, 1); |
490 |
! move (line, HDR_XOFFSET+SidebarWidth); |
491 |
mutt_paddstr (W, buf); |
492 |
|
493 |
return 0; |
494 |
*************** |
495 |
*** 544,550 **** |
496 |
if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) |
497 |
{ |
498 |
mutt_str_replace (&msg->env->subject, buf); |
499 |
! move (HDR_SUBJECT, HDR_XOFFSET); |
500 |
if (msg->env->subject) |
501 |
mutt_paddstr (W, msg->env->subject); |
502 |
else |
503 |
--- 544,550 ---- |
504 |
if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) |
505 |
{ |
506 |
mutt_str_replace (&msg->env->subject, buf); |
507 |
! move (HDR_SUBJECT, HDR_XOFFSET + SidebarWidth); |
508 |
if (msg->env->subject) |
509 |
mutt_paddstr (W, msg->env->subject); |
510 |
else |
511 |
*************** |
512 |
*** 562,568 **** |
513 |
{ |
514 |
strfcpy (fcc, buf, fcclen); |
515 |
mutt_pretty_mailbox (fcc, fcclen); |
516 |
! move (HDR_FCC, HDR_XOFFSET); |
517 |
mutt_paddstr (W, fcc); |
518 |
fccSet = 1; |
519 |
} |
520 |
--- 562,568 ---- |
521 |
{ |
522 |
strfcpy (fcc, buf, fcclen); |
523 |
mutt_pretty_mailbox (fcc, fcclen); |
524 |
! move (HDR_FCC, HDR_XOFFSET + SidebarWidth); |
525 |
mutt_paddstr (W, fcc); |
526 |
fccSet = 1; |
527 |
} |
528 |
*** mutt-1.5.23-orig/configure.ac 2014-03-12 11:26:40.000000000 -0500 |
529 |
--- mutt-1.5.23/configure.ac 2014-04-11 10:14:01.000000000 -0500 |
530 |
*************** |
531 |
*** 1276,1281 **** |
532 |
--- 1276,1283 ---- |
533 |
AC_DEFINE(HAVE_LANGINFO_YESEXPR,1,[ Define if you have <langinfo.h> and nl_langinfo(YESEXPR). ]) |
534 |
fi |
535 |
|
536 |
+ AC_CHECK_FUNCS(fmemopen open_memstream) |
537 |
+ |
538 |
dnl Documentation tools |
539 |
have_openjade="no" |
540 |
AC_PATH_PROG([OSPCAT], [ospcat], [none]) |
541 |
*** mutt-1.5.23-orig/curs_main.c 2014-03-12 11:06:17.000000000 -0500 |
542 |
--- mutt-1.5.23/curs_main.c 2014-04-12 21:45:21.000000000 -0500 |
543 |
*************** |
544 |
*** 26,32 **** |
545 |
--- 26,34 ---- |
546 |
#include "mailbox.h" |
547 |
#include "mapping.h" |
548 |
#include "sort.h" |
549 |
+ #include "buffy.h" |
550 |
#include "mx.h" |
551 |
+ #include "sidebar.h" |
552 |
|
553 |
#ifdef USE_POP |
554 |
#include "pop.h" |
555 |
*************** |
556 |
*** 519,538 **** |
557 |
menu->redraw |= REDRAW_STATUS; |
558 |
if (do_buffy_notify) |
559 |
{ |
560 |
! if (mutt_buffy_notify () && option (OPTBEEPNEW)) |
561 |
! beep (); |
562 |
} |
563 |
else |
564 |
do_buffy_notify = 1; |
361 |
} |
565 |
} |
362 |
else |
566 |
|
363 |
do_buffy_notify = 1; |
567 |
if (op != -1) |
364 |
@@ -532,6 +538,7 @@ int mutt_index_menu (void) |
568 |
mutt_curs_set (0); |
365 |
if (menu->redraw & REDRAW_FULL) |
569 |
|
366 |
{ |
570 |
if (menu->redraw & REDRAW_FULL) |
367 |
menu_redraw_full (menu); |
571 |
{ |
368 |
+ draw_sidebar(menu->menu); |
572 |
menu_redraw_full (menu); |
369 |
mutt_show_error (); |
573 |
mutt_show_error (); |
370 |
} |
574 |
} |
371 |
|
575 |
|
372 |
@@ -554,9 +561,12 @@ int mutt_index_menu (void) |
576 |
if (menu->menu == MENU_MAIN) |
373 |
|
577 |
--- 521,551 ---- |
374 |
if (menu->redraw & REDRAW_STATUS) |
578 |
menu->redraw |= REDRAW_STATUS; |
|
|
579 |
if (do_buffy_notify) |
375 |
{ |
580 |
{ |
376 |
+ DrawFullLine = 1; |
581 |
! if (mutt_buffy_notify ()) |
377 |
menu_status_line (buf, sizeof (buf), menu, NONULL (Status)); |
582 |
! { |
378 |
+ DrawFullLine = 0; |
583 |
! menu->redraw |= REDRAW_STATUS; |
379 |
move (option (OPTSTATUSONTOP) ? 0 : LINES-2, 0); |
584 |
! if (option (OPTBEEPNEW)) |
380 |
SETCOLOR (MT_COLOR_STATUS); |
585 |
! beep (); |
381 |
+ set_buffystats(Context); |
586 |
! } |
382 |
mutt_paddstr (COLS, buf); |
587 |
} |
383 |
NORMAL_COLOR; |
|
|
384 |
menu->redraw &= ~REDRAW_STATUS; |
385 |
@@ -569,7 +579,7 @@ int mutt_index_menu (void) |
386 |
menu->oldcurrent = -1; |
387 |
|
388 |
if (option (OPTARROWCURSOR)) |
389 |
- move (menu->current - menu->top + menu->offset, 2); |
390 |
+ move (menu->current - menu->top + menu->offset, SidebarWidth + 2); |
391 |
else if (option (OPTBRAILLEFRIENDLY)) |
392 |
move (menu->current - menu->top + menu->offset, 0); |
393 |
else |
588 |
else |
394 |
@@ -1070,6 +1080,7 @@ int mutt_index_menu (void) |
589 |
do_buffy_notify = 1; |
395 |
menu->redraw = REDRAW_FULL; |
590 |
} |
396 |
break; |
591 |
|
397 |
|
592 |
+ if(option(OPTSIDEBAR)) |
398 |
+ case OP_SIDEBAR_OPEN: |
593 |
+ menu->redraw |= REDRAW_SIDEBAR; |
399 |
case OP_MAIN_CHANGE_FOLDER: |
594 |
+ |
400 |
case OP_MAIN_NEXT_UNREAD_MAILBOX: |
595 |
if (op != -1) |
401 |
|
596 |
mutt_curs_set (0); |
402 |
@@ -1101,7 +1112,11 @@ int mutt_index_menu (void) |
597 |
|
403 |
{ |
598 |
if (menu->redraw & REDRAW_FULL) |
404 |
mutt_buffy (buf, sizeof (buf)); |
599 |
{ |
405 |
|
600 |
menu_redraw_full (menu); |
406 |
- if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1) |
601 |
+ draw_sidebar(menu->menu); |
407 |
+ if ( op == OP_SIDEBAR_OPEN ) { |
602 |
mutt_show_error (); |
408 |
+ if(!CurBuffy) |
603 |
+ } else if(menu->redraw & REDRAW_SIDEBAR) { |
409 |
+ break; |
604 |
+ draw_sidebar(menu->menu); |
410 |
+ strncpy( buf, CurBuffy->path, sizeof(buf) ); |
605 |
+ menu->redraw &= ~REDRAW_SIDEBAR; |
411 |
+ } else if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1) |
606 |
} |
412 |
{ |
607 |
|
413 |
if (menu->menu == MENU_PAGER) |
608 |
if (menu->menu == MENU_MAIN) |
414 |
{ |
609 |
*************** |
415 |
@@ -1119,6 +1134,7 @@ int mutt_index_menu (void) |
610 |
*** 554,562 **** |
416 |
} |
611 |
--- 567,578 ---- |
417 |
|
612 |
|
418 |
mutt_expand_path (buf, sizeof (buf)); |
613 |
if (menu->redraw & REDRAW_STATUS) |
419 |
+ set_curbuffy(buf); |
614 |
{ |
420 |
if (mx_get_magic (buf) <= 0) |
615 |
+ DrawFullLine = 1; |
421 |
{ |
616 |
menu_status_line (buf, sizeof (buf), menu, NONULL (Status)); |
422 |
mutt_error (_("%s is not a mailbox."), buf); |
617 |
+ DrawFullLine = 0; |
423 |
@@ -2209,6 +2225,12 @@ int mutt_index_menu (void) |
618 |
move (option (OPTSTATUSONTOP) ? 0 : LINES-2, 0); |
424 |
mutt_what_key(); |
619 |
SETCOLOR (MT_COLOR_STATUS); |
425 |
break; |
620 |
+ set_buffystats(Context); |
426 |
|
621 |
mutt_paddstr (COLS, buf); |
427 |
+ case OP_SIDEBAR_SCROLL_UP: |
622 |
NORMAL_COLOR; |
428 |
+ case OP_SIDEBAR_SCROLL_DOWN: |
623 |
menu->redraw &= ~REDRAW_STATUS; |
429 |
+ case OP_SIDEBAR_NEXT: |
624 |
*************** |
430 |
+ case OP_SIDEBAR_PREV: |
625 |
*** 569,575 **** |
431 |
+ scroll_sidebar(op, menu->menu); |
626 |
menu->oldcurrent = -1; |
432 |
+ break; |
627 |
|
433 |
default: |
628 |
if (option (OPTARROWCURSOR)) |
434 |
if (menu->menu == MENU_MAIN) |
629 |
! move (menu->current - menu->top + menu->offset, 2); |
435 |
km_error_key (MENU_MAIN); |
630 |
else if (option (OPTBRAILLEFRIENDLY)) |
436 |
diff -uNp -r mutt-1.5.22.orig/flags.c mutt-1.5.22/flags.c |
631 |
move (menu->current - menu->top + menu->offset, 0); |
437 |
--- mutt-1.5.22.orig/flags.c Sun Feb 21 22:10:41 2010 |
632 |
else |
438 |
+++ mutt-1.5.22/flags.c Fri Oct 18 10:18:45 2013 |
633 |
--- 585,591 ---- |
439 |
@@ -22,8 +22,10 @@ |
634 |
menu->oldcurrent = -1; |
440 |
|
635 |
|
441 |
#include "mutt.h" |
636 |
if (option (OPTARROWCURSOR)) |
442 |
#include "mutt_curses.h" |
637 |
! move (menu->current - menu->top + menu->offset, SidebarWidth + 2); |
443 |
+#include "mutt_menu.h" |
638 |
else if (option (OPTBRAILLEFRIENDLY)) |
444 |
#include "sort.h" |
639 |
move (menu->current - menu->top + menu->offset, 0); |
445 |
#include "mx.h" |
640 |
else |
446 |
+#include "sidebar.h" |
641 |
*************** |
447 |
|
642 |
*** 1011,1016 **** |
448 |
void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx) |
643 |
--- 1027,1033 ---- |
449 |
{ |
644 |
break; |
450 |
@@ -263,6 +265,7 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag |
645 |
|
451 |
*/ |
646 |
CHECK_MSGCOUNT; |
452 |
if (h->searched && (changed != h->changed || deleted != ctx->deleted || tagged != ctx->tagged || flagged != ctx->flagged)) |
647 |
+ CHECK_VISIBLE; |
453 |
h->searched = 0; |
648 |
CHECK_READONLY; |
454 |
+ draw_sidebar(0); |
649 |
{ |
455 |
} |
650 |
int oldvcount = Context->vcount; |
456 |
|
651 |
*************** |
457 |
void mutt_tag_set_flag (int flag, int bf) |
652 |
*** 1070,1075 **** |
458 |
diff -uNp -r mutt-1.5.22.orig/functions.h mutt-1.5.22/functions.h |
653 |
--- 1087,1093 ---- |
459 |
--- mutt-1.5.22.orig/functions.h Sat Dec 3 19:10:04 2011 |
654 |
menu->redraw = REDRAW_FULL; |
460 |
+++ mutt-1.5.22/functions.h Fri Oct 18 10:18:45 2013 |
655 |
break; |
461 |
@@ -169,6 +169,11 @@ const struct binding_t OpMain[] = { /* map: index */ |
656 |
|
462 |
{ "decrypt-save", OP_DECRYPT_SAVE, NULL }, |
657 |
+ case OP_SIDEBAR_OPEN: |
463 |
|
658 |
case OP_MAIN_CHANGE_FOLDER: |
464 |
|
659 |
case OP_MAIN_NEXT_UNREAD_MAILBOX: |
465 |
+ { "sidebar-scroll-up", OP_SIDEBAR_SCROLL_UP, NULL }, |
660 |
|
466 |
+ { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL }, |
661 |
*************** |
467 |
+ { "sidebar-next", OP_SIDEBAR_NEXT, NULL }, |
662 |
*** 1101,1107 **** |
468 |
+ { "sidebar-prev", OP_SIDEBAR_PREV, NULL }, |
663 |
{ |
469 |
+ { "sidebar-open", OP_SIDEBAR_OPEN, NULL }, |
664 |
mutt_buffy (buf, sizeof (buf)); |
470 |
{ NULL, 0, NULL } |
665 |
|
471 |
}; |
666 |
! if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1) |
472 |
|
667 |
{ |
473 |
@@ -272,6 +277,11 @@ const struct binding_t OpPager[] = { /* map: pager */ |
668 |
if (menu->menu == MENU_PAGER) |
474 |
|
669 |
{ |
475 |
{ "what-key", OP_WHAT_KEY, NULL }, |
670 |
--- 1119,1129 ---- |
476 |
|
671 |
{ |
|
|
672 |
mutt_buffy (buf, sizeof (buf)); |
673 |
|
674 |
! if ( op == OP_SIDEBAR_OPEN ) { |
675 |
! if(!CurBuffy) |
676 |
! break; |
677 |
! strncpy( buf, CurBuffy->path, sizeof(buf) ); |
678 |
! } else if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1) |
679 |
{ |
680 |
if (menu->menu == MENU_PAGER) |
681 |
{ |
682 |
*************** |
683 |
*** 1119,1124 **** |
684 |
--- 1141,1147 ---- |
685 |
} |
686 |
|
687 |
mutt_expand_path (buf, sizeof (buf)); |
688 |
+ set_curbuffy(buf); |
689 |
if (mx_get_magic (buf) <= 0) |
690 |
{ |
691 |
mutt_error (_("%s is not a mailbox."), buf); |
692 |
*************** |
693 |
*** 2209,2214 **** |
694 |
--- 2232,2243 ---- |
695 |
mutt_what_key(); |
696 |
break; |
697 |
|
698 |
+ case OP_SIDEBAR_SCROLL_UP: |
699 |
+ case OP_SIDEBAR_SCROLL_DOWN: |
700 |
+ case OP_SIDEBAR_NEXT: |
701 |
+ case OP_SIDEBAR_PREV: |
702 |
+ scroll_sidebar(op, menu->menu); |
703 |
+ break; |
704 |
default: |
705 |
if (menu->menu == MENU_MAIN) |
706 |
km_error_key (MENU_MAIN); |
707 |
*** mutt-1.5.23-orig/flags.c 2014-03-12 11:03:45.000000000 -0500 |
708 |
--- mutt-1.5.23/flags.c 2014-04-11 10:14:01.000000000 -0500 |
709 |
*************** |
710 |
*** 22,29 **** |
711 |
--- 22,31 ---- |
712 |
|
713 |
#include "mutt.h" |
714 |
#include "mutt_curses.h" |
715 |
+ #include "mutt_menu.h" |
716 |
#include "sort.h" |
717 |
#include "mx.h" |
718 |
+ #include "sidebar.h" |
719 |
|
720 |
void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx) |
721 |
{ |
722 |
*************** |
723 |
*** 263,268 **** |
724 |
--- 265,271 ---- |
725 |
*/ |
726 |
if (h->searched && (changed != h->changed || deleted != ctx->deleted || tagged != ctx->tagged || flagged != ctx->flagged)) |
727 |
h->searched = 0; |
728 |
+ draw_sidebar(0); |
729 |
} |
730 |
|
731 |
void mutt_tag_set_flag (int flag, int bf) |
732 |
*** mutt-1.5.23-orig/functions.h 2014-03-12 11:03:45.000000000 -0500 |
733 |
--- mutt-1.5.23/functions.h 2014-04-11 10:14:01.000000000 -0500 |
734 |
*************** |
735 |
*** 169,174 **** |
736 |
--- 169,179 ---- |
737 |
{ "decrypt-save", OP_DECRYPT_SAVE, NULL }, |
738 |
|
739 |
|
477 |
+ { "sidebar-scroll-up", OP_SIDEBAR_SCROLL_UP, NULL }, |
740 |
+ { "sidebar-scroll-up", OP_SIDEBAR_SCROLL_UP, NULL }, |
478 |
+ { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL }, |
741 |
+ { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL }, |
479 |
+ { "sidebar-next", OP_SIDEBAR_NEXT, NULL }, |
742 |
+ { "sidebar-next", OP_SIDEBAR_NEXT, NULL }, |
480 |
+ { "sidebar-prev", OP_SIDEBAR_PREV, NULL }, |
743 |
+ { "sidebar-prev", OP_SIDEBAR_PREV, NULL }, |
481 |
+ { "sidebar-open", OP_SIDEBAR_OPEN, NULL }, |
744 |
+ { "sidebar-open", OP_SIDEBAR_OPEN, NULL }, |
482 |
{ NULL, 0, NULL } |
745 |
{ NULL, 0, NULL } |
483 |
}; |
746 |
}; |
484 |
|
747 |
|
485 |
diff -uNp -r mutt-1.5.22.orig/globals.h mutt-1.5.22/globals.h |
748 |
*************** |
486 |
--- mutt-1.5.22.orig/globals.h Sat Dec 3 19:10:04 2011 |
749 |
*** 272,277 **** |
487 |
+++ mutt-1.5.22/globals.h Fri Oct 18 10:18:45 2013 |
750 |
--- 277,287 ---- |
488 |
@@ -117,6 +117,7 @@ WHERE short SearchContext; |
751 |
|
489 |
WHERE char *SendCharset; |
752 |
{ "what-key", OP_WHAT_KEY, NULL }, |
490 |
WHERE char *Sendmail; |
753 |
|
491 |
WHERE char *Shell; |
754 |
+ { "sidebar-scroll-up", OP_SIDEBAR_SCROLL_UP, NULL }, |
492 |
+WHERE char *SidebarDelim; |
755 |
+ { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL }, |
493 |
WHERE char *Signature; |
756 |
+ { "sidebar-next", OP_SIDEBAR_NEXT, NULL }, |
494 |
WHERE char *SimpleSearch; |
757 |
+ { "sidebar-prev", OP_SIDEBAR_PREV, NULL }, |
495 |
#if USE_SMTP |
758 |
+ { "sidebar-open", OP_SIDEBAR_OPEN, NULL }, |
496 |
@@ -208,6 +209,9 @@ WHERE short ScoreThresholdDelete; |
759 |
{ NULL, 0, NULL } |
497 |
WHERE short ScoreThresholdRead; |
760 |
}; |
498 |
WHERE short ScoreThresholdFlag; |
761 |
|
499 |
|
762 |
*** mutt-1.5.23-orig/globals.h 2014-03-12 11:06:17.000000000 -0500 |
500 |
+WHERE struct buffy_t *CurBuffy INITVAL(0); |
763 |
--- mutt-1.5.23/globals.h 2014-04-11 10:14:01.000000000 -0500 |
501 |
+WHERE short DrawFullLine INITVAL(0); |
764 |
*************** |
502 |
+WHERE short SidebarWidth; |
765 |
*** 117,122 **** |
503 |
#ifdef USE_IMAP |
766 |
--- 117,125 ---- |
504 |
WHERE short ImapKeepalive; |
767 |
WHERE char *SendCharset; |
505 |
WHERE short ImapPipelineDepth; |
768 |
WHERE char *Sendmail; |
506 |
diff -uNp -r mutt-1.5.22.orig/imap/command.c mutt-1.5.22/imap/command.c |
769 |
WHERE char *Shell; |
507 |
--- mutt-1.5.22.orig/imap/command.c Fri Oct 18 05:48:24 2013 |
770 |
+ WHERE char *SidebarDelim; |
508 |
+++ mutt-1.5.22/imap/command.c Fri Oct 18 10:18:45 2013 |
771 |
+ WHERE char *SidebarFormat; |
509 |
@@ -1012,6 +1012,13 @@ static void cmd_parse_status (IMAP_DATA* idata, char* |
772 |
+ WHERE char *SidebarIndentStr; |
510 |
opened */ |
773 |
WHERE char *Signature; |
511 |
status->uidnext = oldun; |
774 |
WHERE char *SimpleSearch; |
512 |
|
775 |
#if USE_SMTP |
513 |
+ /* Added to make the sidebar show the correct numbers */ |
776 |
*************** |
514 |
+ if (status->messages) |
777 |
*** 208,213 **** |
515 |
+ { |
778 |
--- 211,219 ---- |
516 |
+ inc->msgcount = status->messages; |
779 |
WHERE short ScoreThresholdRead; |
517 |
+ inc->msg_unread = status->unseen; |
780 |
WHERE short ScoreThresholdFlag; |
518 |
+ } |
781 |
|
519 |
+ |
782 |
+ WHERE struct buffy_t *CurBuffy INITVAL(0); |
520 |
FREE (&value); |
783 |
+ WHERE short DrawFullLine INITVAL(0); |
521 |
return; |
784 |
+ WHERE short SidebarWidth; |
522 |
} |
785 |
#ifdef USE_IMAP |
523 |
diff -uNp -r mutt-1.5.22.orig/imap/imap.c mutt-1.5.22/imap/imap.c |
786 |
WHERE short ImapKeepalive; |
524 |
--- mutt-1.5.22.orig/imap/imap.c Fri Oct 18 05:48:24 2013 |
787 |
WHERE short ImapPipelineDepth; |
525 |
+++ mutt-1.5.22/imap/imap.c Fri Oct 18 10:18:45 2013 |
788 |
*** mutt-1.5.23-orig/handler.c 2014-03-12 11:03:45.000000000 -0500 |
526 |
@@ -1514,7 +1514,7 @@ int imap_buffy_check (int force) |
789 |
--- mutt-1.5.23/handler.c 2014-04-11 10:14:01.000000000 -0500 |
527 |
|
790 |
*************** |
528 |
imap_munge_mbox_name (munged, sizeof (munged), name); |
791 |
*** 1599,1604 **** |
529 |
snprintf (command, sizeof (command), |
792 |
--- 1599,1609 ---- |
530 |
- "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT)", munged); |
793 |
size_t tmplength = 0; |
531 |
+ "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT MESSAGES)", munged); |
794 |
int rc = 0; |
532 |
|
795 |
|
533 |
if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0) |
796 |
+ #ifdef HAVE_FMEMOPEN |
534 |
{ |
797 |
+ char *temp; |
535 |
diff -uNp -r mutt-1.5.22.orig/init.h mutt-1.5.22/init.h |
798 |
+ size_t tempsize; |
536 |
--- mutt-1.5.22.orig/init.h Tue Jan 15 07:37:15 2013 |
799 |
+ #endif |
537 |
+++ mutt-1.5.22/init.h Fri Oct 18 10:18:45 2013 |
800 |
+ |
538 |
@@ -1966,6 +1966,27 @@ struct option_t MuttVars[] = { |
801 |
int oflags = s->flags; |
539 |
** not used. |
802 |
|
540 |
** (PGP only) |
803 |
/* first determine which handler to use to process this part */ |
|
|
804 |
*************** |
805 |
*** 1711,1716 **** |
806 |
--- 1716,1729 ---- |
807 |
{ |
808 |
/* decode to a tempfile, saving the original destination */ |
809 |
fp = s->fpout; |
810 |
+ #ifdef HAVE_FMEMOPEN |
811 |
+ if ((s->fpout = open_memstream(&temp, &tempsize)) == NULL) |
812 |
+ { |
813 |
+ mutt_error _("Unable to open memory stream!"); |
814 |
+ dprint (1, (debugfile, "Can't open memory stream.\n")); |
815 |
+ goto bail; |
816 |
+ } |
817 |
+ #else |
818 |
mutt_mktemp (tempfile, sizeof (tempfile)); |
819 |
if ((s->fpout = safe_fopen (tempfile, "w")) == NULL) |
820 |
{ |
821 |
*************** |
822 |
*** 1718,1723 **** |
823 |
--- 1731,1737 ---- |
824 |
dprint (1, (debugfile, "Can't open %s.\n", tempfile)); |
825 |
goto bail; |
826 |
} |
827 |
+ #endif |
828 |
/* decoding the attachment changes the size and offset, so save a copy |
829 |
* of the "real" values now, and restore them after processing |
830 |
*/ |
831 |
*************** |
832 |
*** 1746,1753 **** |
833 |
--- 1760,1778 ---- |
834 |
/* restore final destination and substitute the tempfile for input */ |
835 |
s->fpout = fp; |
836 |
fp = s->fpin; |
837 |
+ #ifdef HAVE_FMEMOPEN |
838 |
+ if(tempsize) |
839 |
+ s->fpin = fmemopen(temp, tempsize, "r"); |
840 |
+ else /* fmemopen cannot handle zero-length buffers */ |
841 |
+ s->fpin = safe_fopen ("/dev/null", "r"); |
842 |
+ if(s->fpin == NULL) { |
843 |
+ mutt_perror("failed to re-open memstream!"); |
844 |
+ return (-1); |
845 |
+ } |
846 |
+ #else |
847 |
s->fpin = fopen (tempfile, "r"); |
848 |
unlink (tempfile); |
849 |
+ #endif |
850 |
|
851 |
/* restore the prefix */ |
852 |
s->prefix = savePrefix; |
853 |
*************** |
854 |
*** 1773,1778 **** |
855 |
--- 1798,1807 ---- |
856 |
|
857 |
/* restore the original source stream */ |
858 |
safe_fclose (&s->fpin); |
859 |
+ #ifdef HAVE_FMEMOPEN |
860 |
+ if(tempsize) |
861 |
+ FREE(&temp); |
862 |
+ #endif |
863 |
s->fpin = fp; |
864 |
} |
865 |
} |
866 |
*** mutt-1.5.23-orig/init.h 2014-03-12 11:06:17.000000000 -0500 |
867 |
--- mutt-1.5.23/init.h 2014-04-11 10:14:01.000000000 -0500 |
868 |
*************** |
869 |
*** 1966,1971 **** |
870 |
--- 1966,2019 ---- |
871 |
** not used. |
872 |
** (PGP only) |
873 |
*/ |
874 |
+ {"sidebar_delim", DT_STR, R_BOTH, UL &SidebarDelim, UL "|"}, |
875 |
+ /* |
876 |
+ ** .pp |
877 |
+ ** This specifies the delimiter between the sidebar (if visible) and |
878 |
+ ** other screens. |
879 |
+ */ |
880 |
+ {"sidebar_indentstr", DT_STR, R_BOTH, UL &SidebarIndentStr, UL " "}, |
881 |
+ /* |
882 |
+ ** .pp |
883 |
+ ** This specifies the string that is used to indent items |
884 |
+ ** with sidebar_folderindent= yes |
885 |
+ */ |
886 |
+ { "sidebar_visible", DT_BOOL, R_BOTH, OPTSIDEBAR, 0 }, |
887 |
+ /* |
888 |
+ ** .pp |
889 |
+ ** This specifies whether or not to show sidebar (left-side list of folders). |
890 |
+ */ |
891 |
+ { "sidebar_sort", DT_BOOL, R_BOTH, OPTSIDEBARSORT, 0 }, |
892 |
+ /* |
893 |
+ ** .pp |
894 |
+ ** This specifies whether or not to sort the sidebar alphabetically. |
895 |
+ */ |
896 |
+ { "sidebar_width", DT_NUM, R_BOTH, UL &SidebarWidth, 0 }, |
897 |
+ /* |
898 |
+ ** .pp |
899 |
+ ** The width of the sidebar. |
900 |
+ */ |
901 |
+ { "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 1 }, |
902 |
+ /* |
903 |
+ ** .pp |
904 |
+ ** Should the sidebar shorten the path showed. |
905 |
+ */ |
906 |
+ {"sidebar_format", DT_STR, R_NONE, UL &SidebarFormat, UL "%B%?F? [%F]?%* %?N?%N/?%4S"}, |
907 |
+ /* |
908 |
+ ** .pp |
909 |
+ ** Format string for the sidebar. The sequences `%N', `%F' and `%S' |
910 |
+ ** will be replaced by the number of new or flagged messages or the total |
911 |
+ ** size of them mailbox. `%B' will be replaced with the name of the mailbox. |
912 |
+ ** The `%!' sequence will be expanded to `!' if there is one flagged message; |
913 |
+ ** to `!!' if there are two flagged messages; and to `n!' for n flagged |
914 |
+ ** messages, n>2. |
915 |
+ */ |
916 |
+ { "sidebar_folderindent", DT_BOOL, R_BOTH, OPTSIDEBARFOLDERINDENT, 0 }, |
917 |
+ /* |
918 |
+ ** .pp |
919 |
+ ** Should folders be indented in the sidebar. |
920 |
+ */ |
921 |
+ |
922 |
{ "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0}, |
923 |
/* |
924 |
** .pp |
925 |
*** mutt-1.5.23-orig/mailbox.h 2014-03-12 11:03:45.000000000 -0500 |
926 |
--- mutt-1.5.23/mailbox.h 2014-04-11 10:14:01.000000000 -0500 |
927 |
*************** |
928 |
*** 27,32 **** |
929 |
--- 27,33 ---- |
930 |
#define M_NEWFOLDER (1<<4) /* create a new folder - same as M_APPEND, but uses |
931 |
* safe_fopen() for mbox-style folders. |
932 |
*/ |
933 |
+ #define M_PEEK (1<<5) /* revert atime back after taking a look (if applicable) */ |
934 |
|
935 |
/* mx_open_new_message() */ |
936 |
#define M_ADD_FROM 1 /* add a From_ line */ |
937 |
*** mutt-1.5.23-orig/main.c 2014-03-12 11:06:17.000000000 -0500 |
938 |
--- mutt-1.5.23/main.c 2014-04-11 10:14:01.000000000 -0500 |
939 |
*************** |
940 |
*** 50,55 **** |
941 |
--- 50,56 ---- |
942 |
#include <unistd.h> |
943 |
#include <errno.h> |
944 |
#include <sys/stat.h> |
945 |
+ #include <limits.h> |
946 |
#include <sys/utsname.h> |
947 |
|
948 |
#ifdef HAVE_GETOPT_H |
949 |
*************** |
950 |
*** 555,561 **** |
951 |
|
952 |
int main (int argc, char **argv) |
953 |
{ |
954 |
! char folder[_POSIX_PATH_MAX] = ""; |
955 |
char *subject = NULL; |
956 |
char *includeFile = NULL; |
957 |
char *draftFile = NULL; |
958 |
--- 556,562 ---- |
959 |
|
960 |
int main (int argc, char **argv) |
961 |
{ |
962 |
! char folder[PATH_MAX] = ""; |
963 |
char *subject = NULL; |
964 |
char *includeFile = NULL; |
965 |
char *draftFile = NULL; |
966 |
*************** |
967 |
*** 1025,1030 **** |
968 |
--- 1026,1038 ---- |
969 |
strfcpy (folder, NONULL(Spoolfile), sizeof (folder)); |
970 |
mutt_expand_path (folder, sizeof (folder)); |
971 |
|
972 |
+ { |
973 |
+ char tmpfolder[PATH_MAX]; |
974 |
+ strfcpy (tmpfolder, folder, sizeof (tmpfolder)); |
975 |
+ if(!realpath(tmpfolder, folder)) |
976 |
+ strfcpy (folder, tmpfolder, sizeof (tmpfolder)); |
977 |
+ } |
978 |
+ |
979 |
mutt_str_replace (&CurrentFolder, folder); |
980 |
mutt_str_replace (&LastFolder, folder); |
981 |
|
982 |
*************** |
983 |
*** 1047,1052 **** |
984 |
--- 1055,1061 ---- |
985 |
if((Context = mx_open_mailbox (folder, ((flags & M_RO) || option (OPTREADONLY)) ? M_READONLY : 0, NULL)) |
986 |
|| !explicit_folder) |
987 |
{ |
988 |
+ set_curbuffy(folder); |
989 |
mutt_index_menu (); |
990 |
if (Context) |
991 |
FREE (&Context); |
992 |
*** mutt-1.5.23-orig/Makefile.am 2014-03-12 11:03:44.000000000 -0500 |
993 |
--- mutt-1.5.23/Makefile.am 2014-04-11 10:14:01.000000000 -0500 |
994 |
*************** |
995 |
*** 32,37 **** |
996 |
--- 32,38 ---- |
997 |
rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \ |
998 |
score.c send.c sendlib.c signal.c sort.c \ |
999 |
status.c system.c thread.c charset.c history.c lib.c \ |
1000 |
+ sidebar.c \ |
1001 |
muttlib.c editmsg.c mbyte.c \ |
1002 |
url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c |
1003 |
|
1004 |
*** mutt-1.5.23-orig/Makefile.in 2014-03-12 11:26:44.000000000 -0500 |
1005 |
--- mutt-1.5.23/Makefile.in 2014-04-12 12:12:38.000000000 -0500 |
1006 |
*************** |
1007 |
*** 129,135 **** |
1008 |
system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \ |
1009 |
history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \ |
1010 |
editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \ |
1011 |
! ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT) |
1012 |
am__objects_1 = |
1013 |
am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \ |
1014 |
$(am__objects_1) |
1015 |
--- 129,136 ---- |
1016 |
system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \ |
1017 |
history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \ |
1018 |
editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \ |
1019 |
! ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT) \ |
1020 |
! sidebar.$(OBJEXT) |
1021 |
am__objects_1 = |
1022 |
am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \ |
1023 |
$(am__objects_1) |
1024 |
*************** |
1025 |
*** 468,474 **** |
1026 |
score.c send.c sendlib.c signal.c sort.c \ |
1027 |
status.c system.c thread.c charset.c history.c lib.c \ |
1028 |
muttlib.c editmsg.c mbyte.c \ |
1029 |
! url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c |
1030 |
|
1031 |
nodist_mutt_SOURCES = $(BUILT_SOURCES) |
1032 |
mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \ |
1033 |
--- 469,476 ---- |
1034 |
score.c send.c sendlib.c signal.c sort.c \ |
1035 |
status.c system.c thread.c charset.c history.c lib.c \ |
1036 |
muttlib.c editmsg.c mbyte.c \ |
1037 |
! url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c \ |
1038 |
! sidebar.c |
1039 |
|
1040 |
nodist_mutt_SOURCES = $(BUILT_SOURCES) |
1041 |
mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \ |
1042 |
*************** |
1043 |
*** 500,506 **** |
1044 |
README.SSL smime.h group.h \ |
1045 |
muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \ |
1046 |
ChangeLog mkchangelog.sh mutt_idna.h \ |
1047 |
! snprintf.c regex.c crypt-gpgme.h hcachever.sh.in \ |
1048 |
txt2c.c txt2c.sh version.sh check_sec.sh |
1049 |
|
1050 |
EXTRA_SCRIPTS = smime_keys |
1051 |
--- 502,508 ---- |
1052 |
README.SSL smime.h group.h \ |
1053 |
muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \ |
1054 |
ChangeLog mkchangelog.sh mutt_idna.h \ |
1055 |
! snprintf.c regex.c crypt-gpgme.h sidebar.h hcachever.sh.in \ |
1056 |
txt2c.c txt2c.sh version.sh check_sec.sh |
1057 |
|
1058 |
EXTRA_SCRIPTS = smime_keys |
1059 |
*** mutt-1.5.23-orig/mbox.c 2014-03-12 11:03:45.000000000 -0500 |
1060 |
--- mutt-1.5.23/mbox.c 2014-04-11 10:14:01.000000000 -0500 |
1061 |
*************** |
1062 |
*** 100,105 **** |
1063 |
--- 100,106 ---- |
1064 |
mutt_perror (ctx->path); |
1065 |
return (-1); |
1066 |
} |
1067 |
+ ctx->atime = sb.st_atime; |
1068 |
ctx->mtime = sb.st_mtime; |
1069 |
ctx->size = sb.st_size; |
1070 |
|
1071 |
*************** |
1072 |
*** 251,256 **** |
1073 |
--- 252,258 ---- |
1074 |
|
1075 |
ctx->size = sb.st_size; |
1076 |
ctx->mtime = sb.st_mtime; |
1077 |
+ ctx->atime = sb.st_atime; |
1078 |
|
1079 |
#ifdef NFS_ATTRIBUTE_HACK |
1080 |
if (sb.st_mtime > sb.st_atime) |
1081 |
*** mutt-1.5.23-orig/menu.c 2014-03-12 11:03:45.000000000 -0500 |
1082 |
--- mutt-1.5.23/menu.c 2014-04-12 21:31:16.000000000 -0500 |
1083 |
*************** |
1084 |
*** 24,29 **** |
1085 |
--- 24,30 ---- |
1086 |
#include "mutt_curses.h" |
1087 |
#include "mutt_menu.h" |
1088 |
#include "mbyte.h" |
1089 |
+ #include "sidebar.h" |
1090 |
|
1091 |
extern size_t UngetCount; |
1092 |
|
1093 |
*************** |
1094 |
*** 186,192 **** |
1095 |
{ |
1096 |
char *scratch = safe_strdup (s); |
1097 |
int shift = option (OPTARROWCURSOR) ? 3 : 0; |
1098 |
! int cols = COLS - shift; |
1099 |
|
1100 |
mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1); |
1101 |
s[n - 1] = 0; |
1102 |
--- 187,193 ---- |
1103 |
{ |
1104 |
char *scratch = safe_strdup (s); |
1105 |
int shift = option (OPTARROWCURSOR) ? 3 : 0; |
1106 |
! int cols = COLS - shift - SidebarWidth; |
1107 |
|
1108 |
mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1); |
1109 |
s[n - 1] = 0; |
1110 |
*************** |
1111 |
*** 239,244 **** |
1112 |
--- 240,246 ---- |
1113 |
int do_color; |
1114 |
int attr; |
1115 |
|
1116 |
+ draw_sidebar(1); |
1117 |
for (i = menu->top; i < menu->top + menu->pagelen; i++) |
1118 |
{ |
1119 |
if (i < menu->max) |
1120 |
*************** |
1121 |
*** 249,255 **** |
1122 |
menu_pad_string (buf, sizeof (buf)); |
1123 |
|
1124 |
ATTRSET(attr); |
1125 |
! move(i - menu->top + menu->offset, 0); |
1126 |
do_color = 1; |
1127 |
|
1128 |
if (i == menu->current) |
1129 |
--- 251,257 ---- |
1130 |
menu_pad_string (buf, sizeof (buf)); |
1131 |
|
1132 |
ATTRSET(attr); |
1133 |
! move(i - menu->top + menu->offset, SidebarWidth); |
1134 |
do_color = 1; |
1135 |
|
1136 |
if (i == menu->current) |
1137 |
*************** |
1138 |
*** 272,278 **** |
1139 |
else |
1140 |
{ |
1141 |
NORMAL_COLOR; |
1142 |
! CLEARLINE(i - menu->top + menu->offset); |
1143 |
} |
1144 |
} |
1145 |
NORMAL_COLOR; |
1146 |
--- 274,280 ---- |
1147 |
else |
1148 |
{ |
1149 |
NORMAL_COLOR; |
1150 |
! CLEARLINE_WIN (i - menu->top + menu->offset); |
1151 |
} |
1152 |
} |
1153 |
NORMAL_COLOR; |
1154 |
*************** |
1155 |
*** 289,295 **** |
1156 |
return; |
1157 |
} |
1158 |
|
1159 |
! move (menu->oldcurrent + menu->offset - menu->top, 0); |
1160 |
ATTRSET(menu->color (menu->oldcurrent)); |
1161 |
|
1162 |
if (option (OPTARROWCURSOR)) |
1163 |
--- 291,297 ---- |
1164 |
return; |
1165 |
} |
1166 |
|
1167 |
! move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth); |
1168 |
ATTRSET(menu->color (menu->oldcurrent)); |
1169 |
|
1170 |
if (option (OPTARROWCURSOR)) |
1171 |
*************** |
1172 |
*** 301,313 **** |
1173 |
{ |
1174 |
menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent); |
1175 |
menu_pad_string (buf, sizeof (buf)); |
1176 |
! move (menu->oldcurrent + menu->offset - menu->top, 3); |
1177 |
print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1); |
1178 |
} |
1179 |
|
1180 |
/* now draw it in the new location */ |
1181 |
SETCOLOR(MT_COLOR_INDICATOR); |
1182 |
! mvaddstr(menu->current + menu->offset - menu->top, 0, "->"); |
1183 |
} |
1184 |
else |
1185 |
{ |
1186 |
--- 303,315 ---- |
1187 |
{ |
1188 |
menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent); |
1189 |
menu_pad_string (buf, sizeof (buf)); |
1190 |
! move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth + 3); |
1191 |
print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1); |
1192 |
} |
1193 |
|
1194 |
/* now draw it in the new location */ |
1195 |
SETCOLOR(MT_COLOR_INDICATOR); |
1196 |
! mvaddstr(menu->current + menu->offset - menu->top, SidebarWidth, "->"); |
1197 |
} |
1198 |
else |
1199 |
{ |
1200 |
*************** |
1201 |
*** 320,326 **** |
1202 |
menu_make_entry (buf, sizeof (buf), menu, menu->current); |
1203 |
menu_pad_string (buf, sizeof (buf)); |
1204 |
SETCOLOR(MT_COLOR_INDICATOR); |
1205 |
! move(menu->current - menu->top + menu->offset, 0); |
1206 |
print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0); |
1207 |
} |
1208 |
menu->redraw &= REDRAW_STATUS; |
1209 |
--- 322,328 ---- |
1210 |
menu_make_entry (buf, sizeof (buf), menu, menu->current); |
1211 |
menu_pad_string (buf, sizeof (buf)); |
1212 |
SETCOLOR(MT_COLOR_INDICATOR); |
1213 |
! move(menu->current - menu->top + menu->offset, SidebarWidth); |
1214 |
print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0); |
1215 |
} |
1216 |
menu->redraw &= REDRAW_STATUS; |
1217 |
*************** |
1218 |
*** 332,338 **** |
1219 |
char buf[LONG_STRING]; |
1220 |
int attr = menu->color (menu->current); |
1221 |
|
1222 |
! move (menu->current + menu->offset - menu->top, 0); |
1223 |
menu_make_entry (buf, sizeof (buf), menu, menu->current); |
1224 |
menu_pad_string (buf, sizeof (buf)); |
1225 |
|
1226 |
--- 334,340 ---- |
1227 |
char buf[LONG_STRING]; |
1228 |
int attr = menu->color (menu->current); |
1229 |
|
1230 |
! move (menu->current + menu->offset - menu->top, SidebarWidth); |
1231 |
menu_make_entry (buf, sizeof (buf), menu, menu->current); |
1232 |
menu_pad_string (buf, sizeof (buf)); |
1233 |
|
1234 |
*************** |
1235 |
*** 872,878 **** |
1236 |
|
1237 |
|
1238 |
if (option (OPTARROWCURSOR)) |
1239 |
! move (menu->current - menu->top + menu->offset, 2); |
1240 |
else if (option (OPTBRAILLEFRIENDLY)) |
1241 |
move (menu->current - menu->top + menu->offset, 0); |
1242 |
else |
1243 |
--- 874,880 ---- |
1244 |
|
1245 |
|
1246 |
if (option (OPTARROWCURSOR)) |
1247 |
! move (menu->current - menu->top + menu->offset, SidebarWidth + 2); |
1248 |
else if (option (OPTBRAILLEFRIENDLY)) |
1249 |
move (menu->current - menu->top + menu->offset, 0); |
1250 |
else |
1251 |
*** mutt-1.5.23-orig/mh.c 2014-03-12 11:03:45.000000000 -0500 |
1252 |
--- mutt-1.5.23/mh.c 2014-04-11 11:04:59.000000000 -0500 |
1253 |
*************** |
1254 |
*** 295,300 **** |
1255 |
--- 295,326 ---- |
1256 |
mhs_free_sequences (&mhs); |
1257 |
} |
1258 |
|
1259 |
+ void mh_buffy_update (const char *path, int *msgcount, int *msg_unread, int *msg_flagged, time_t *sb_last_checked) |
1260 |
+ { |
1261 |
+ int i; |
1262 |
+ struct mh_sequences mhs; |
1263 |
+ memset (&mhs, 0, sizeof (mhs)); |
1264 |
+ |
1265 |
+ if(!option(OPTSIDEBAR)) |
1266 |
+ return; |
1267 |
+ |
1268 |
+ if (mh_read_sequences (&mhs, path) < 0) |
1269 |
+ return; |
1270 |
+ |
1271 |
+ msgcount = 0; |
1272 |
+ msg_unread = 0; |
1273 |
+ msg_flagged = 0; |
1274 |
+ for (i = 0; i <= mhs.max; i++) |
1275 |
+ msgcount++; |
1276 |
+ if (mhs_check (&mhs, i) & MH_SEQ_UNSEEN) { |
1277 |
+ msg_unread++; |
1278 |
+ } |
1279 |
+ if (mhs_check (&mhs, i) & MH_SEQ_FLAGGED) |
1280 |
+ msg_flagged++; |
1281 |
+ mhs_free_sequences (&mhs); |
1282 |
+ *sb_last_checked = time(NULL); |
1283 |
+ } |
1284 |
+ |
1285 |
static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt) |
1286 |
{ |
1287 |
int fd; |
1288 |
*** mutt-1.5.23-orig/mutt_curses.h 2014-03-12 11:03:45.000000000 -0500 |
1289 |
--- mutt-1.5.23/mutt_curses.h 2014-04-11 10:14:01.000000000 -0500 |
1290 |
*************** |
1291 |
*** 64,69 **** |
1292 |
--- 64,70 ---- |
1293 |
#undef lines |
1294 |
#endif /* lines */ |
1295 |
|
1296 |
+ #define CLEARLINE_WIN(x) move(x,SidebarWidth), clrtoeol() |
1297 |
#define CLEARLINE(x) move(x,0), clrtoeol() |
1298 |
#define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x) |
1299 |
#define BEEP() do { if (option (OPTBEEP)) beep(); } while (0) |
1300 |
*************** |
1301 |
*** 120,125 **** |
1302 |
--- 121,128 ---- |
1303 |
MT_COLOR_BOLD, |
1304 |
MT_COLOR_UNDERLINE, |
1305 |
MT_COLOR_INDEX, |
1306 |
+ MT_COLOR_NEW, |
1307 |
+ MT_COLOR_FLAGGED, |
1308 |
MT_COLOR_MAX |
1309 |
}; |
1310 |
|
1311 |
*** mutt-1.5.23-orig/mutt_menu.h 2014-03-12 11:06:17.000000000 -0500 |
1312 |
--- mutt-1.5.23/mutt_menu.h 2014-04-11 10:14:01.000000000 -0500 |
1313 |
*************** |
1314 |
*** 34,39 **** |
1315 |
--- 34,40 ---- |
1316 |
#define REDRAW_FULL (1<<5) |
1317 |
#define REDRAW_BODY (1<<6) |
1318 |
#define REDRAW_SIGWINCH (1<<7) |
1319 |
+ #define REDRAW_SIDEBAR (1<<8) |
1320 |
|
1321 |
#define M_MODEFMT "-- Mutt: %s" |
1322 |
|
1323 |
*** mutt-1.5.23-orig/mutt.h 2014-03-12 11:06:17.000000000 -0500 |
1324 |
--- mutt-1.5.23/mutt.h 2014-04-11 10:14:01.000000000 -0500 |
1325 |
*************** |
1326 |
*** 421,426 **** |
1327 |
--- 421,430 ---- |
1328 |
OPTSAVEEMPTY, |
1329 |
OPTSAVENAME, |
1330 |
OPTSCORE, |
1331 |
+ OPTSIDEBAR, |
1332 |
+ OPTSIDEBARSHORTPATH, |
1333 |
+ OPTSIDEBARSORT, |
1334 |
+ OPTSIDEBARFOLDERINDENT, |
1335 |
OPTSIGDASHES, |
1336 |
OPTSIGONTOP, |
1337 |
OPTSORTRE, |
1338 |
*************** |
1339 |
*** 861,866 **** |
1340 |
--- 865,871 ---- |
1341 |
{ |
1342 |
char *path; |
1343 |
FILE *fp; |
1344 |
+ time_t atime; |
1345 |
time_t mtime; |
1346 |
off_t size; |
1347 |
off_t vsize; |
1348 |
*************** |
1349 |
*** 895,900 **** |
1350 |
--- 900,906 ---- |
1351 |
unsigned int quiet : 1; /* inhibit status messages? */ |
1352 |
unsigned int collapsed : 1; /* are all threads collapsed? */ |
1353 |
unsigned int closing : 1; /* mailbox is being closed */ |
1354 |
+ unsigned int peekonly : 1; /* just taking a glance, revert atime */ |
1355 |
|
1356 |
/* driver hooks */ |
1357 |
void *data; /* driver specific data */ |
1358 |
*** mutt-1.5.23-orig/muttlib.c 2014-03-12 11:03:45.000000000 -0500 |
1359 |
--- mutt-1.5.23/muttlib.c 2014-04-11 10:14:01.000000000 -0500 |
1360 |
*************** |
1361 |
*** 1281,1286 **** |
1362 |
--- 1281,1288 ---- |
1363 |
pl = pw = 1; |
1364 |
|
1365 |
/* see if there's room to add content, else ignore */ |
1366 |
+ if ( DrawFullLine ) |
1367 |
+ { |
1368 |
if ((col < COLS && wlen < destlen) || soft) |
1369 |
{ |
1370 |
int pad; |
1371 |
*************** |
1372 |
*** 1324,1329 **** |
1373 |
--- 1326,1377 ---- |
1374 |
col += wid; |
1375 |
src += pl; |
1376 |
} |
1377 |
+ } |
1378 |
+ else |
1379 |
+ { |
1380 |
+ if ((col < COLS-SidebarWidth && wlen < destlen) || soft) |
1381 |
+ { |
1382 |
+ int pad; |
1383 |
+ |
1384 |
+ /* get contents after padding */ |
1385 |
+ mutt_FormatString (buf, sizeof (buf), 0, src + pl, callback, data, flags); |
1386 |
+ len = mutt_strlen (buf); |
1387 |
+ wid = mutt_strwidth (buf); |
1388 |
+ |
1389 |
+ /* try to consume as many columns as we can, if we don't have |
1390 |
+ * memory for that, use as much memory as possible */ |
1391 |
+ pad = (COLS - SidebarWidth - col - wid) / pw; |
1392 |
+ if (pad > 0 && wlen + (pad * pl) + len > destlen) |
1393 |
+ pad = ((signed)(destlen - wlen - len)) / pl; |
1394 |
+ if (pad > 0) |
1395 |
+ { |
1396 |
+ while (pad--) |
1397 |
+ { |
1398 |
+ memcpy (wptr, src, pl); |
1399 |
+ wptr += pl; |
1400 |
+ wlen += pl; |
1401 |
+ col += pw; |
1402 |
+ } |
1403 |
+ } |
1404 |
+ else if (soft && pad < 0) |
1405 |
+ { |
1406 |
+ /* \0-terminate dest for length computation in mutt_wstr_trunc() */ |
1407 |
+ *wptr = 0; |
1408 |
+ /* make sure right part is at most as wide as display */ |
1409 |
+ len = mutt_wstr_trunc (buf, destlen, COLS, &wid); |
1410 |
+ /* truncate left so that right part fits completely in */ |
1411 |
+ wlen = mutt_wstr_trunc (dest, destlen - len, col + pad, &col); |
1412 |
+ wptr = dest + wlen; |
1413 |
+ } |
1414 |
+ if (len + wlen > destlen) |
1415 |
+ len = mutt_wstr_trunc (buf, destlen - wlen, COLS - SidebarWidth - col, NULL); |
1416 |
+ memcpy (wptr, buf, len); |
1417 |
+ wptr += len; |
1418 |
+ wlen += len; |
1419 |
+ col += wid; |
1420 |
+ src += pl; |
1421 |
+ } |
1422 |
+ } |
1423 |
break; /* skip rest of input */ |
1424 |
} |
1425 |
else if (ch == '|') |
1426 |
*** mutt-1.5.23-orig/mx.c 2014-03-12 11:03:45.000000000 -0500 |
1427 |
--- mutt-1.5.23/mx.c 2014-04-11 10:14:01.000000000 -0500 |
1428 |
*************** |
1429 |
*** 580,585 **** |
1430 |
--- 580,586 ---- |
1431 |
* M_APPEND open mailbox for appending |
1432 |
* M_READONLY open mailbox in read-only mode |
1433 |
* M_QUIET only print error messages |
1434 |
+ * M_PEEK revert atime where applicable |
1435 |
* ctx if non-null, context struct to use |
541 |
*/ |
1436 |
*/ |
542 |
+ {"sidebar_delim", DT_STR, R_BOTH, UL &SidebarDelim, "|"}, |
1437 |
CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT *pctx) |
543 |
+ /* |
1438 |
*************** |
544 |
+ ** .pp |
1439 |
*** 602,607 **** |
545 |
+ ** This specifies the delimiter between the sidebar (if visible) and |
1440 |
--- 603,610 ---- |
546 |
+ ** other screens. |
1441 |
ctx->quiet = 1; |
547 |
+ */ |
1442 |
if (flags & M_READONLY) |
548 |
+ { "sidebar_visible", DT_BOOL, R_BOTH, OPTSIDEBAR, 0 }, |
1443 |
ctx->readonly = 1; |
549 |
+ /* |
1444 |
+ if (flags & M_PEEK) |
550 |
+ ** .pp |
1445 |
+ ctx->peekonly = 1; |
551 |
+ ** This specifies whether or not to show sidebar (left-side list of folders). |
1446 |
|
552 |
+ */ |
1447 |
if (flags & (M_APPEND|M_NEWFOLDER)) |
553 |
+ { "sidebar_sort", DT_BOOL, R_BOTH, OPTSIDEBARSORT, 0 }, |
1448 |
{ |
554 |
+ /* |
1449 |
*************** |
555 |
+ ** .pp |
1450 |
*** 701,713 **** |
556 |
+ ** This specifies whether or not to sort the sidebar alphabetically. |
1451 |
void mx_fastclose_mailbox (CONTEXT *ctx) |
557 |
+ */ |
1452 |
{ |
558 |
+ { "sidebar_width", DT_NUM, R_BOTH, UL &SidebarWidth, 0 }, |
1453 |
int i; |
559 |
+ /* |
1454 |
|
560 |
+ ** .pp |
1455 |
if(!ctx) |
561 |
+ ** The width of the sidebar. |
1456 |
return; |
562 |
+ */ |
1457 |
|
563 |
{ "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0}, |
1458 |
/* never announce that a mailbox we've just left has new mail. #3290 |
564 |
/* |
1459 |
* XXX: really belongs in mx_close_mailbox, but this is a nice hook point */ |
565 |
** .pp |
1460 |
! mutt_buffy_setnotified(ctx->path); |
566 |
diff -uNp -r mutt-1.5.22.orig/mailbox.h mutt-1.5.22/mailbox.h |
1461 |
|
567 |
--- mutt-1.5.22.orig/mailbox.h Sun Feb 21 22:10:41 2010 |
1462 |
if (ctx->mx_close) |
568 |
+++ mutt-1.5.22/mailbox.h Fri Oct 18 10:18:45 2013 |
1463 |
ctx->mx_close (ctx); |
569 |
@@ -27,6 +27,7 @@ |
1464 |
--- 704,729 ---- |
570 |
#define M_NEWFOLDER (1<<4) /* create a new folder - same as M_APPEND, but uses |
1465 |
void mx_fastclose_mailbox (CONTEXT *ctx) |
571 |
* safe_fopen() for mbox-style folders. |
1466 |
{ |
572 |
*/ |
1467 |
int i; |
573 |
+#define M_PEEK (1<<5) /* revert atime back after taking a look (if applicable) */ |
1468 |
+ #ifndef BUFFY_SIZE |
574 |
|
1469 |
+ struct utimbuf ut; |
575 |
/* mx_open_new_message() */ |
1470 |
+ #endif |
576 |
#define M_ADD_FROM 1 /* add a From_ line */ |
1471 |
|
577 |
diff -uNp -r mutt-1.5.22.orig/mbox.c mutt-1.5.22/mbox.c |
1472 |
if(!ctx) |
578 |
--- mutt-1.5.22.orig/mbox.c Fri Oct 18 05:48:24 2013 |
1473 |
return; |
579 |
+++ mutt-1.5.22/mbox.c Fri Oct 18 10:18:45 2013 |
1474 |
+ #ifndef BUFFY_SIZE |
580 |
@@ -100,6 +100,7 @@ int mmdf_parse_mailbox (CONTEXT *ctx) |
1475 |
+ /* fix up the times so buffy won't get confused */ |
581 |
mutt_perror (ctx->path); |
1476 |
+ if (ctx->peekonly && ctx->path && ctx->mtime > ctx->atime) |
582 |
return (-1); |
1477 |
+ { |
583 |
} |
1478 |
+ ut.actime = ctx->atime; |
584 |
+ ctx->atime = sb.st_atime; |
1479 |
+ ut.modtime = ctx->mtime; |
585 |
ctx->mtime = sb.st_mtime; |
1480 |
+ utime (ctx->path, &ut); |
586 |
ctx->size = sb.st_size; |
1481 |
+ } |
587 |
|
1482 |
+ #endif |
588 |
@@ -251,6 +252,7 @@ int mbox_parse_mailbox (CONTEXT *ctx) |
1483 |
|
589 |
|
1484 |
/* never announce that a mailbox we've just left has new mail. #3290 |
590 |
ctx->size = sb.st_size; |
1485 |
* XXX: really belongs in mx_close_mailbox, but this is a nice hook point */ |
591 |
ctx->mtime = sb.st_mtime; |
1486 |
! if(!ctx->peekonly) |
592 |
+ ctx->atime = sb.st_atime; |
1487 |
! mutt_buffy_setnotified(ctx->path); |
593 |
|
1488 |
|
594 |
#ifdef NFS_ATTRIBUTE_HACK |
1489 |
if (ctx->mx_close) |
595 |
if (sb.st_mtime > sb.st_atime) |
1490 |
ctx->mx_close (ctx); |
596 |
diff -uNp -r mutt-1.5.22.orig/menu.c mutt-1.5.22/menu.c |
1491 |
*************** |
597 |
--- mutt-1.5.22.orig/menu.c Tue Jan 15 07:37:15 2013 |
1492 |
*** 719,724 **** |
598 |
+++ mutt-1.5.22/menu.c Fri Oct 18 10:18:45 2013 |
1493 |
--- 735,742 ---- |
599 |
@@ -24,6 +24,7 @@ |
1494 |
mutt_clear_threads (ctx); |
600 |
#include "mutt_curses.h" |
1495 |
for (i = 0; i < ctx->msgcount; i++) |
601 |
#include "mutt_menu.h" |
1496 |
mutt_free_header (&ctx->hdrs[i]); |
602 |
#include "mbyte.h" |
1497 |
+ ctx->msgcount -= ctx->deleted; |
603 |
+#include "sidebar.h" |
1498 |
+ set_buffystats(ctx); |
604 |
|
1499 |
FREE (&ctx->hdrs); |
605 |
extern size_t UngetCount; |
1500 |
FREE (&ctx->v2r); |
606 |
|
1501 |
FREE (&ctx->path); |
607 |
@@ -186,7 +187,7 @@ static void menu_pad_string (char *s, size_t n) |
1502 |
*************** |
608 |
{ |
1503 |
*** 812,817 **** |
609 |
char *scratch = safe_strdup (s); |
1504 |
--- 830,839 ---- |
610 |
int shift = option (OPTARROWCURSOR) ? 3 : 0; |
1505 |
if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->read |
611 |
- int cols = COLS - shift; |
1506 |
&& !(ctx->hdrs[i]->flagged && option (OPTKEEPFLAGGED))) |
612 |
+ int cols = COLS - shift - SidebarWidth; |
1507 |
read_msgs++; |
613 |
|
1508 |
+ if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->read) |
614 |
mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1); |
1509 |
+ ctx->unread--; |
615 |
s[n - 1] = 0; |
1510 |
+ if (ctx->hdrs[i]->deleted && ctx->hdrs[i]->flagged) |
616 |
@@ -239,6 +240,7 @@ void menu_redraw_index (MUTTMENU *menu) |
1511 |
+ ctx->flagged--; |
617 |
int do_color; |
1512 |
} |
618 |
int attr; |
1513 |
|
619 |
|
1514 |
if (read_msgs && quadoption (OPT_MOVE) != M_NO) |
620 |
+ draw_sidebar(1); |
1515 |
*** mutt-1.5.23-orig/mx.h 2014-03-12 11:03:45.000000000 -0500 |
621 |
for (i = menu->top; i < menu->top + menu->pagelen; i++) |
1516 |
--- mutt-1.5.23/mx.h 2014-04-11 11:11:47.000000000 -0500 |
622 |
{ |
1517 |
*************** |
623 |
if (i < menu->max) |
1518 |
*** 57,62 **** |
624 |
@@ -249,7 +251,7 @@ void menu_redraw_index (MUTTMENU *menu) |
1519 |
--- 57,63 ---- |
625 |
menu_pad_string (buf, sizeof (buf)); |
1520 |
int mh_read_dir (CONTEXT *, const char *); |
626 |
|
1521 |
int mh_sync_mailbox (CONTEXT *, int *); |
627 |
ATTRSET(attr); |
1522 |
int mh_check_mailbox (CONTEXT *, int *); |
628 |
- move(i - menu->top + menu->offset, 0); |
1523 |
+ void mh_buffy_update (const char *, int *, int *, int *, time_t *); |
629 |
+ move(i - menu->top + menu->offset, SidebarWidth); |
1524 |
int mh_check_empty (const char *); |
630 |
do_color = 1; |
1525 |
|
631 |
|
1526 |
int maildir_read_dir (CONTEXT *); |
632 |
if (i == menu->current) |
1527 |
*** mutt-1.5.23-orig/OPS 2014-03-12 11:03:44.000000000 -0500 |
633 |
@@ -272,7 +274,7 @@ void menu_redraw_index (MUTTMENU *menu) |
1528 |
--- mutt-1.5.23/OPS 2014-04-11 10:14:01.000000000 -0500 |
634 |
else |
1529 |
*************** |
635 |
{ |
1530 |
*** 179,181 **** |
636 |
NORMAL_COLOR; |
1531 |
--- 179,186 ---- |
637 |
- CLEARLINE(i - menu->top + menu->offset); |
1532 |
OP_MAIN_SHOW_LIMIT "show currently active limit pattern" |
638 |
+ CLEARLINE_WIN(i - menu->top + menu->offset); |
1533 |
OP_MAIN_COLLAPSE_THREAD "collapse/uncollapse current thread" |
639 |
} |
1534 |
OP_MAIN_COLLAPSE_ALL "collapse/uncollapse all threads" |
640 |
} |
1535 |
+ OP_SIDEBAR_SCROLL_UP "scroll the mailbox pane up 1 page" |
641 |
NORMAL_COLOR; |
1536 |
+ OP_SIDEBAR_SCROLL_DOWN "scroll the mailbox pane down 1 page" |
642 |
@@ -289,7 +291,7 @@ void menu_redraw_motion (MUTTMENU *menu) |
1537 |
+ OP_SIDEBAR_NEXT "go down to next mailbox" |
643 |
return; |
1538 |
+ OP_SIDEBAR_PREV "go to previous mailbox" |
644 |
} |
1539 |
+ OP_SIDEBAR_OPEN "open hilighted mailbox" |
|
|
1540 |
*** mutt-1.5.23-orig/pager.c 2014-03-12 11:06:17.000000000 -0500 |
1541 |
--- mutt-1.5.23/pager.c 2014-04-12 21:53:15.000000000 -0500 |
1542 |
*************** |
1543 |
*** 29,34 **** |
1544 |
--- 29,35 ---- |
1545 |
#include "pager.h" |
1546 |
#include "attach.h" |
1547 |
#include "mbyte.h" |
1548 |
+ #include "sidebar.h" |
1549 |
|
1550 |
#include "mutt_crypt.h" |
1551 |
|
1552 |
*************** |
1553 |
*** 1095,1100 **** |
1554 |
--- 1096,1102 ---- |
1555 |
wchar_t wc; |
1556 |
mbstate_t mbstate; |
1557 |
int wrap_cols = mutt_term_width ((flags & M_PAGER_NOWRAP) ? 0 : Wrap); |
1558 |
+ wrap_cols -= SidebarWidth; |
1559 |
|
1560 |
if (check_attachment_marker ((char *)buf) == 0) |
1561 |
wrap_cols = COLS; |
1562 |
*************** |
1563 |
*** 1572,1577 **** |
1564 |
--- 1574,1580 ---- |
1565 |
|
1566 |
int bodyoffset = 1; /* offset of first line of real text */ |
1567 |
int statusoffset = 0; /* offset for the status bar */ |
1568 |
+ int statuswidth; |
1569 |
int helpoffset = LINES - 2; /* offset for the help bar. */ |
1570 |
int bodylen = LINES - 2 - bodyoffset; /* length of displayable area */ |
1571 |
|
1572 |
*************** |
1573 |
*** 1746,1752 **** |
1574 |
if ((redraw & REDRAW_BODY) || topline != oldtopline) |
1575 |
{ |
1576 |
do { |
1577 |
! move (bodyoffset, 0); |
1578 |
curline = oldtopline = topline; |
1579 |
lines = 0; |
1580 |
force_redraw = 0; |
1581 |
--- 1749,1755 ---- |
1582 |
if ((redraw & REDRAW_BODY) || topline != oldtopline) |
1583 |
{ |
1584 |
do { |
1585 |
! move (bodyoffset, SidebarWidth); |
1586 |
curline = oldtopline = topline; |
1587 |
lines = 0; |
1588 |
force_redraw = 0; |
1589 |
*************** |
1590 |
*** 1759,1764 **** |
1591 |
--- 1762,1768 ---- |
1592 |
&QuoteList, &q_level, &force_redraw, &SearchRE) > 0) |
1593 |
lines++; |
1594 |
curline++; |
1595 |
+ move(lines + bodyoffset, SidebarWidth); |
1596 |
} |
1597 |
last_offset = lineInfo[curline].offset; |
1598 |
} while (force_redraw); |
1599 |
*************** |
1600 |
*** 1771,1776 **** |
1601 |
--- 1775,1781 ---- |
1602 |
addch ('~'); |
1603 |
addch ('\n'); |
1604 |
lines++; |
1605 |
+ move(lines + bodyoffset, SidebarWidth); |
1606 |
} |
1607 |
NORMAL_COLOR; |
1608 |
|
1609 |
*************** |
1610 |
*** 1788,1816 **** |
1611 |
hfi.ctx = Context; |
1612 |
hfi.pager_progress = pager_progress_str; |
1613 |
|
1614 |
if (last_pos < sb.st_size - 1) |
1615 |
snprintf(pager_progress_str, sizeof(pager_progress_str), OFF_T_FMT "%%", (100 * last_offset / sb.st_size)); |
1616 |
else |
1617 |
strfcpy(pager_progress_str, (topline == 0) ? "all" : "end", sizeof(pager_progress_str)); |
1618 |
|
1619 |
/* print out the pager status bar */ |
1620 |
! move (statusoffset, 0); |
1621 |
SETCOLOR (MT_COLOR_STATUS); |
1622 |
|
1623 |
if (IsHeader (extra) || IsMsgAttach (extra)) |
1624 |
{ |
1625 |
! size_t l1 = COLS * MB_LEN_MAX; |
1626 |
size_t l2 = sizeof (buffer); |
1627 |
hfi.hdr = (IsHeader (extra)) ? extra->hdr : extra->bdy->hdr; |
1628 |
mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), &hfi, M_FORMAT_MAKEPRINT); |
1629 |
! mutt_paddstr (COLS, buffer); |
1630 |
} |
1631 |
else |
1632 |
{ |
1633 |
char bn[STRING]; |
1634 |
snprintf (bn, sizeof (bn), "%s (%s)", banner, pager_progress_str); |
1635 |
! mutt_paddstr (COLS, bn); |
1636 |
} |
1637 |
NORMAL_COLOR; |
1638 |
} |
1639 |
|
1640 |
--- 1793,1831 ---- |
1641 |
hfi.ctx = Context; |
1642 |
hfi.pager_progress = pager_progress_str; |
1643 |
|
1644 |
+ statuswidth = COLS - (option(OPTSTATUSONTOP) && PagerIndexLines > 0 ? SidebarWidth : 0); |
1645 |
+ |
1646 |
if (last_pos < sb.st_size - 1) |
1647 |
snprintf(pager_progress_str, sizeof(pager_progress_str), OFF_T_FMT "%%", (100 * last_offset / sb.st_size)); |
1648 |
else |
1649 |
strfcpy(pager_progress_str, (topline == 0) ? "all" : "end", sizeof(pager_progress_str)); |
1650 |
|
1651 |
/* print out the pager status bar */ |
1652 |
! move (statusoffset, SidebarWidth); |
1653 |
SETCOLOR (MT_COLOR_STATUS); |
1654 |
+ if(option(OPTSTATUSONTOP) && PagerIndexLines > 0) { |
1655 |
+ CLEARLINE_WIN (statusoffset); |
1656 |
+ } else { |
1657 |
+ CLEARLINE (statusoffset); |
1658 |
+ DrawFullLine = 1; /* for mutt_make_string_info */ |
1659 |
+ } |
1660 |
|
1661 |
if (IsHeader (extra) || IsMsgAttach (extra)) |
1662 |
{ |
1663 |
! size_t l1 = statuswidth * MB_LEN_MAX; |
1664 |
size_t l2 = sizeof (buffer); |
1665 |
hfi.hdr = (IsHeader (extra)) ? extra->hdr : extra->bdy->hdr; |
1666 |
mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), &hfi, M_FORMAT_MAKEPRINT); |
1667 |
! mutt_paddstr (statuswidth, buffer); |
1668 |
} |
1669 |
else |
1670 |
{ |
1671 |
char bn[STRING]; |
1672 |
snprintf (bn, sizeof (bn), "%s (%s)", banner, pager_progress_str); |
1673 |
! mutt_paddstr (statuswidth, bn); |
1674 |
} |
1675 |
+ if(!option(OPTSTATUSONTOP) || PagerIndexLines == 0) |
1676 |
+ DrawFullLine = 0; /* reset */ |
1677 |
NORMAL_COLOR; |
1678 |
} |
1679 |
|
1680 |
*************** |
1681 |
*** 1819,1834 **** |
1682 |
/* redraw the pager_index indicator, because the |
1683 |
* flags for this message might have changed. */ |
1684 |
menu_redraw_current (index); |
1685 |
|
1686 |
/* print out the index status bar */ |
1687 |
menu_status_line (buffer, sizeof (buffer), index, NONULL(Status)); |
645 |
|
1688 |
|
646 |
- move (menu->oldcurrent + menu->offset - menu->top, 0); |
1689 |
! move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), 0); |
647 |
+ move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth); |
1690 |
SETCOLOR (MT_COLOR_STATUS); |
648 |
ATTRSET(menu->color (menu->oldcurrent)); |
1691 |
! mutt_paddstr (COLS, buffer); |
649 |
|
1692 |
NORMAL_COLOR; |
650 |
if (option (OPTARROWCURSOR)) |
1693 |
} |
651 |
@@ -301,13 +303,13 @@ void menu_redraw_motion (MUTTMENU *menu) |
1694 |
|
652 |
{ |
1695 |
redraw = 0; |
653 |
menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent); |
1696 |
|
654 |
menu_pad_string (buf, sizeof (buf)); |
1697 |
if (option(OPTBRAILLEFRIENDLY)) { |
655 |
- move (menu->oldcurrent + menu->offset - menu->top, 3); |
1698 |
--- 1834,1855 ---- |
656 |
+ move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth + 3); |
1699 |
/* redraw the pager_index indicator, because the |
657 |
print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1); |
1700 |
* flags for this message might have changed. */ |
658 |
} |
1701 |
menu_redraw_current (index); |
659 |
|
1702 |
+ draw_sidebar(MENU_PAGER); |
660 |
/* now draw it in the new location */ |
1703 |
|
661 |
SETCOLOR(MT_COLOR_INDICATOR); |
1704 |
/* print out the index status bar */ |
662 |
- mvaddstr(menu->current + menu->offset - menu->top, 0, "->"); |
1705 |
menu_status_line (buffer, sizeof (buffer), index, NONULL(Status)); |
663 |
+ mvaddstr(menu->current + menu->offset - menu->top, SidebarWidth, "->"); |
|
|
664 |
} |
665 |
else |
666 |
{ |
667 |
@@ -320,7 +322,7 @@ void menu_redraw_motion (MUTTMENU *menu) |
668 |
menu_make_entry (buf, sizeof (buf), menu, menu->current); |
669 |
menu_pad_string (buf, sizeof (buf)); |
670 |
SETCOLOR(MT_COLOR_INDICATOR); |
671 |
- move(menu->current - menu->top + menu->offset, 0); |
672 |
+ move(menu->current - menu->top + menu->offset, SidebarWidth); |
673 |
print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0); |
674 |
} |
675 |
menu->redraw &= REDRAW_STATUS; |
676 |
@@ -332,7 +334,7 @@ void menu_redraw_current (MUTTMENU *menu) |
677 |
char buf[LONG_STRING]; |
678 |
int attr = menu->color (menu->current); |
679 |
|
1706 |
|
680 |
- move (menu->current + menu->offset - menu->top, 0); |
1707 |
! move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), |
681 |
+ move (menu->current + menu->offset - menu->top, SidebarWidth); |
1708 |
! (option(OPTSTATUSONTOP) ? 0: SidebarWidth)); |
682 |
menu_make_entry (buf, sizeof (buf), menu, menu->current); |
1709 |
SETCOLOR (MT_COLOR_STATUS); |
683 |
menu_pad_string (buf, sizeof (buf)); |
1710 |
! mutt_paddstr (COLS - (option(OPTSTATUSONTOP) ? 0 : SidebarWidth), buffer); |
684 |
|
1711 |
NORMAL_COLOR; |
685 |
@@ -872,7 +874,7 @@ int mutt_menuLoop (MUTTMENU *menu) |
1712 |
} |
686 |
|
1713 |
|
687 |
|
1714 |
+ /* if we're not using the index, update every time */ |
688 |
if (option (OPTARROWCURSOR)) |
1715 |
+ if ( index == 0 ) |
689 |
- move (menu->current - menu->top + menu->offset, 2); |
1716 |
+ draw_sidebar(MENU_PAGER); |
690 |
+ move (menu->current - menu->top + menu->offset, SidebarWidth + 2); |
1717 |
+ |
691 |
else if (option (OPTBRAILLEFRIENDLY)) |
1718 |
redraw = 0; |
692 |
move (menu->current - menu->top + menu->offset, 0); |
1719 |
|
693 |
else |
1720 |
if (option(OPTBRAILLEFRIENDLY)) { |
694 |
diff -uNp -r mutt-1.5.22.orig/mh.c mutt-1.5.22/mh.c |
1721 |
*************** |
695 |
--- mutt-1.5.22.orig/mh.c Mon Apr 22 07:14:53 2013 |
1722 |
*** 2763,2768 **** |
696 |
+++ mutt-1.5.22/mh.c Fri Oct 18 10:18:45 2013 |
1723 |
--- 2784,2796 ---- |
697 |
@@ -295,6 +295,28 @@ void mh_buffy(BUFFY *b) |
1724 |
mutt_what_key (); |
698 |
mhs_free_sequences (&mhs); |
1725 |
break; |
699 |
} |
1726 |
|
700 |
|
1727 |
+ case OP_SIDEBAR_SCROLL_UP: |
701 |
+void mh_buffy_update (const char *path, int *msgcount, int *msg_unread, int *msg_flagged) |
1728 |
+ case OP_SIDEBAR_SCROLL_DOWN: |
702 |
+{ |
1729 |
+ case OP_SIDEBAR_NEXT: |
703 |
+ int i; |
1730 |
+ case OP_SIDEBAR_PREV: |
704 |
+ struct mh_sequences mhs; |
1731 |
+ scroll_sidebar(ch, MENU_PAGER); |
705 |
+ memset (&mhs, 0, sizeof (mhs)); |
1732 |
+ break; |
706 |
+ |
1733 |
+ |
707 |
+ if (mh_read_sequences (&mhs, path) < 0) |
1734 |
default: |
708 |
+ return; |
1735 |
ch = -1; |
709 |
+ |
1736 |
break; |
710 |
+ msgcount = 0; |
1737 |
*** mutt-1.5.23-orig/pattern.c 2014-03-12 11:03:45.000000000 -0500 |
711 |
+ msg_unread = 0; |
1738 |
--- mutt-1.5.23/pattern.c 2014-04-11 10:14:01.000000000 -0500 |
712 |
+ msg_flagged = 0; |
1739 |
*************** |
713 |
+ for (i = 0; i <= mhs.max; i++) |
1740 |
*** 154,159 **** |
714 |
+ msgcount++; |
1741 |
--- 154,163 ---- |
715 |
+ if (mhs_check (&mhs, i) & MH_SEQ_UNSEEN) { |
1742 |
HEADER *h = ctx->hdrs[msgno]; |
716 |
+ msg_unread++; |
1743 |
char *buf; |
717 |
+ } |
1744 |
size_t blen; |
718 |
+ if (mhs_check (&mhs, i) & MH_SEQ_FLAGGED) |
1745 |
+ #ifdef HAVE_FMEMOPEN |
719 |
+ msg_flagged++; |
1746 |
+ char *temp; |
720 |
+ mhs_free_sequences (&mhs); |
1747 |
+ size_t tempsize; |
721 |
+} |
1748 |
+ #endif |
722 |
+ |
1749 |
|
723 |
static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt) |
1750 |
if ((msg = mx_open_message (ctx, msgno)) != NULL) |
724 |
{ |
1751 |
{ |
725 |
int fd; |
1752 |
*************** |
726 |
diff -uNp -r mutt-1.5.22.orig/mutt.h mutt-1.5.22/mutt.h |
1753 |
*** 163,174 **** |
727 |
--- mutt-1.5.22.orig/mutt.h Fri Oct 18 05:48:24 2013 |
1754 |
--- 167,186 ---- |
728 |
+++ mutt-1.5.22/mutt.h Fri Oct 18 10:18:45 2013 |
1755 |
memset (&s, 0, sizeof (s)); |
729 |
@@ -420,6 +420,8 @@ enum |
1756 |
s.fpin = msg->fp; |
730 |
OPTSAVEEMPTY, |
1757 |
s.flags = M_CHARCONV; |
731 |
OPTSAVENAME, |
1758 |
+ #ifdef HAVE_FMEMOPEN |
732 |
OPTSCORE, |
1759 |
+ if((s.fpout = open_memstream(&temp, &tempsize)) == NULL) |
733 |
+ OPTSIDEBAR, |
1760 |
+ { |
734 |
+ OPTSIDEBARSORT, |
1761 |
+ mutt_perror ("Error opening memstream"); |
735 |
OPTSIGDASHES, |
1762 |
+ return (0); |
736 |
OPTSIGONTOP, |
1763 |
+ } |
737 |
OPTSORTRE, |
1764 |
+ #else |
738 |
@@ -860,6 +862,7 @@ typedef struct _context |
1765 |
mutt_mktemp (tempfile, sizeof (tempfile)); |
739 |
{ |
1766 |
if ((s.fpout = safe_fopen (tempfile, "w+")) == NULL) |
740 |
char *path; |
1767 |
{ |
741 |
FILE *fp; |
1768 |
mutt_perror (tempfile); |
742 |
+ time_t atime; |
1769 |
return (0); |
743 |
time_t mtime; |
1770 |
} |
744 |
off_t size; |
1771 |
+ #endif |
745 |
off_t vsize; |
1772 |
|
746 |
@@ -894,6 +897,7 @@ typedef struct _context |
1773 |
if (pat->op != M_BODY) |
747 |
unsigned int quiet : 1; /* inhibit status messages? */ |
1774 |
mutt_copy_header (msg->fp, h, s.fpout, CH_FROM | CH_DECODE, NULL); |
748 |
unsigned int collapsed : 1; /* are all threads collapsed? */ |
1775 |
*************** |
749 |
unsigned int closing : 1; /* mailbox is being closed */ |
1776 |
*** 184,190 **** |
750 |
+ unsigned int peekonly : 1; /* just taking a glance, revert atime */ |
1777 |
--- 196,206 ---- |
751 |
|
1778 |
if (s.fpout) |
752 |
/* driver hooks */ |
1779 |
{ |
753 |
void *data; /* driver specific data */ |
1780 |
safe_fclose (&s.fpout); |
754 |
diff -uNp -r mutt-1.5.22.orig/mutt_curses.h mutt-1.5.22/mutt_curses.h |
1781 |
+ #ifdef HAVE_FMEMOPEN |
755 |
--- mutt-1.5.22.orig/mutt_curses.h Tue Jan 15 07:37:15 2013 |
1782 |
+ FREE(&temp); |
756 |
+++ mutt-1.5.22/mutt_curses.h Fri Oct 18 10:22:32 2013 |
1783 |
+ #else |
757 |
@@ -64,6 +64,7 @@ |
1784 |
unlink (tempfile); |
758 |
#undef lines |
1785 |
+ #endif |
759 |
#endif /* lines */ |
1786 |
} |
760 |
|
1787 |
return (0); |
761 |
+#define CLEARLINE_WIN(x) move(x,SidebarWidth), clrtoeol() |
1788 |
} |
762 |
#define CLEARLINE(x) move(x,0), clrtoeol() |
1789 |
*************** |
763 |
#define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x) |
1790 |
*** 193,203 **** |
764 |
#define BEEP() do { if (option (OPTBEEP)) beep(); } while (0) |
1791 |
--- 209,236 ---- |
765 |
@@ -120,6 +121,8 @@ enum |
1792 |
mutt_body_handler (h->content, &s); |
766 |
MT_COLOR_BOLD, |
1793 |
} |
767 |
MT_COLOR_UNDERLINE, |
1794 |
|
768 |
MT_COLOR_INDEX, |
1795 |
+ #ifdef HAVE_FMEMOPEN |
769 |
+ MT_COLOR_NEW, |
1796 |
+ fclose(s.fpout); |
770 |
+ MT_COLOR_FLAGGED, |
1797 |
+ lng = tempsize; |
771 |
MT_COLOR_MAX |
1798 |
+ |
772 |
}; |
1799 |
+ if(tempsize) { |
773 |
|
1800 |
+ if ((fp = fmemopen(temp, tempsize, "r")) == NULL) { |
774 |
diff -uNp -r mutt-1.5.22.orig/muttlib.c mutt-1.5.22/muttlib.c |
1801 |
+ mutt_perror ("Error re-opening memstream"); |
775 |
--- mutt-1.5.22.orig/muttlib.c Fri Oct 18 05:48:24 2013 |
1802 |
+ return (0); |
776 |
+++ mutt-1.5.22/muttlib.c Fri Oct 18 10:18:45 2013 |
1803 |
+ } |
777 |
@@ -1286,6 +1286,8 @@ void mutt_FormatString (char *dest, /* output buffer |
1804 |
+ } else { /* fmemopen cannot handle empty buffers */ |
778 |
pl = pw = 1; |
1805 |
+ if ((fp = safe_fopen ("/dev/null", "r")) == NULL) { |
779 |
|
1806 |
+ mutt_perror ("Error opening /dev/null"); |
780 |
/* see if there's room to add content, else ignore */ |
1807 |
+ return (0); |
781 |
+ if ( DrawFullLine ) |
1808 |
+ } |
782 |
+ { |
1809 |
+ } |
783 |
if ((col < COLS && wlen < destlen) || soft) |
1810 |
+ #else |
784 |
{ |
1811 |
fp = s.fpout; |
785 |
int pad; |
1812 |
fflush (fp); |
786 |
@@ -1329,6 +1331,52 @@ void mutt_FormatString (char *dest, /* output buffer |
1813 |
fseek (fp, 0, 0); |
787 |
col += wid; |
1814 |
fstat (fileno (fp), &st); |
788 |
src += pl; |
1815 |
lng = (long) st.st_size; |
789 |
} |
1816 |
+ #endif |
790 |
+ } |
1817 |
} |
791 |
+ else |
1818 |
else |
792 |
+ { |
1819 |
{ |
793 |
+ if ((col < COLS-SidebarWidth && wlen < destlen) || soft) |
1820 |
*************** |
794 |
+ { |
1821 |
*** 244,250 **** |
795 |
+ int pad; |
1822 |
--- 277,288 ---- |
796 |
+ |
1823 |
if (option (OPTTHOROUGHSRC)) |
797 |
+ /* get contents after padding */ |
1824 |
{ |
798 |
+ mutt_FormatString (buf, sizeof (buf), 0, src + pl, callback, data, flags); |
1825 |
safe_fclose (&fp); |
799 |
+ len = mutt_strlen (buf); |
1826 |
+ #ifdef HAVE_FMEMOPEN |
800 |
+ wid = mutt_strwidth (buf); |
1827 |
+ if(tempsize) |
801 |
+ |
1828 |
+ FREE (&temp); |
802 |
+ /* try to consume as many columns as we can, if we don't have |
1829 |
+ #else |
803 |
+ * memory for that, use as much memory as possible */ |
1830 |
unlink (tempfile); |
804 |
+ pad = (COLS - SidebarWidth - col - wid) / pw; |
1831 |
+ #endif |
805 |
+ if (pad > 0 && wlen + (pad * pl) + len > destlen) |
1832 |
} |
806 |
+ pad = ((signed)(destlen - wlen - len)) / pl; |
1833 |
} |
807 |
+ if (pad > 0) |
1834 |
|
808 |
+ { |
1835 |
*** mutt-1.5.23-orig/PATCHES 2014-03-12 11:03:44.000000000 -0500 |
809 |
+ while (pad--) |
1836 |
--- mutt-1.5.23/PATCHES 2014-04-12 12:36:35.000000000 -0500 |
810 |
+ { |
1837 |
*************** |
811 |
+ memcpy (wptr, src, pl); |
1838 |
*** 0 **** |
812 |
+ wptr += pl; |
1839 |
--- 1 ---- |
813 |
+ wlen += pl; |
1840 |
+ patch-1.5.23.sidebar.20140412.txt |
814 |
+ col += pw; |
1841 |
*** mutt-1.5.23-orig/protos.h 2014-03-12 11:06:17.000000000 -0500 |
815 |
+ } |
1842 |
--- mutt-1.5.23/protos.h 2014-04-11 10:14:01.000000000 -0500 |
816 |
+ } |
1843 |
*************** |
817 |
+ else if (soft && pad < 0) |
1844 |
*** 36,41 **** |
818 |
+ { |
1845 |
--- 36,48 ---- |
819 |
+ /* \0-terminate dest for length computation in mutt_wstr_trunc() */ |
1846 |
const char *pager_progress; |
820 |
+ *wptr = 0; |
1847 |
}; |
821 |
+ /* make sure right part is at most as wide as display */ |
1848 |
|
822 |
+ len = mutt_wstr_trunc (buf, destlen, COLS, &wid); |
1849 |
+ struct sidebar_entry { |
823 |
+ /* truncate left so that right part fits completely in */ |
1850 |
+ char box[SHORT_STRING]; |
824 |
+ wlen = mutt_wstr_trunc (dest, destlen - len, col + pad, &col); |
1851 |
+ unsigned int size; |
825 |
+ wptr = dest + wlen; |
1852 |
+ unsigned int new; |
826 |
+ } |
1853 |
+ unsigned int flagged; |
827 |
+ if (len + wlen > destlen) |
1854 |
+ }; |
828 |
+ len = mutt_wstr_trunc (buf, destlen - wlen, COLS - SidebarWidth - col, NULL); |
1855 |
+ |
829 |
+ memcpy (wptr, buf, len); |
1856 |
void mutt_make_string_info (char *, size_t, const char *, struct hdr_format_info *, format_flag); |
830 |
+ wptr += len; |
1857 |
|
831 |
+ wlen += len; |
1858 |
int mutt_extract_token (BUFFER *, BUFFER *, int); |
832 |
+ col += wid; |
1859 |
*** mutt-1.5.23-orig/sidebar.c 1969-12-31 18:00:00.000000000 -0600 |
833 |
+ src += pl; |
1860 |
--- mutt-1.5.23/sidebar.c 2014-04-11 10:14:01.000000000 -0500 |
834 |
+ } |
1861 |
*************** |
835 |
+ } |
1862 |
*** 0 **** |
836 |
break; /* skip rest of input */ |
1863 |
--- 1,405 ---- |
837 |
} |
1864 |
+ /* |
838 |
else if (ch == '|') |
1865 |
+ * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu> |
839 |
diff -uNp -r mutt-1.5.22.orig/mx.c mutt-1.5.22/mx.c |
1866 |
+ * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com> |
840 |
--- mutt-1.5.22.orig/mx.c Fri Oct 18 05:48:24 2013 |
1867 |
+ * |
841 |
+++ mutt-1.5.22/mx.c Fri Oct 18 10:18:45 2013 |
1868 |
+ * This program is free software; you can redistribute it and/or modify |
842 |
@@ -580,6 +580,7 @@ static int mx_open_mailbox_append (CONTEXT *ctx, int f |
1869 |
+ * it under the terms of the GNU General Public License as published by |
843 |
* M_APPEND open mailbox for appending |
1870 |
+ * the Free Software Foundation; either version 2 of the License, or |
844 |
* M_READONLY open mailbox in read-only mode |
1871 |
+ * (at your option) any later version. |
845 |
* M_QUIET only print error messages |
1872 |
+ * |
846 |
+ * M_PEEK revert atime where applicable |
1873 |
+ * This program is distributed in the hope that it will be useful, |
847 |
* ctx if non-null, context struct to use |
1874 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
848 |
*/ |
1875 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
849 |
CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT *pctx) |
1876 |
+ * GNU General Public License for more details. |
850 |
@@ -602,6 +603,8 @@ CONTEXT *mx_open_mailbox (const char *path, int flags, |
1877 |
+ * |
851 |
ctx->quiet = 1; |
1878 |
+ * You should have received a copy of the GNU General Public License |
852 |
if (flags & M_READONLY) |
1879 |
+ * along with this program; if not, write to the Free Software |
853 |
ctx->readonly = 1; |
1880 |
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. |
854 |
+ if (flags & M_PEEK) |
1881 |
+ */ |
855 |
+ ctx->peekonly = 1; |
1882 |
+ |
856 |
|
1883 |
+ |
857 |
if (flags & (M_APPEND|M_NEWFOLDER)) |
1884 |
+ #if HAVE_CONFIG_H |
858 |
{ |
1885 |
+ # include "config.h" |
859 |
@@ -701,9 +704,21 @@ CONTEXT *mx_open_mailbox (const char *path, int flags, |
1886 |
+ #endif |
860 |
void mx_fastclose_mailbox (CONTEXT *ctx) |
1887 |
+ |
861 |
{ |
1888 |
+ #include "mutt.h" |
862 |
int i; |
1889 |
+ #include "mutt_menu.h" |
863 |
+#ifndef BUFFY_SIZE |
1890 |
+ #include "mutt_curses.h" |
864 |
+ struct utimbuf ut; |
1891 |
+ #include "sidebar.h" |
865 |
+#endif |
1892 |
+ #include "buffy.h" |
866 |
|
1893 |
+ #include <libgen.h> |
867 |
if(!ctx) |
1894 |
+ #include "keymap.h" |
868 |
return; |
1895 |
+ #include <stdbool.h> |
869 |
+#ifndef BUFFY_SIZE |
1896 |
+ |
870 |
+ /* fix up the times so buffy won't get confused */ |
1897 |
+ /*BUFFY *CurBuffy = 0;*/ |
871 |
+ if (ctx->peekonly && ctx->path && ctx->mtime > ctx->atime) |
1898 |
+ static BUFFY *TopBuffy = 0; |
872 |
+ { |
1899 |
+ static BUFFY *BottomBuffy = 0; |
873 |
+ ut.actime = ctx->atime; |
1900 |
+ static int known_lines = 0; |
874 |
+ ut.modtime = ctx->mtime; |
1901 |
+ |
875 |
+ utime (ctx->path, &ut); |
1902 |
+ void calc_boundaries() { |
876 |
+ } |
1903 |
+ |
877 |
+#endif |
1904 |
+ BUFFY *tmp = Incoming; |
878 |
|
1905 |
+ |
879 |
/* never announce that a mailbox we've just left has new mail. #3290 |
1906 |
+ int count = LINES - 2 - (option(OPTHELP) ? 1 : 0); |
880 |
* XXX: really belongs in mx_close_mailbox, but this is a nice hook point */ |
1907 |
+ |
881 |
diff -uNp -r mutt-1.5.22.orig/mx.h mutt-1.5.22/mx.h |
1908 |
+ if ( known_lines != LINES ) { |
882 |
--- mutt-1.5.22.orig/mx.h Mon Apr 22 07:14:53 2013 |
1909 |
+ TopBuffy = BottomBuffy = 0; |
883 |
+++ mutt-1.5.22/mx.h Fri Oct 18 10:18:45 2013 |
1910 |
+ known_lines = LINES; |
884 |
@@ -57,6 +57,7 @@ void mbox_reset_atime (CONTEXT *, struct stat *); |
1911 |
+ } |
885 |
int mh_read_dir (CONTEXT *, const char *); |
1912 |
+ for ( ; tmp->next != 0; tmp = tmp->next ) |
886 |
int mh_sync_mailbox (CONTEXT *, int *); |
1913 |
+ tmp->next->prev = tmp; |
887 |
int mh_check_mailbox (CONTEXT *, int *); |
1914 |
+ |
888 |
+void mh_buffy_update (const char *, int *, int *, int *); |
1915 |
+ if ( TopBuffy == 0 && BottomBuffy == 0 ) |
889 |
int mh_check_empty (const char *); |
1916 |
+ TopBuffy = Incoming; |
890 |
|
1917 |
+ if ( BottomBuffy == 0 ) { |
891 |
int maildir_read_dir (CONTEXT *); |
1918 |
+ BottomBuffy = TopBuffy; |
892 |
diff -uNp -r mutt-1.5.22.orig/pager.c mutt-1.5.22/pager.c |
1919 |
+ while ( --count && BottomBuffy->next ) |
893 |
--- mutt-1.5.22.orig/pager.c Mon Apr 22 07:17:32 2013 |
1920 |
+ BottomBuffy = BottomBuffy->next; |
894 |
+++ mutt-1.5.22/pager.c Fri Oct 18 10:18:45 2013 |
1921 |
+ } |
895 |
@@ -29,6 +29,7 @@ |
1922 |
+ else if ( TopBuffy == CurBuffy->next ) { |
896 |
#include "pager.h" |
1923 |
+ BottomBuffy = CurBuffy; |
897 |
#include "attach.h" |
1924 |
+ tmp = BottomBuffy; |
898 |
#include "mbyte.h" |
1925 |
+ while ( --count && tmp->prev) |
899 |
+#include "sidebar.h" |
1926 |
+ tmp = tmp->prev; |
900 |
|
1927 |
+ TopBuffy = tmp; |
901 |
#include "mutt_crypt.h" |
1928 |
+ } |
902 |
|
1929 |
+ else if ( BottomBuffy == CurBuffy->prev ) { |
903 |
@@ -1095,6 +1096,7 @@ static int format_line (struct line_t **lineInfo, int |
1930 |
+ TopBuffy = CurBuffy; |
904 |
wchar_t wc; |
1931 |
+ tmp = TopBuffy; |
905 |
mbstate_t mbstate; |
1932 |
+ while ( --count && tmp->next ) |
906 |
int wrap_cols = mutt_term_width ((flags & M_PAGER_NOWRAP) ? 0 : Wrap); |
1933 |
+ tmp = tmp->next; |
907 |
+ wrap_cols -= SidebarWidth; |
1934 |
+ BottomBuffy = tmp; |
908 |
|
1935 |
+ } |
909 |
if (check_attachment_marker ((char *)buf) == 0) |
1936 |
+ } |
910 |
wrap_cols = COLS; |
1937 |
+ |
911 |
@@ -1746,7 +1748,7 @@ mutt_pager (const char *banner, const char *fname, int |
1938 |
+ static const char * |
912 |
if ((redraw & REDRAW_BODY) || topline != oldtopline) |
1939 |
+ sidebar_format_str (char *dest, |
913 |
{ |
1940 |
+ size_t destlen, |
914 |
do { |
1941 |
+ size_t col, |
915 |
- move (bodyoffset, 0); |
1942 |
+ char op, |
916 |
+ move (bodyoffset, SidebarWidth); |
1943 |
+ const char *src, |
917 |
curline = oldtopline = topline; |
1944 |
+ const char *prefix, |
918 |
lines = 0; |
1945 |
+ const char *ifstring, |
919 |
force_redraw = 0; |
1946 |
+ const char *elsestring, |
920 |
@@ -1759,6 +1761,7 @@ mutt_pager (const char *banner, const char *fname, int |
1947 |
+ unsigned long data, |
921 |
&QuoteList, &q_level, &force_redraw, &SearchRE) > 0) |
1948 |
+ format_flag flags) |
922 |
lines++; |
1949 |
+ { |
923 |
curline++; |
1950 |
+ /* casting from unsigned long - srsly?! */ |
924 |
+ move(lines + bodyoffset, SidebarWidth); |
1951 |
+ struct sidebar_entry *sbe = (struct sidebar_entry *) data; |
925 |
} |
1952 |
+ unsigned int optional; |
926 |
last_offset = lineInfo[curline].offset; |
1953 |
+ char fmt[SHORT_STRING], buf[SHORT_STRING]; |
927 |
} while (force_redraw); |
1954 |
+ |
928 |
@@ -1771,6 +1774,7 @@ mutt_pager (const char *banner, const char *fname, int |
1955 |
+ optional = flags & M_FORMAT_OPTIONAL; |
929 |
addch ('~'); |
1956 |
+ |
930 |
addch ('\n'); |
1957 |
+ switch(op) { |
931 |
lines++; |
1958 |
+ case 'F': |
932 |
+ move(lines + bodyoffset, SidebarWidth); |
1959 |
+ if(!optional) { |
933 |
} |
1960 |
+ snprintf (fmt, sizeof (fmt), "%%%sd", prefix); |
934 |
NORMAL_COLOR; |
1961 |
+ snprintf (dest, destlen, fmt, sbe->flagged); |
935 |
|
1962 |
+ } else if(sbe->flagged == 0) { |
936 |
@@ -1799,17 +1803,17 @@ mutt_pager (const char *banner, const char *fname, int |
1963 |
+ optional = 0; |
937 |
|
1964 |
+ } |
938 |
if (IsHeader (extra) || IsMsgAttach (extra)) |
1965 |
+ break; |
939 |
{ |
1966 |
+ |
940 |
- size_t l1 = COLS * MB_LEN_MAX; |
1967 |
+ case '!': |
941 |
+ size_t l1 = (COLS-SidebarWidth) * MB_LEN_MAX; |
1968 |
+ if(sbe->flagged == 0) |
942 |
size_t l2 = sizeof (buffer); |
1969 |
+ mutt_format_s(dest, destlen, prefix, ""); |
943 |
hfi.hdr = (IsHeader (extra)) ? extra->hdr : extra->bdy->hdr; |
1970 |
+ if(sbe->flagged == 1) |
944 |
mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), &hfi, M_FORMAT_MAKEPRINT); |
1971 |
+ mutt_format_s(dest, destlen, prefix, "!"); |
945 |
- mutt_paddstr (COLS, buffer); |
1972 |
+ if(sbe->flagged == 2) |
946 |
+ mutt_paddstr (COLS-SidebarWidth, buffer); |
1973 |
+ mutt_format_s(dest, destlen, prefix, "!!"); |
947 |
} |
1974 |
+ if(sbe->flagged > 2) { |
948 |
else |
1975 |
+ snprintf (buf, sizeof (buf), "%d!", sbe->flagged); |
949 |
{ |
1976 |
+ mutt_format_s(dest, destlen, prefix, buf); |
950 |
char bn[STRING]; |
1977 |
+ } |
951 |
snprintf (bn, sizeof (bn), "%s (%s)", banner, pager_progress_str); |
1978 |
+ break; |
952 |
- mutt_paddstr (COLS, bn); |
1979 |
+ |
953 |
+ mutt_paddstr (COLS-SidebarWidth, bn); |
1980 |
+ case 'S': |
954 |
} |
1981 |
+ snprintf (fmt, sizeof (fmt), "%%%sd", prefix); |
955 |
NORMAL_COLOR; |
1982 |
+ snprintf (dest, destlen, fmt, sbe->size); |
956 |
} |
1983 |
+ break; |
957 |
@@ -1819,16 +1823,21 @@ mutt_pager (const char *banner, const char *fname, int |
1984 |
+ |
958 |
/* redraw the pager_index indicator, because the |
1985 |
+ case 'N': |
959 |
* flags for this message might have changed. */ |
1986 |
+ if(!optional) { |
960 |
menu_redraw_current (index); |
1987 |
+ snprintf (fmt, sizeof (fmt), "%%%sd", prefix); |
961 |
+ draw_sidebar(MENU_PAGER); |
1988 |
+ snprintf (dest, destlen, fmt, sbe->new); |
962 |
|
1989 |
+ } else if(sbe->new == 0) { |
963 |
/* print out the index status bar */ |
1990 |
+ optional = 0; |
964 |
menu_status_line (buffer, sizeof (buffer), index, NONULL(Status)); |
1991 |
+ } |
965 |
|
1992 |
+ break; |
966 |
- move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), 0); |
1993 |
+ |
967 |
+ move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), SidebarWidth); |
1994 |
+ case 'B': |
968 |
SETCOLOR (MT_COLOR_STATUS); |
1995 |
+ mutt_format_s(dest, destlen, prefix, sbe->box); |
969 |
- mutt_paddstr (COLS, buffer); |
1996 |
+ break; |
970 |
+ mutt_paddstr (COLS-SidebarWidth, buffer); |
1997 |
+ } |
971 |
NORMAL_COLOR; |
1998 |
+ |
972 |
} |
1999 |
+ if(optional) |
973 |
|
2000 |
+ mutt_FormatString (dest, destlen, col, ifstring, sidebar_format_str, (unsigned long) sbe, flags); |
974 |
+ /* if we're not using the index, update every time */ |
2001 |
+ else if (flags & M_FORMAT_OPTIONAL) |
975 |
+ if ( index == 0 ) |
2002 |
+ mutt_FormatString (dest, destlen, col, elsestring, sidebar_format_str, (unsigned long) sbe, flags); |
976 |
+ draw_sidebar(MENU_PAGER); |
2003 |
+ |
977 |
+ |
2004 |
+ return (src); |
978 |
redraw = 0; |
2005 |
+ } |
979 |
|
2006 |
+ |
980 |
if (option(OPTBRAILLEFRIENDLY)) { |
2007 |
+ char *make_sidebar_entry(char *box, unsigned int size, unsigned int new, unsigned int flagged) { |
981 |
@@ -2762,6 +2771,13 @@ search_next: |
2008 |
+ static char *entry = 0; |
982 |
case OP_WHAT_KEY: |
2009 |
+ struct sidebar_entry sbe; |
983 |
mutt_what_key (); |
2010 |
+ int SBvisual; |
984 |
break; |
2011 |
+ |
985 |
+ |
2012 |
+ SBvisual = SidebarWidth - strlen(SidebarDelim); |
986 |
+ case OP_SIDEBAR_SCROLL_UP: |
2013 |
+ if (SBvisual < 1) |
987 |
+ case OP_SIDEBAR_SCROLL_DOWN: |
2014 |
+ return NULL; |
988 |
+ case OP_SIDEBAR_NEXT: |
2015 |
+ |
989 |
+ case OP_SIDEBAR_PREV: |
2016 |
+ sbe.new = new; |
990 |
+ scroll_sidebar(ch, MENU_PAGER); |
2017 |
+ sbe.flagged = flagged; |
991 |
+ break; |
2018 |
+ sbe.size = size; |
992 |
|
2019 |
+ strncpy(sbe.box, box, 31); |
993 |
default: |
2020 |
+ |
994 |
ch = -1; |
2021 |
+ safe_realloc(&entry, SBvisual + 2); |
995 |
diff -uNp -r mutt-1.5.22.orig/sidebar.c mutt-1.5.22/sidebar.c |
2022 |
+ entry[SBvisual + 1] = '\0'; |
996 |
--- mutt-1.5.22.orig/sidebar.c Thu Jan 1 01:00:00 1970 |
2023 |
+ |
997 |
+++ mutt-1.5.22/sidebar.c Fri Oct 18 10:18:45 2013 |
2024 |
+ mutt_FormatString (entry, SBvisual+1, 0, SidebarFormat, sidebar_format_str, (unsigned long) &sbe, 0); |
998 |
@@ -0,0 +1,333 @@ |
2025 |
+ |
999 |
+/* |
2026 |
+ return entry; |
1000 |
+ * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu> |
2027 |
+ } |
1001 |
+ * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com> |
2028 |
+ |
1002 |
+ * |
2029 |
+ void set_curbuffy(char buf[LONG_STRING]) |
1003 |
+ * This program is free software; you can redistribute it and/or modify |
2030 |
+ { |
1004 |
+ * it under the terms of the GNU General Public License as published by |
2031 |
+ BUFFY* tmp = CurBuffy = Incoming; |
1005 |
+ * the Free Software Foundation; either version 2 of the License, or |
2032 |
+ |
1006 |
+ * (at your option) any later version. |
2033 |
+ if (!Incoming) |
1007 |
+ * |
2034 |
+ return; |
1008 |
+ * This program is distributed in the hope that it will be useful, |
2035 |
+ |
1009 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2036 |
+ while(1) { |
1010 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2037 |
+ if(!strcmp(tmp->path, buf) || !strcmp(tmp->realpath, buf)) { |
1011 |
+ * GNU General Public License for more details. |
2038 |
+ CurBuffy = tmp; |
1012 |
+ * |
2039 |
+ break; |
1013 |
+ * You should have received a copy of the GNU General Public License |
2040 |
+ } |
1014 |
+ * along with this program; if not, write to the Free Software |
2041 |
+ |
1015 |
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. |
2042 |
+ if(tmp->next) |
1016 |
+ */ |
2043 |
+ tmp = tmp->next; |
1017 |
+ |
2044 |
+ else |
1018 |
+ |
2045 |
+ break; |
1019 |
+#if HAVE_CONFIG_H |
2046 |
+ } |
1020 |
+# include "config.h" |
2047 |
+ } |
1021 |
+#endif |
2048 |
+ |
1022 |
+ |
2049 |
+ int draw_sidebar(int menu) { |
1023 |
+#include "mutt.h" |
2050 |
+ |
1024 |
+#include "mutt_menu.h" |
2051 |
+ BUFFY *tmp; |
1025 |
+#include "mutt_curses.h" |
2052 |
+ #ifndef USE_SLANG_CURSES |
1026 |
+#include "sidebar.h" |
2053 |
+ attr_t attrs; |
1027 |
+#include "buffy.h" |
2054 |
+ #endif |
1028 |
+#include <libgen.h> |
2055 |
+ short delim_len = strlen(SidebarDelim); |
1029 |
+#include "keymap.h" |
2056 |
+ short color_pair; |
1030 |
+#include <stdbool.h> |
2057 |
+ |
1031 |
+ |
2058 |
+ static bool initialized = false; |
1032 |
+/*BUFFY *CurBuffy = 0;*/ |
2059 |
+ static int prev_show_value; |
1033 |
+static BUFFY *TopBuffy = 0; |
2060 |
+ static short saveSidebarWidth; |
1034 |
+static BUFFY *BottomBuffy = 0; |
2061 |
+ int lines = 0; |
1035 |
+static int known_lines = 0; |
2062 |
+ int SidebarHeight; |
1036 |
+ |
2063 |
+ |
1037 |
+static int quick_log10(int n) |
2064 |
+ if(option(OPTSTATUSONTOP) || option(OPTHELP)) |
1038 |
+{ |
2065 |
+ lines++; /* either one will occupy the first line */ |
1039 |
+ char string[32]; |
2066 |
+ |
1040 |
+ sprintf(string, "%d", n); |
2067 |
+ /* initialize first time */ |
1041 |
+ return strlen(string); |
2068 |
+ if(!initialized) { |
1042 |
+} |
2069 |
+ prev_show_value = option(OPTSIDEBAR); |
1043 |
+ |
2070 |
+ saveSidebarWidth = SidebarWidth; |
1044 |
+void calc_boundaries (int menu) |
2071 |
+ if(!option(OPTSIDEBAR)) SidebarWidth = 0; |
1045 |
+{ |
2072 |
+ initialized = true; |
1046 |
+ BUFFY *tmp = Incoming; |
2073 |
+ } |
1047 |
+ |
2074 |
+ |
1048 |
+ if ( known_lines != LINES ) { |
2075 |
+ /* save or restore the value SidebarWidth */ |
1049 |
+ TopBuffy = BottomBuffy = 0; |
2076 |
+ if(prev_show_value != option(OPTSIDEBAR)) { |
1050 |
+ known_lines = LINES; |
2077 |
+ if(prev_show_value && !option(OPTSIDEBAR)) { |
1051 |
+ } |
2078 |
+ saveSidebarWidth = SidebarWidth; |
1052 |
+ for ( ; tmp->next != 0; tmp = tmp->next ) |
2079 |
+ SidebarWidth = 0; |
1053 |
+ tmp->next->prev = tmp; |
2080 |
+ } else if(!prev_show_value && option(OPTSIDEBAR)) { |
1054 |
+ |
2081 |
+ mutt_buffy_check(1); /* we probably have bad or no numbers */ |
1055 |
+ if ( TopBuffy == 0 && BottomBuffy == 0 ) |
2082 |
+ SidebarWidth = saveSidebarWidth; |
1056 |
+ TopBuffy = Incoming; |
2083 |
+ } |
1057 |
+ if ( BottomBuffy == 0 ) { |
2084 |
+ prev_show_value = option(OPTSIDEBAR); |
1058 |
+ int count = LINES - 2 - (menu != MENU_PAGER || option(OPTSTATUSONTOP)); |
2085 |
+ } |
1059 |
+ BottomBuffy = TopBuffy; |
2086 |
+ |
1060 |
+ while ( --count && BottomBuffy->next ) |
2087 |
+ |
1061 |
+ BottomBuffy = BottomBuffy->next; |
2088 |
+ /* if ( SidebarWidth == 0 ) return 0; */ |
1062 |
+ } |
2089 |
+ if (SidebarWidth > 0 && option (OPTSIDEBAR) |
1063 |
+ else if ( TopBuffy == CurBuffy->next ) { |
2090 |
+ && delim_len >= SidebarWidth) { |
1064 |
+ int count = LINES - 2 - (menu != MENU_PAGER); |
2091 |
+ unset_option (OPTSIDEBAR); |
1065 |
+ BottomBuffy = CurBuffy; |
2092 |
+ /* saveSidebarWidth = SidebarWidth; */ |
1066 |
+ tmp = BottomBuffy; |
2093 |
+ if (saveSidebarWidth > delim_len) { |
1067 |
+ while ( --count && tmp->prev) |
2094 |
+ SidebarWidth = saveSidebarWidth; |
1068 |
+ tmp = tmp->prev; |
2095 |
+ mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar.")); |
1069 |
+ TopBuffy = tmp; |
2096 |
+ sleep (2); |
1070 |
+ } |
|
|
1071 |
+ else if ( BottomBuffy == CurBuffy->prev ) { |
1072 |
+ int count = LINES - 2 - (menu != MENU_PAGER); |
1073 |
+ TopBuffy = CurBuffy; |
1074 |
+ tmp = TopBuffy; |
1075 |
+ while ( --count && tmp->next ) |
1076 |
+ tmp = tmp->next; |
1077 |
+ BottomBuffy = tmp; |
1078 |
+ } |
1079 |
+} |
1080 |
+ |
1081 |
+char *make_sidebar_entry(char *box, int size, int new, int flagged) |
1082 |
+{ |
1083 |
+ static char *entry = 0; |
1084 |
+ char *c; |
1085 |
+ int i = 0; |
1086 |
+ int delim_len = strlen(SidebarDelim); |
1087 |
+ |
1088 |
+ c = realloc(entry, SidebarWidth - delim_len + 2); |
1089 |
+ if ( c ) entry = c; |
1090 |
+ entry[SidebarWidth - delim_len + 1] = 0; |
1091 |
+ for (; i < SidebarWidth - delim_len + 1; entry[i++] = ' ' ); |
1092 |
+ i = strlen(box); |
1093 |
+ strncpy( entry, box, i < (SidebarWidth - delim_len + 1) ? i : (SidebarWidth - delim_len + 1) ); |
1094 |
+ |
1095 |
+ if (size == -1) |
1096 |
+ sprintf(entry + SidebarWidth - delim_len - 3, "?"); |
1097 |
+ else if ( new ) { |
1098 |
+ if (flagged > 0) { |
1099 |
+ sprintf( |
1100 |
+ entry + SidebarWidth - delim_len - 5 - quick_log10(size) - quick_log10(new) - quick_log10(flagged), |
1101 |
+ "% d(%d)[%d]", size, new, flagged); |
1102 |
+ } else { |
2097 |
+ } else { |
1103 |
+ sprintf( |
2098 |
+ SidebarWidth = 0; |
1104 |
+ entry + SidebarWidth - delim_len - 3 - quick_log10(size) - quick_log10(new), |
2099 |
+ mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar. Please set your sidebar_width to a sane value.")); |
1105 |
+ "% d(%d)", size, new); |
2100 |
+ sleep (4); /* the advise to set a sane value should be seen long enough */ |
1106 |
+ } |
2101 |
+ } |
1107 |
+ } else if (flagged > 0) { |
2102 |
+ saveSidebarWidth = 0; |
1108 |
+ sprintf( entry + SidebarWidth - delim_len - 3 - quick_log10(size) - quick_log10(flagged), "% d[%d]", size, flagged); |
2103 |
+ return (0); |
1109 |
+ } else { |
|
|
1110 |
+ sprintf( entry + SidebarWidth - delim_len - 1 - quick_log10(size), "% d", size); |
1111 |
+ } |
1112 |
+ return entry; |
1113 |
+} |
1114 |
+ |
1115 |
+void set_curbuffy(char buf[LONG_STRING]) |
1116 |
+{ |
1117 |
+ BUFFY* tmp = CurBuffy = Incoming; |
1118 |
+ |
1119 |
+ if (!Incoming) |
1120 |
+ return; |
1121 |
+ |
1122 |
+ while(1) { |
1123 |
+ if(!strcmp(tmp->path, buf)) { |
1124 |
+ CurBuffy = tmp; |
1125 |
+ break; |
1126 |
+ } |
1127 |
+ |
1128 |
+ if(tmp->next) |
1129 |
+ tmp = tmp->next; |
1130 |
+ else |
1131 |
+ break; |
1132 |
+ } |
1133 |
+} |
1134 |
+ |
1135 |
+int draw_sidebar(int menu) { |
1136 |
+ |
1137 |
+ int lines = option(OPTHELP) ? 1 : 0; |
1138 |
+ BUFFY *tmp; |
1139 |
+#ifndef USE_SLANG_CURSES |
1140 |
+ attr_t attrs; |
1141 |
+#endif |
1142 |
+ short delim_len = strlen(SidebarDelim); |
1143 |
+ short color_pair; |
1144 |
+ |
1145 |
+ static bool initialized = false; |
1146 |
+ static int prev_show_value; |
1147 |
+ static short saveSidebarWidth; |
1148 |
+ |
1149 |
+ /* initialize first time */ |
1150 |
+ if(!initialized) { |
1151 |
+ prev_show_value = option(OPTSIDEBAR); |
1152 |
+ saveSidebarWidth = SidebarWidth; |
1153 |
+ if(!option(OPTSIDEBAR)) SidebarWidth = 0; |
1154 |
+ initialized = true; |
1155 |
+ } |
2104 |
+ } |
1156 |
+ |
2105 |
+ |
1157 |
+ /* save or restore the value SidebarWidth */ |
2106 |
+ if ( SidebarWidth == 0 || !option(OPTSIDEBAR)) { |
1158 |
+ if(prev_show_value != option(OPTSIDEBAR)) { |
2107 |
+ if (SidebarWidth > 0) { |
1159 |
+ if(prev_show_value && !option(OPTSIDEBAR)) { |
2108 |
+ saveSidebarWidth = SidebarWidth; |
1160 |
+ saveSidebarWidth = SidebarWidth; |
2109 |
+ SidebarWidth = 0; |
1161 |
+ SidebarWidth = 0; |
|
|
1162 |
+ } else if(!prev_show_value && option(OPTSIDEBAR)) { |
1163 |
+ SidebarWidth = saveSidebarWidth; |
1164 |
+ } |
1165 |
+ prev_show_value = option(OPTSIDEBAR); |
1166 |
+ } |
1167 |
+ |
1168 |
+ |
1169 |
+// if ( SidebarWidth == 0 ) return 0; |
1170 |
+ if (SidebarWidth > 0 && option (OPTSIDEBAR) |
1171 |
+ && delim_len >= SidebarWidth) { |
1172 |
+ unset_option (OPTSIDEBAR); |
1173 |
+ /* saveSidebarWidth = SidebarWidth; */ |
1174 |
+ if (saveSidebarWidth > delim_len) { |
1175 |
+ SidebarWidth = saveSidebarWidth; |
1176 |
+ mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar.")); |
1177 |
+ sleep (2); |
1178 |
+ } else { |
1179 |
+ SidebarWidth = 0; |
1180 |
+ mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar. Please set your sidebar_width to a sane value.")); |
1181 |
+ sleep (4); /* the advise to set a sane value should be seen long enough */ |
1182 |
+ } |
1183 |
+ saveSidebarWidth = 0; |
1184 |
+ return (0); |
1185 |
+ } |
2110 |
+ } |
1186 |
+ |
2111 |
+ unset_option(OPTSIDEBAR); |
1187 |
+ if ( SidebarWidth == 0 || !option(OPTSIDEBAR)) { |
2112 |
+ return 0; |
1188 |
+ if (SidebarWidth > 0) { |
2113 |
+ } |
1189 |
+ saveSidebarWidth = SidebarWidth; |
2114 |
+ |
1190 |
+ SidebarWidth = 0; |
2115 |
+ /* get attributes for divider */ |
1191 |
+ } |
2116 |
+ SETCOLOR(MT_COLOR_STATUS); |
1192 |
+ unset_option(OPTSIDEBAR); |
2117 |
+ #ifndef USE_SLANG_CURSES |
1193 |
+ return 0; |
2118 |
+ attr_get(&attrs, &color_pair, 0); |
1194 |
+ } |
2119 |
+ #else |
1195 |
+ |
2120 |
+ color_pair = attr_get(); |
1196 |
+ /* get attributes for divider */ |
2121 |
+ #endif |
1197 |
+ SETCOLOR(MT_COLOR_STATUS); |
2122 |
+ SETCOLOR(MT_COLOR_NORMAL); |
1198 |
+#ifndef USE_SLANG_CURSES |
2123 |
+ |
1199 |
+ attr_get(&attrs, &color_pair, 0); |
2124 |
+ /* draw the divider */ |
1200 |
+#else |
2125 |
+ |
1201 |
+ color_pair = attr_get(); |
2126 |
+ SidebarHeight = LINES - 1; |
1202 |
+#endif |
2127 |
+ if(option(OPTHELP) || !option(OPTSTATUSONTOP)) |
1203 |
+ SETCOLOR(MT_COLOR_NORMAL); |
2128 |
+ SidebarHeight--; |
1204 |
+ |
2129 |
+ |
1205 |
+ /* draw the divider */ |
2130 |
+ for ( ; lines < SidebarHeight; lines++ ) { |
1206 |
+ |
2131 |
+ move(lines, SidebarWidth - delim_len); |
1207 |
+ for ( ; lines < LINES-1-(menu != MENU_PAGER || option(OPTSTATUSONTOP)); lines++ ) { |
2132 |
+ addstr(NONULL(SidebarDelim)); |
1208 |
+ move(lines, SidebarWidth - delim_len); |
2133 |
+ #ifndef USE_SLANG_CURSES |
1209 |
+ addstr(NONULL(SidebarDelim)); |
2134 |
+ mvchgat(lines, SidebarWidth - delim_len, delim_len, 0, color_pair, NULL); |
1210 |
+#ifndef USE_SLANG_CURSES |
2135 |
+ #endif |
1211 |
+ mvchgat(lines, SidebarWidth - delim_len, delim_len, 0, color_pair, NULL); |
2136 |
+ } |
1212 |
+#endif |
2137 |
+ |
1213 |
+ } |
2138 |
+ if ( Incoming == 0 ) return 0; |
1214 |
+ |
2139 |
+ lines = 0; |
1215 |
+ if ( Incoming == 0 ) return 0; |
2140 |
+ if(option(OPTSTATUSONTOP) || option(OPTHELP)) |
1216 |
+ lines = option(OPTHELP) ? 1 : 0; /* go back to the top */ |
2141 |
+ lines++; /* either one will occupy the first line */ |
1217 |
+ |
2142 |
+ |
1218 |
+ if ( known_lines != LINES || TopBuffy == 0 || BottomBuffy == 0 ) |
2143 |
+ if ( known_lines != LINES || TopBuffy == 0 || BottomBuffy == 0 ) |
1219 |
+ calc_boundaries(menu); |
2144 |
+ calc_boundaries(menu); |
1220 |
+ if ( CurBuffy == 0 ) CurBuffy = Incoming; |
2145 |
+ if ( CurBuffy == 0 ) CurBuffy = Incoming; |
1221 |
+ |
2146 |
+ |
1222 |
+ tmp = TopBuffy; |
2147 |
+ tmp = TopBuffy; |
1223 |
+ |
2148 |
+ |
1224 |
+ SETCOLOR(MT_COLOR_NORMAL); |
2149 |
+ SETCOLOR(MT_COLOR_NORMAL); |
1225 |
+ |
2150 |
+ |
1226 |
+ for ( ; tmp && lines < LINES-1 - (menu != MENU_PAGER || option(OPTSTATUSONTOP)); tmp = tmp->next ) { |
2151 |
+ for ( ; tmp && lines < SidebarHeight; tmp = tmp->next ) { |
1227 |
+ if ( tmp == CurBuffy ) |
2152 |
+ if ( tmp == CurBuffy ) |
1228 |
+ SETCOLOR(MT_COLOR_INDICATOR); |
2153 |
+ SETCOLOR(MT_COLOR_INDICATOR); |
1229 |
+ else if ( tmp->msg_unread > 0 ) |
2154 |
+ else if ( tmp->msg_unread > 0 ) |
1230 |
+ SETCOLOR(MT_COLOR_NEW); |
2155 |
+ SETCOLOR(MT_COLOR_NEW); |
1231 |
+ else if ( tmp->msg_flagged > 0 ) |
2156 |
+ else if ( tmp->msg_flagged > 0 ) |
1232 |
+ SETCOLOR(MT_COLOR_FLAGGED); |
2157 |
+ SETCOLOR(MT_COLOR_FLAGGED); |
1233 |
+ else |
2158 |
+ else |
1234 |
+ SETCOLOR(MT_COLOR_NORMAL); |
2159 |
+ SETCOLOR(MT_COLOR_NORMAL); |
1235 |
+ |
2160 |
+ |
1236 |
+ move( lines, 0 ); |
2161 |
+ move( lines, 0 ); |
1237 |
+ if ( Context && !strcmp( tmp->path, Context->path ) ) { |
2162 |
+ if ( Context && (!strcmp(tmp->path, Context->path)|| |
1238 |
+ tmp->msg_unread = Context->unread; |
2163 |
+ !strcmp(tmp->realpath, Context->path)) ) { |
1239 |
+ tmp->msgcount = Context->msgcount; |
2164 |
+ tmp->msg_unread = Context->unread; |
1240 |
+ tmp->msg_flagged = Context->flagged; |
2165 |
+ tmp->msgcount = Context->msgcount; |
1241 |
+ } |
2166 |
+ tmp->msg_flagged = Context->flagged; |
1242 |
+ // check whether Maildir is a prefix of the current folder's path |
2167 |
+ } |
1243 |
+ short maildir_is_prefix = 0; |
2168 |
+ /* check whether Maildir is a prefix of the current folder's path */ |
1244 |
+ if ( (strlen(tmp->path) > strlen(Maildir)) && |
2169 |
+ short maildir_is_prefix = 0; |
1245 |
+ (strncmp(Maildir, tmp->path, strlen(Maildir)) == 0) ) |
2170 |
+ if ( (strlen(tmp->path) > strlen(Maildir)) && |
1246 |
+ maildir_is_prefix = 1; |
2171 |
+ (strncmp(Maildir, tmp->path, strlen(Maildir)) == 0) ) |
1247 |
+ // calculate depth of current folder and generate its display name with indented spaces |
2172 |
+ maildir_is_prefix = 1; |
1248 |
+ int sidebar_folder_depth = 0; |
2173 |
+ /* calculate depth of current folder and generate its display name with indented spaces */ |
1249 |
+ char *sidebar_folder_name; |
2174 |
+ int sidebar_folder_depth = 0; |
1250 |
+ sidebar_folder_name = basename(tmp->path); |
2175 |
+ char *sidebar_folder_name; |
1251 |
+ if ( maildir_is_prefix ) { |
2176 |
+ sidebar_folder_name = option(OPTSIDEBARSHORTPATH) ? mutt_basename(tmp->path) : tmp->path + maildir_is_prefix*(strlen(Maildir) + 1); |
1252 |
+ char *tmp_folder_name; |
2177 |
+ if ( maildir_is_prefix && option(OPTSIDEBARFOLDERINDENT) ) { |
1253 |
+ int i; |
2178 |
+ char *tmp_folder_name; |
1254 |
+ tmp_folder_name = tmp->path + strlen(Maildir); |
2179 |
+ int i; |
1255 |
+ for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) { |
2180 |
+ tmp_folder_name = tmp->path + strlen(Maildir) + 1; |
1256 |
+ if (tmp_folder_name[i] == '/') sidebar_folder_depth++; |
2181 |
+ for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) { |
1257 |
+ } |
2182 |
+ if (tmp_folder_name[i] == '/' || tmp_folder_name[i] == '.') sidebar_folder_depth++; |
1258 |
+ if (sidebar_folder_depth > 0) { |
2183 |
+ } |
1259 |
+ sidebar_folder_name = malloc(strlen(basename(tmp->path)) + sidebar_folder_depth + 1); |
2184 |
+ if (sidebar_folder_depth > 0) { |
1260 |
+ for (i=0; i < sidebar_folder_depth; i++) |
2185 |
+ if (option(OPTSIDEBARSHORTPATH)) { |
1261 |
+ sidebar_folder_name[i]=' '; |
2186 |
+ tmp_folder_name = strrchr(tmp->path, '.'); |
1262 |
+ sidebar_folder_name[i]=0; |
2187 |
+ if (tmp_folder_name == NULL) |
1263 |
+ strncat(sidebar_folder_name, basename(tmp->path), strlen(basename(tmp->path)) + sidebar_folder_depth); |
2188 |
+ tmp_folder_name = mutt_basename(tmp->path); |
1264 |
+ } |
2189 |
+ else |
1265 |
+ } |
2190 |
+ tmp_folder_name++; |
1266 |
+ printw( "%.*s", SidebarWidth - delim_len + 1, |
2191 |
+ } |
1267 |
+ make_sidebar_entry(sidebar_folder_name, tmp->msgcount, |
2192 |
+ else |
1268 |
+ tmp->msg_unread, tmp->msg_flagged)); |
2193 |
+ tmp_folder_name = tmp->path + strlen(Maildir) + 1; |
1269 |
+ if (sidebar_folder_depth > 0) |
2194 |
+ sidebar_folder_name = malloc(strlen(tmp_folder_name) + sidebar_folder_depth*strlen(NONULL(SidebarIndentStr)) + 1); |
1270 |
+ free(sidebar_folder_name); |
2195 |
+ sidebar_folder_name[0]=0; |
1271 |
+ lines++; |
2196 |
+ for (i=0; i < sidebar_folder_depth; i++) |
1272 |
+ } |
2197 |
+ strncat(sidebar_folder_name, NONULL(SidebarIndentStr), strlen(NONULL(SidebarIndentStr))); |
1273 |
+ SETCOLOR(MT_COLOR_NORMAL); |
2198 |
+ strncat(sidebar_folder_name, tmp_folder_name, strlen(tmp_folder_name)); |
1274 |
+ for ( ; lines < LINES-1 - (menu != MENU_PAGER || option(OPTSTATUSONTOP)); lines++ ) { |
2199 |
+ } |
1275 |
+ int i = 0; |
2200 |
+ } |
1276 |
+ move( lines, 0 ); |
2201 |
+ printw( "%.*s", SidebarWidth - delim_len + 1, |
1277 |
+ for ( ; i < SidebarWidth - delim_len; i++ ) |
2202 |
+ make_sidebar_entry(sidebar_folder_name, tmp->msgcount, |
1278 |
+ addch(' '); |
2203 |
+ tmp->msg_unread, tmp->msg_flagged)); |
1279 |
+ } |
2204 |
+ if (sidebar_folder_depth > 0) |
1280 |
+ return 0; |
2205 |
+ free(sidebar_folder_name); |
1281 |
+} |
2206 |
+ lines++; |
1282 |
+ |
2207 |
+ } |
1283 |
+ |
2208 |
+ SETCOLOR(MT_COLOR_NORMAL); |
1284 |
+void set_buffystats(CONTEXT* Context) |
2209 |
+ for ( ; lines < SidebarHeight; lines++ ) { |
1285 |
+{ |
2210 |
+ int i = 0; |
1286 |
+ BUFFY *tmp = Incoming; |
2211 |
+ move( lines, 0 ); |
1287 |
+ while(tmp) { |
2212 |
+ for ( ; i < SidebarWidth - delim_len; i++ ) |
1288 |
+ if(Context && !strcmp(tmp->path, Context->path)) { |
2213 |
+ addch(' '); |
1289 |
+ tmp->msg_unread = Context->unread; |
2214 |
+ } |
1290 |
+ tmp->msgcount = Context->msgcount; |
2215 |
+ return 0; |
1291 |
+ break; |
2216 |
+ } |
1292 |
+ } |
2217 |
+ |
1293 |
+ tmp = tmp->next; |
2218 |
+ |
1294 |
+ } |
2219 |
+ void set_buffystats(CONTEXT* Context) |
1295 |
+} |
2220 |
+ { |
1296 |
+ |
2221 |
+ BUFFY *tmp = Incoming; |
1297 |
+void scroll_sidebar(int op, int menu) |
2222 |
+ while(tmp) { |
1298 |
+{ |
2223 |
+ if(Context && (!strcmp(tmp->path, Context->path) || |
1299 |
+ if(!SidebarWidth) return; |
2224 |
+ !strcmp(tmp->realpath, Context->path))) { |
1300 |
+ if(!CurBuffy) return; |
2225 |
+ tmp->msg_unread = Context->unread; |
1301 |
+ |
2226 |
+ tmp->msgcount = Context->msgcount; |
1302 |
+ switch (op) { |
2227 |
+ tmp->msg_flagged = Context->flagged; |
1303 |
+ case OP_SIDEBAR_NEXT: |
2228 |
+ break; |
1304 |
+ if ( CurBuffy->next == NULL ) return; |
2229 |
+ } |
1305 |
+ CurBuffy = CurBuffy->next; |
2230 |
+ tmp = tmp->next; |
1306 |
+ break; |
2231 |
+ } |
1307 |
+ case OP_SIDEBAR_PREV: |
2232 |
+ } |
1308 |
+ if ( CurBuffy->prev == NULL ) return; |
2233 |
+ |
1309 |
+ CurBuffy = CurBuffy->prev; |
2234 |
+ void scroll_sidebar(int op, int menu) |
1310 |
+ break; |
2235 |
+ { |
1311 |
+ case OP_SIDEBAR_SCROLL_UP: |
2236 |
+ if(!SidebarWidth) return; |
1312 |
+ CurBuffy = TopBuffy; |
2237 |
+ if(!CurBuffy) return; |
1313 |
+ if ( CurBuffy != Incoming ) { |
2238 |
+ |
1314 |
+ calc_boundaries(menu); |
2239 |
+ switch (op) { |
1315 |
+ CurBuffy = CurBuffy->prev; |
2240 |
+ case OP_SIDEBAR_NEXT: |
1316 |
+ } |
2241 |
+ if ( CurBuffy->next == NULL ) return; |
1317 |
+ break; |
2242 |
+ CurBuffy = CurBuffy->next; |
1318 |
+ case OP_SIDEBAR_SCROLL_DOWN: |
2243 |
+ break; |
1319 |
+ CurBuffy = BottomBuffy; |
2244 |
+ case OP_SIDEBAR_PREV: |
1320 |
+ if ( CurBuffy->next ) { |
2245 |
+ if ( CurBuffy->prev == NULL ) return; |
1321 |
+ calc_boundaries(menu); |
2246 |
+ CurBuffy = CurBuffy->prev; |
1322 |
+ CurBuffy = CurBuffy->next; |
2247 |
+ break; |
1323 |
+ } |
2248 |
+ case OP_SIDEBAR_SCROLL_UP: |
1324 |
+ break; |
2249 |
+ CurBuffy = TopBuffy; |
1325 |
+ default: |
2250 |
+ if ( CurBuffy != Incoming ) { |
1326 |
+ return; |
2251 |
+ calc_boundaries(menu); |
1327 |
+ } |
2252 |
+ CurBuffy = CurBuffy->prev; |
1328 |
+ calc_boundaries(menu); |
2253 |
+ } |
1329 |
+ draw_sidebar(menu); |
2254 |
+ break; |
1330 |
+} |
2255 |
+ case OP_SIDEBAR_SCROLL_DOWN: |
1331 |
+ |
2256 |
+ CurBuffy = BottomBuffy; |
1332 |
diff -uNp -r mutt-1.5.22.orig/sidebar.h mutt-1.5.22/sidebar.h |
2257 |
+ if ( CurBuffy->next ) { |
1333 |
--- mutt-1.5.22.orig/sidebar.h Thu Jan 1 01:00:00 1970 |
2258 |
+ calc_boundaries(menu); |
1334 |
+++ mutt-1.5.22/sidebar.h Fri Oct 18 10:18:45 2013 |
2259 |
+ CurBuffy = CurBuffy->next; |
1335 |
@@ -0,0 +1,36 @@ |
2260 |
+ } |
1336 |
+/* |
2261 |
+ break; |
1337 |
+ * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu> |
2262 |
+ default: |
1338 |
+ * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com> |
2263 |
+ return; |
1339 |
+ * |
2264 |
+ } |
1340 |
+ * This program is free software; you can redistribute it and/or modify |
2265 |
+ calc_boundaries(menu); |
1341 |
+ * it under the terms of the GNU General Public License as published by |
2266 |
+ draw_sidebar(menu); |
1342 |
+ * the Free Software Foundation; either version 2 of the License, or |
2267 |
+ } |
1343 |
+ * (at your option) any later version. |
2268 |
+ |
1344 |
+ * |
2269 |
*** mutt-1.5.23-orig/sidebar.h 1969-12-31 18:00:00.000000000 -0600 |
1345 |
+ * This program is distributed in the hope that it will be useful, |
2270 |
--- mutt-1.5.23/sidebar.h 2014-04-11 10:14:01.000000000 -0500 |
1346 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
2271 |
*************** |
1347 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2272 |
*** 0 **** |
1348 |
+ * GNU General Public License for more details. |
2273 |
--- 1,36 ---- |
1349 |
+ * |
2274 |
+ /* |
1350 |
+ * You should have received a copy of the GNU General Public License |
2275 |
+ * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu> |
1351 |
+ * along with this program; if not, write to the Free Software |
2276 |
+ * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com> |
1352 |
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. |
2277 |
+ * |
1353 |
+ */ |
2278 |
+ * This program is free software; you can redistribute it and/or modify |
1354 |
+ |
2279 |
+ * it under the terms of the GNU General Public License as published by |
1355 |
+#ifndef SIDEBAR_H |
2280 |
+ * the Free Software Foundation; either version 2 of the License, or |
1356 |
+#define SIDEBAR_H |
2281 |
+ * (at your option) any later version. |
1357 |
+ |
2282 |
+ * |
1358 |
+struct MBOX_LIST { |
2283 |
+ * This program is distributed in the hope that it will be useful, |
1359 |
+ char *path; |
2284 |
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1360 |
+ int msgcount; |
2285 |
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1361 |
+ int new; |
2286 |
+ * GNU General Public License for more details. |
1362 |
+} MBLIST; |
2287 |
+ * |
1363 |
+ |
2288 |
+ * You should have received a copy of the GNU General Public License |
1364 |
+/* parameter is whether or not to go to the status line */ |
2289 |
+ * along with this program; if not, write to the Free Software |
1365 |
+/* used for omitting the last | that covers up the status bar in the index */ |
2290 |
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. |
1366 |
+int draw_sidebar(int); |
2291 |
+ */ |
1367 |
+void scroll_sidebar(int, int); |
2292 |
+ |
1368 |
+void set_curbuffy(char*); |
2293 |
+ #ifndef SIDEBAR_H |
1369 |
+void set_buffystats(CONTEXT*); |
2294 |
+ #define SIDEBAR_H |
1370 |
+ |
2295 |
+ |
1371 |
+#endif /* SIDEBAR_H */ |
2296 |
+ struct MBOX_LIST { |
1372 |
--- orig/Makefile.am.orig 2010-09-18 13:23:19.000000000 +0200 |
2297 |
+ char *path; |
1373 |
+++ new/Makefile.am 2010-09-18 13:25:19.000000000 +0200 |
2298 |
+ int msgcount; |
1374 |
@@ -34,7 +34,7 @@ |
2299 |
+ int new; |
1375 |
score.c send.c sendlib.c signal.c sort.c \ |
2300 |
+ } MBLIST; |
1376 |
status.c system.c thread.c charset.c history.c lib.c \ |
2301 |
+ |
1377 |
muttlib.c editmsg.c mbyte.c \ |
2302 |
+ /* parameter is whether or not to go to the status line */ |
1378 |
- url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c |
2303 |
+ /* used for omitting the last | that covers up the status bar in the index */ |
1379 |
+ url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c sidebar.c |
2304 |
+ int draw_sidebar(int); |
1380 |
|
2305 |
+ void scroll_sidebar(int, int); |
1381 |
nodist_mutt_SOURCES = $(BUILT_SOURCES) |
2306 |
+ void set_curbuffy(char*); |
1382 |
|
2307 |
+ void set_buffystats(CONTEXT*); |
1383 |
--- orig/Makefile.in.orig 2013-10-25 08:23:07.000000000 +0200 |
2308 |
+ |
1384 |
+++ new/Makefile.in 2013-10-25 08:26:20.000000000 +0200 |
2309 |
+ #endif /* SIDEBAR_H */ |
1385 |
@@ -133,7 +133,7 @@ |
2310 |
*** mutt-1.5.23-orig/doc/Muttrc 2014-03-12 11:27:11.000000000 -0500 |
1386 |
system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \ |
2311 |
--- mutt-1.5.23/doc/Muttrc 2014-04-11 10:14:01.000000000 -0500 |
1387 |
history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \ |
|
|
1388 |
editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \ |
1389 |
- ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT) |
1390 |
+ ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT) sidebar.$(OBJEXT) |
1391 |
am__objects_1 = |
1392 |
am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \ |
1393 |
$(am__objects_1) |
1394 |
@@ -472,7 +472,7 @@ |
1395 |
score.c send.c sendlib.c signal.c sort.c \ |
1396 |
status.c system.c thread.c charset.c history.c lib.c \ |
1397 |
muttlib.c editmsg.c mbyte.c \ |
1398 |
- url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c |
1399 |
+ url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c sidebar.c |
1400 |
|
1401 |
nodist_mutt_SOURCES = $(BUILT_SOURCES) |
1402 |
mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \ |
1403 |
@@ -504,7 +504,7 @@ |
1404 |
README.SSL smime.h group.h \ |
1405 |
muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \ |
1406 |
ChangeLog mkchangelog.sh mutt_idna.h \ |
1407 |
- snprintf.c regex.c crypt-gpgme.h hcachever.sh.in \ |
1408 |
+ snprintf.c regex.c crypt-gpgme.h sidebar.h hcachever.sh.in \ |
1409 |
txt2c.c txt2c.sh version.sh check_sec.sh |
1410 |
|
1411 |
EXTRA_SCRIPTS = smime_keys |
1412 |
*** mutt-1.5.20-orig/doc/Muttrc 2009-06-14 13:53:24.000000000 -0500 |
1413 |
--- mutt-1.5.20-patched/doc/Muttrc 2009-06-19 22:07:04.000000000 -0500 |
1414 |
*************** |
2312 |
*************** |
1415 |
*** 657,662 **** |
2313 |
*** 657,662 **** |
1416 |
--- 657,682 ---- |
2314 |
--- 657,682 ---- |
Link Here
|
1440 |
# set crypt_autosign=no |
2338 |
# set crypt_autosign=no |
1441 |
# |
2339 |
# |
1442 |
# Name: crypt_autosign |
2340 |
# Name: crypt_autosign |
|
|
2341 |
*** mutt-1.5.23-orig/imap/imap.c 2014-03-12 11:03:45.000000000 -0500 |
2342 |
--- mutt-1.5.23/imap/imap.c 2014-04-11 10:14:01.000000000 -0500 |
2343 |
*************** |
2344 |
*** 1514,1520 **** |
2345 |
|
2346 |
imap_munge_mbox_name (munged, sizeof (munged), name); |
2347 |
snprintf (command, sizeof (command), |
2348 |
! "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT)", munged); |
2349 |
|
2350 |
if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0) |
2351 |
{ |
2352 |
--- 1514,1520 ---- |
2353 |
|
2354 |
imap_munge_mbox_name (munged, sizeof (munged), name); |
2355 |
snprintf (command, sizeof (command), |
2356 |
! "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT MESSAGES)", munged); |
2357 |
|
2358 |
if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0) |
2359 |
{ |
2360 |
*** mutt-1.5.23-orig/imap/command.c 2014-03-12 11:03:45.000000000 -0500 |
2361 |
--- mutt-1.5.23/imap/command.c 2014-04-11 10:14:01.000000000 -0500 |
2362 |
*************** |
2363 |
*** 1012,1017 **** |
2364 |
--- 1012,1024 ---- |
2365 |
opened */ |
2366 |
status->uidnext = oldun; |
2367 |
|
2368 |
+ /* Added to make the sidebar show the correct numbers */ |
2369 |
+ if (status->messages) |
2370 |
+ { |
2371 |
+ inc->msgcount = status->messages; |
2372 |
+ inc->msg_unread = status->unseen; |
2373 |
+ } |
2374 |
+ |
2375 |
FREE (&value); |
2376 |
return; |
2377 |
} |