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