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