mutt_1.5.19.bb : latest version of the mutt MTA with sidebar support
[vuplus_openembedded] / recipes / mutt / mutt-1.5.19 / patch-1.5.19.sidebar.20090522.txt
1 *** mutt-1.5.19-orig/buffy.c    2008-08-29 18:39:48.000000000 -0500
2 --- mutt-1.5.19-patched/buffy.c 2009-05-22 08:45:01.000000000 -0500
3 ***************
4 *** 259,265 ****
5     char path[_POSIX_PATH_MAX];
6     struct stat contex_sb;
7     time_t t;
8
9   #ifdef USE_IMAP
10     /* update postponed count as well, on force */
11     if (force)
12 --- 259,265 ----
13     char path[_POSIX_PATH_MAX];
14     struct stat contex_sb;
15     time_t t;
16 !   CONTEXT *ctx;
17   #ifdef USE_IMAP
18     /* update postponed count as well, on force */
19     if (force)
20 ***************
21 *** 294,299 ****
22 --- 294,301 ----
23     
24     for (tmp = Incoming; tmp; tmp = tmp->next)
25     {
26 +     if ( tmp->new == 1 )
27 +       tmp->has_new = 1;
28   #ifdef USE_IMAP
29       if (tmp->magic != M_IMAP)
30   #endif
31 ***************
32 *** 350,359 ****
33         case M_MBOX:
34         case M_MMDF:
35   
36 !       if (STAT_CHECK)
37         {
38 !         BuffyCount++;
39 !         tmp->new = 1;
40         }
41         else if (option(OPTCHECKMBOXSIZE))
42         {
43 --- 352,378 ----
44         case M_MBOX:
45         case M_MMDF:
46   
47 !         {
48 !       if (STAT_CHECK || tmp->msgcount == 0)
49         {
50 !         BUFFY b = *tmp;
51 !         int msgcount = 0;
52 !         int msg_unread = 0;
53 !         /* parse the mailbox, to see how much mail there is */
54 !         ctx = mx_open_mailbox( tmp->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL);
55 !         if(ctx)
56 !         {
57 !             msgcount = ctx->msgcount;
58 !           msg_unread = ctx->unread;
59 !           mx_close_mailbox(ctx, 0);
60 !         }
61 !         *tmp = b;
62 !         tmp->msgcount = msgcount;
63 !         tmp->msg_unread = msg_unread;
64 !         if(STAT_CHECK) {
65 !           tmp->has_new = tmp->new = 1;
66 !           BuffyCount++;
67 !           }  
68         }
69         else if (option(OPTCHECKMBOXSIZE))
70         {
71 ***************
72 *** 363,397 ****
73         if (tmp->newly_created &&
74             (sb.st_ctime != sb.st_mtime || sb.st_ctime != sb.st_atime))
75           tmp->newly_created = 0;
76
77         break;
78   
79         case M_MAILDIR:
80   
81         snprintf (path, sizeof (path), "%s/new", tmp->path);
82         if ((dirp = opendir (path)) == NULL)
83         {
84           tmp->magic = 0;
85           break;
86         }
87         while ((de = readdir (dirp)) != NULL)
88         {
89           char *p;
90           if (*de->d_name != '.' && 
91               (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')))
92           {
93 !           /* one new and undeleted message is enough */
94 !           BuffyCount++;
95 !           tmp->new = 1;
96 !           break;
97           }
98         }
99         closedir (dirp);
100         break;
101   
102         case M_MH:
103         if ((tmp->new = mh_buffy (tmp->path)) > 0)
104           BuffyCount++;
105         break;
106         }
107       }
108 --- 382,467 ----
109         if (tmp->newly_created &&
110             (sb.st_ctime != sb.st_mtime || sb.st_ctime != sb.st_atime))
111           tmp->newly_created = 0;
112 !         }
113         break;
114   
115         case M_MAILDIR:
116   
117 +         /* count new message */
118         snprintf (path, sizeof (path), "%s/new", tmp->path);
119         if ((dirp = opendir (path)) == NULL)
120         {
121           tmp->magic = 0;
122           break;
123         }
124 +       tmp->msgcount = 0;
125 +       tmp->msg_unread = 0;
126 +       tmp->msg_flagged = 0;
127         while ((de = readdir (dirp)) != NULL)
128         {
129           char *p;
130           if (*de->d_name != '.' && 
131               (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')))
132           {
133 !           tmp->has_new = tmp->new = 1;
134 !             tmp->msgcount++;
135 !             tmp->msg_unread++;
136 !         }
137 !       }
138 !         if(tmp->msg_unread)
139 !           BuffyCount++;
140 !  
141 !       closedir (dirp);
142 !  
143 !         /*
144 !          * count read messages (for folderlist (sidebar) we also need to count
145 !          * messages in cur so that we the total number of messages
146 !          */
147 !       snprintf (path, sizeof (path), "%s/cur", tmp->path);
148 !       if ((dirp = opendir (path)) == NULL)
149 !       {
150 !         tmp->magic = 0;
151 !         break;
152 !       }
153 !       while ((de = readdir (dirp)) != NULL)
154 !       {
155 !         char *p;
156 !           if (*de->d_name != '.') {
157 !                   if ((p = strstr (de->d_name, ":2,"))) {
158 !                           if (!strchr (p + 3, 'T')) {
159 !                                   tmp->msgcount++;
160 !                                   if ( !strchr (p + 3, 'S'))
161 !                                           tmp->msg_unread++;
162 !                                   if (strchr(p + 3, 'F'))
163 !                                           tmp->msg_flagged++;
164 !                           }
165 !                   } else
166 !                           tmp->msgcount++;
167           }
168         }
169         closedir (dirp);
170         break;
171   
172         case M_MH:
173 +       {
174 +       DIR *dp;
175 +       struct dirent *de;
176         if ((tmp->new = mh_buffy (tmp->path)) > 0)
177           BuffyCount++;
178 +     
179 +       if ((dp = opendir (path)) == NULL)
180 +         break;
181 +       tmp->msgcount = 0;
182 +       while ((de = readdir (dp)))
183 +       {
184 +         if (mh_valid_message (de->d_name))
185 +         {
186 +         tmp->msgcount++;
187 +         tmp->has_new = tmp->new = 1;
188 +         }
189 +       }
190 +       closedir (dp);
191 +       }
192         break;
193         }
194       }
195 *** mutt-1.5.19-orig/buffy.h    2008-05-22 13:25:19.000000000 -0500
196 --- mutt-1.5.19-patched/buffy.h 2009-05-21 23:08:38.000000000 -0500
197 ***************
198 *** 25,31 ****
199 --- 25,36 ----
200     char *path;
201     off_t size;
202     struct buffy_t *next;
203 +   struct buffy_t *prev;
204     short new;                  /* mailbox has new mail */
205 +   short has_new;              /* set it new if new and not read */
206 +   int msgcount;                       /* total number of messages */
207 +   int msg_unread;             /* number of unread messages */
208 +   int msg_flagged;            /* number of flagged messages */
209     short notified;             /* user has been notified */
210     short magic;                        /* mailbox type */
211     short newly_created;                /* mbox or mmdf just popped into existence */
212 *** mutt-1.5.19-orig/color.c    2008-03-19 15:07:57.000000000 -0500
213 --- mutt-1.5.19-patched/color.c 2009-05-21 23:08:38.000000000 -0500
214 ***************
215 *** 93,98 ****
216 --- 93,100 ----
217     { "bold",           MT_COLOR_BOLD },
218     { "underline",      MT_COLOR_UNDERLINE },
219     { "index",          MT_COLOR_INDEX },
220 +   { "sidebar_new",    MT_COLOR_NEW },
221 +   { "sidebar_flagged",        MT_COLOR_FLAGGED },
222     { NULL,             0 }
223   };
224   
225 *** mutt-1.5.19-orig/compose.c  2009-01-05 13:20:53.000000000 -0600
226 --- mutt-1.5.19-patched/compose.c       2009-05-21 23:08:38.000000000 -0500
227 ***************
228 *** 72,78 ****
229   
230   #define HDR_XOFFSET 10
231   #define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
232 ! #define W (COLS - HDR_XOFFSET)
233   
234   static char *Prompts[] =
235   {
236 --- 72,78 ----
237   
238   #define HDR_XOFFSET 10
239   #define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
240 ! #define W (COLS - HDR_XOFFSET - SidebarWidth)
241   
242   static char *Prompts[] =
243   {
244 ***************
245 *** 115,130 ****
246     if ((WithCrypto & APPLICATION_PGP) && (WithCrypto & APPLICATION_SMIME))
247     {     
248       if (!msg->security)
249 !       mvaddstr (HDR_CRYPT, 0,     "Security: ");
250       else if (msg->security & APPLICATION_SMIME)
251 !       mvaddstr (HDR_CRYPT, 0,     "  S/MIME: ");
252       else if (msg->security & APPLICATION_PGP)
253 !       mvaddstr (HDR_CRYPT, 0,     "     PGP: ");
254     }
255     else if ((WithCrypto & APPLICATION_SMIME))
256 !     mvaddstr (HDR_CRYPT, 0,     "  S/MIME: ");
257     else if ((WithCrypto & APPLICATION_PGP))
258 !     mvaddstr (HDR_CRYPT, 0,     "     PGP: ");
259     else
260       return;
261   
262 --- 115,130 ----
263     if ((WithCrypto & APPLICATION_PGP) && (WithCrypto & APPLICATION_SMIME))
264     {     
265       if (!msg->security)
266 !       mvaddstr (HDR_CRYPT, SidebarWidth,     "Security: ");
267       else if (msg->security & APPLICATION_SMIME)
268 !       mvaddstr (HDR_CRYPT, SidebarWidth,     "  S/MIME: ");
269       else if (msg->security & APPLICATION_PGP)
270 !       mvaddstr (HDR_CRYPT, SidebarWidth,     "     PGP: ");
271     }
272     else if ((WithCrypto & APPLICATION_SMIME))
273 !     mvaddstr (HDR_CRYPT, SidebarWidth,     "  S/MIME: ");
274     else if ((WithCrypto & APPLICATION_PGP))
275 !     mvaddstr (HDR_CRYPT, SidebarWidth,     "     PGP: ");
276     else
277       return;
278   
279 ***************
280 *** 148,154 ****
281       }
282     clrtoeol ();
283   
284 !   move (HDR_CRYPTINFO, 0);
285     clrtoeol ();
286     if ((WithCrypto & APPLICATION_PGP)
287         && msg->security & APPLICATION_PGP  && msg->security & SIGN)
288 --- 148,154 ----
289       }
290     clrtoeol ();
291   
292 !   move (HDR_CRYPTINFO, SidebarWidth);
293     clrtoeol ();
294     if ((WithCrypto & APPLICATION_PGP)
295         && msg->security & APPLICATION_PGP  && msg->security & SIGN)
296 ***************
297 *** 164,170 ****
298         && (msg->security & ENCRYPT)
299         && SmimeCryptAlg
300         && *SmimeCryptAlg) {
301 !       mvprintw (HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "),
302                 NONULL(SmimeCryptAlg));
303         off = 20;
304     }
305 --- 164,170 ----
306         && (msg->security & ENCRYPT)
307         && SmimeCryptAlg
308         && *SmimeCryptAlg) {
309 !       mvprintw (HDR_CRYPTINFO, SidebarWidth + 40, "%s%s", _("Encrypt with: "),
310                 NONULL(SmimeCryptAlg));
311         off = 20;
312     }
313 ***************
314 *** 178,184 ****
315     int c;
316     char *t;
317   
318 !   mvaddstr (HDR_MIX, 0,     "     Mix: ");
319   
320     if (!chain)
321     {
322 --- 178,184 ----
323     int c;
324     char *t;
325   
326 !   mvaddstr (HDR_MIX, SidebarWidth,     "     Mix: ");
327   
328     if (!chain)
329     {
330 ***************
331 *** 193,199 ****
332       if (t && t[0] == '0' && t[1] == '\0')
333         t = "<random>";
334       
335 !     if (c + mutt_strlen (t) + 2 >= COLS)
336         break;
337   
338       addstr (NONULL(t));
339 --- 193,199 ----
340       if (t && t[0] == '0' && t[1] == '\0')
341         t = "<random>";
342       
343 !     if (c + mutt_strlen (t) + 2 >= COLS - SidebarWidth)
344         break;
345   
346       addstr (NONULL(t));
347 ***************
348 *** 245,251 ****
349   
350     buf[0] = 0;
351     rfc822_write_address (buf, sizeof (buf), addr, 1);
352 !   mvprintw (line, 0, TITLE_FMT, Prompts[line - 1]);
353     mutt_paddstr (W, buf);
354   }
355   
356 --- 245,251 ----
357   
358     buf[0] = 0;
359     rfc822_write_address (buf, sizeof (buf), addr, 1);
360 !   mvprintw (line, SidebarWidth, TITLE_FMT, Prompts[line - 1]);
361     mutt_paddstr (W, buf);
362   }
363   
364 ***************
365 *** 255,264 ****
366     draw_envelope_addr (HDR_TO, msg->env->to);
367     draw_envelope_addr (HDR_CC, msg->env->cc);
368     draw_envelope_addr (HDR_BCC, msg->env->bcc);
369 !   mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
370     mutt_paddstr (W, NONULL (msg->env->subject));
371     draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
372 !   mvprintw (HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]);
373     mutt_paddstr (W, fcc);
374   
375     if (WithCrypto)
376 --- 255,264 ----
377     draw_envelope_addr (HDR_TO, msg->env->to);
378     draw_envelope_addr (HDR_CC, msg->env->cc);
379     draw_envelope_addr (HDR_BCC, msg->env->bcc);
380 !   mvprintw (HDR_SUBJECT, SidebarWidth, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
381     mutt_paddstr (W, NONULL (msg->env->subject));
382     draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
383 !   mvprintw (HDR_FCC, SidebarWidth, TITLE_FMT, Prompts[HDR_FCC - 1]);
384     mutt_paddstr (W, fcc);
385   
386     if (WithCrypto)
387 ***************
388 *** 269,275 ****
389   #endif
390   
391     SETCOLOR (MT_COLOR_STATUS);
392 !   mvaddstr (HDR_ATTACH - 1, 0, _("-- Attachments"));
393     BKGDSET (MT_COLOR_STATUS);
394     clrtoeol ();
395   
396 --- 269,275 ----
397   #endif
398   
399     SETCOLOR (MT_COLOR_STATUS);
400 !   mvaddstr (HDR_ATTACH - 1, SidebarWidth, _("-- Attachments"));
401     BKGDSET (MT_COLOR_STATUS);
402     clrtoeol ();
403   
404 ***************
405 *** 307,313 ****
406     /* redraw the expanded list so the user can see the result */
407     buf[0] = 0;
408     rfc822_write_address (buf, sizeof (buf), *addr, 1);
409 !   move (line, HDR_XOFFSET);
410     mutt_paddstr (W, buf);
411     
412     return 0;
413 --- 307,313 ----
414     /* redraw the expanded list so the user can see the result */
415     buf[0] = 0;
416     rfc822_write_address (buf, sizeof (buf), *addr, 1);
417 !   move (line, HDR_XOFFSET+SidebarWidth);
418     mutt_paddstr (W, buf);
419     
420     return 0;
421 ***************
422 *** 552,558 ****
423         if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
424         {
425           mutt_str_replace (&msg->env->subject, buf);
426 !         move (HDR_SUBJECT, HDR_XOFFSET);
427           clrtoeol ();
428           if (msg->env->subject)
429             mutt_paddstr (W, msg->env->subject);
430 --- 552,558 ----
431         if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
432         {
433           mutt_str_replace (&msg->env->subject, buf);
434 !         move (HDR_SUBJECT, HDR_XOFFSET + SidebarWidth);
435           clrtoeol ();
436           if (msg->env->subject)
437             mutt_paddstr (W, msg->env->subject);
438 ***************
439 *** 569,575 ****
440         {
441           strfcpy (fcc, buf, fcclen);
442           mutt_pretty_mailbox (fcc, fcclen);
443 !         move (HDR_FCC, HDR_XOFFSET);
444           mutt_paddstr (W, fcc);
445           fccSet = 1;
446         }
447 --- 569,575 ----
448         {
449           strfcpy (fcc, buf, fcclen);
450           mutt_pretty_mailbox (fcc, fcclen);
451 !         move (HDR_FCC, HDR_XOFFSET + SidebarWidth);
452           mutt_paddstr (W, fcc);
453           fccSet = 1;
454         }
455 *** mutt-1.5.19-orig/curs_main.c        2009-01-05 13:20:53.000000000 -0600
456 --- mutt-1.5.19-patched/curs_main.c     2009-05-21 23:08:38.000000000 -0500
457 ***************
458 *** 26,32 ****
459 --- 26,34 ----
460   #include "mailbox.h"
461   #include "mapping.h"
462   #include "sort.h"
463 + #include "buffy.h"
464   #include "mx.h"
465 + #include "sidebar.h"
466   
467   #ifdef USE_POP
468   #include "pop.h"
469 ***************
470 *** 523,530 ****
471          menu->redraw |= REDRAW_STATUS;
472        if (do_buffy_notify)
473        {
474 !        if (mutt_buffy_notify () && option (OPTBEEPNEW))
475 !       beep ();
476        }
477        else
478          do_buffy_notify = 1;
479 --- 525,536 ----
480          menu->redraw |= REDRAW_STATUS;
481        if (do_buffy_notify)
482        {
483 !        if (mutt_buffy_notify ())
484 !        {
485 !          menu->redraw |= REDRAW_FULL;
486 !          if (option (OPTBEEPNEW))
487 !            beep ();
488 !        }
489        }
490        else
491          do_buffy_notify = 1;
492 ***************
493 *** 536,541 ****
494 --- 542,548 ----
495       if (menu->redraw & REDRAW_FULL)
496       {
497         menu_redraw_full (menu);
498 +       draw_sidebar(menu->menu);
499         mutt_show_error ();
500       }
501   
502 ***************
503 *** 558,567 ****
504 --- 565,577 ----
505   
506         if (menu->redraw & REDRAW_STATUS) 
507         {
508 +         DrawFullLine = 1;
509         menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
510 +         DrawFullLine = 0;
511         CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES-2);
512         SETCOLOR (MT_COLOR_STATUS);
513           BKGDSET (MT_COLOR_STATUS);
514 +         set_buffystats(Context);
515         mutt_paddstr (COLS, buf);
516         SETCOLOR (MT_COLOR_NORMAL);
517           BKGDSET (MT_COLOR_NORMAL);
518 ***************
519 *** 575,581 ****
520         menu->oldcurrent = -1;
521   
522         if (option (OPTARROWCURSOR))
523 !       move (menu->current - menu->top + menu->offset, 2);
524         else if (option (OPTBRAILLEFRIENDLY))
525         move (menu->current - menu->top + menu->offset, 0);
526         else
527 --- 585,591 ----
528         menu->oldcurrent = -1;
529   
530         if (option (OPTARROWCURSOR))
531 !       move (menu->current - menu->top + menu->offset, SidebarWidth + 2);
532         else if (option (OPTBRAILLEFRIENDLY))
533         move (menu->current - menu->top + menu->offset, 0);
534         else
535 ***************
536 *** 1048,1053 ****
537 --- 1058,1064 ----
538           menu->redraw = REDRAW_FULL;
539         break;
540   
541 +       case OP_SIDEBAR_OPEN:
542         case OP_MAIN_CHANGE_FOLDER:
543         case OP_MAIN_NEXT_UNREAD_MAILBOX:
544         
545 ***************
546 *** 1079,1085 ****
547         {
548           mutt_buffy (buf, sizeof (buf));
549   
550 !         if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
551           {
552             if (menu->menu == MENU_PAGER)
553             {
554 --- 1090,1100 ----
555         {
556           mutt_buffy (buf, sizeof (buf));
557   
558 !           if ( op == OP_SIDEBAR_OPEN ) {
559 !               if(!CurBuffy)
560 !                 break;
561 !             strncpy( buf, CurBuffy->path, sizeof(buf) );  
562 !           } else if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
563           {
564             if (menu->menu == MENU_PAGER)
565             {
566 ***************
567 *** 1097,1102 ****
568 --- 1112,1118 ----
569         }
570   
571         mutt_expand_path (buf, sizeof (buf));
572 +         set_curbuffy(buf);
573         if (mx_get_magic (buf) <= 0)
574         {
575           mutt_error (_("%s is not a mailbox."), buf);
576 ***************
577 *** 2176,2181 ****
578 --- 2192,2203 ----
579         mutt_what_key();
580         break;
581   
582 +       case OP_SIDEBAR_SCROLL_UP:
583 +       case OP_SIDEBAR_SCROLL_DOWN:
584 +       case OP_SIDEBAR_NEXT:
585 +       case OP_SIDEBAR_PREV:
586 +         scroll_sidebar(op, menu->menu);
587 +         break;
588         default:
589         if (menu->menu == MENU_MAIN)
590           km_error_key (MENU_MAIN);
591 *** mutt-1.5.19-orig/flags.c    2009-01-03 17:27:10.000000000 -0600
592 --- mutt-1.5.19-patched/flags.c 2009-05-21 23:08:38.000000000 -0500
593 ***************
594 *** 22,29 ****
595 --- 22,31 ----
596   
597   #include "mutt.h"
598   #include "mutt_curses.h"
599 + #include "mutt_menu.h"
600   #include "sort.h"
601   #include "mx.h"
602 + #include "sidebar.h"
603   
604   void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
605   {
606 ***************
607 *** 263,268 ****
608 --- 265,271 ----
609      */
610     if (h->searched && (changed != h->changed || deleted != ctx->deleted || tagged != ctx->tagged || flagged != ctx->flagged))
611       h->searched = 0;
612 +       draw_sidebar(0);
613   }
614   
615   void mutt_tag_set_flag (int flag, int bf)
616 *** mutt-1.5.19-orig/functions.h        2009-01-05 13:20:53.000000000 -0600
617 --- mutt-1.5.19-patched/functions.h     2009-05-21 23:08:38.000000000 -0500
618 ***************
619 *** 168,173 ****
620 --- 168,178 ----
621     { "decrypt-save",           OP_DECRYPT_SAVE,                NULL },
622   
623   
624 +  { "sidebar-scroll-up",       OP_SIDEBAR_SCROLL_UP, NULL },
625 +  { "sidebar-scroll-down",     OP_SIDEBAR_SCROLL_DOWN, NULL },
626 +  { "sidebar-next",            OP_SIDEBAR_NEXT, NULL },
627 +  { "sidebar-prev",            OP_SIDEBAR_PREV, NULL },
628 +  { "sidebar-open",            OP_SIDEBAR_OPEN, NULL },
629     { NULL,                     0,                              NULL }
630   };
631   
632 ***************
633 *** 266,271 ****
634 --- 271,281 ----
635   
636     { "what-key",               OP_WHAT_KEY,            NULL },
637   
638 +   { "sidebar-scroll-up",      OP_SIDEBAR_SCROLL_UP, NULL },
639 +   { "sidebar-scroll-down",    OP_SIDEBAR_SCROLL_DOWN, NULL },
640 +   { "sidebar-next",   OP_SIDEBAR_NEXT, NULL },
641 +   { "sidebar-prev",   OP_SIDEBAR_PREV, NULL },
642 +   { "sidebar-open", OP_SIDEBAR_OPEN, NULL },
643     { NULL,             0,                              NULL }
644   };
645   
646 *** mutt-1.5.19-orig/globals.h  2009-01-03 17:27:10.000000000 -0600
647 --- mutt-1.5.19-patched/globals.h       2009-05-21 23:08:38.000000000 -0500
648 ***************
649 *** 116,121 ****
650 --- 116,122 ----
651   WHERE char *SendCharset;
652   WHERE char *Sendmail;
653   WHERE char *Shell;
654 + WHERE char *SidebarDelim;
655   WHERE char *Signature;
656   WHERE char *SimpleSearch;
657   #if USE_SMTP
658 ***************
659 *** 205,210 ****
660 --- 206,214 ----
661   WHERE short ScoreThresholdRead;
662   WHERE short ScoreThresholdFlag;
663   
664 + WHERE struct buffy_t *CurBuffy INITVAL(0);
665 + WHERE short DrawFullLine INITVAL(0);
666 + WHERE short SidebarWidth;
667   #ifdef USE_IMAP
668   WHERE short ImapKeepalive;
669   WHERE short ImapPipelineDepth;
670 *** mutt-1.5.19-orig/init.h     2009-01-05 13:20:53.000000000 -0600
671 --- mutt-1.5.19-patched/init.h  2009-05-21 23:08:38.000000000 -0500
672 ***************
673 *** 1572,1577 ****
674 --- 1572,1593 ----
675     ** you may \fIunset\fP this setting.
676     ** (Crypto only)
677     */
678 +   {"sidebar_delim", DT_STR, R_BOTH, UL &SidebarDelim, "|"},
679 +   /*
680 +   ** .pp
681 +   ** This specifies the delimiter between the sidebar (if visible) and 
682 +   ** other screens.
683 +   */
684 +   { "sidebar_visible", DT_BOOL, R_BOTH, OPTSIDEBAR, 0 },
685 +   /*
686 +   ** .pp
687 +   ** This specifies whether or not to show sidebar (left-side list of folders).
688 +   */
689 +   { "sidebar_width", DT_NUM, R_BOTH, UL &SidebarWidth, 0 },
690 +   /*
691 +   ** .pp
692 +   ** The width of the sidebar.
693 +   */
694     { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0},
695     /*
696     ** .pp
697 *** mutt-1.5.19-orig/mailbox.h  2008-03-19 15:07:06.000000000 -0500
698 --- mutt-1.5.19-patched/mailbox.h       2009-05-21 23:08:38.000000000 -0500
699 ***************
700 *** 27,32 ****
701 --- 27,33 ----
702   #define M_NEWFOLDER   (1<<4) /* create a new folder - same as M_APPEND, but uses
703                                 * safe_fopen() for mbox-style folders.
704                                 */
705 + #define M_PEEK                (1<<5) /* revert atime back after taking a look (if applicable) */
706   
707   /* mx_open_new_message() */
708   #define M_ADD_FROM    1       /* add a From_ line */
709 *** mutt-1.5.19-orig/Makefile.am        2009-01-05 13:20:53.000000000 -0600
710 --- mutt-1.5.19-patched/Makefile.am     2009-05-21 23:08:38.000000000 -0500
711 ***************
712 *** 29,35 ****
713         score.c send.c sendlib.c signal.c sort.c \
714         status.c system.c thread.c charset.c history.c lib.c \
715         muttlib.c editmsg.c mbyte.c \
716 !       url.c ascii.c crypt-mod.c crypt-mod.h
717   
718   nodist_mutt_SOURCES = $(BUILT_SOURCES)
719   
720 --- 29,36 ----
721         score.c send.c sendlib.c signal.c sort.c \
722         status.c system.c thread.c charset.c history.c lib.c \
723         muttlib.c editmsg.c mbyte.c \
724 !       url.c ascii.c crypt-mod.c crypt-mod.h \
725 !         sidebar.c
726   
727   nodist_mutt_SOURCES = $(BUILT_SOURCES)
728   
729 *** mutt-1.5.19-orig/Makefile.in        2009-01-05 13:24:13.000000000 -0600
730 --- mutt-1.5.19-patched/Makefile.in     2009-05-21 23:08:38.000000000 -0500
731 ***************
732 *** 83,89 ****
733         system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
734         history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
735         editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \
736 !       ascii.$(OBJEXT) crypt-mod.$(OBJEXT)
737   am__objects_1 = patchlist.$(OBJEXT)
738   nodist_mutt_OBJECTS = $(am__objects_1)
739   mutt_OBJECTS = $(am_mutt_OBJECTS) $(nodist_mutt_OBJECTS)
740 --- 83,90 ----
741         system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
742         history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
743         editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \
744 !       ascii.$(OBJEXT) crypt-mod.$(OBJEXT) \
745 !       sidebar.$(OBJEXT)
746   am__objects_1 = patchlist.$(OBJEXT)
747   nodist_mutt_OBJECTS = $(am__objects_1)
748   mutt_OBJECTS = $(am_mutt_OBJECTS) $(nodist_mutt_OBJECTS)
749 ***************
750 *** 307,313 ****
751         score.c send.c sendlib.c signal.c sort.c \
752         status.c system.c thread.c charset.c history.c lib.c \
753         muttlib.c editmsg.c mbyte.c \
754 !       url.c ascii.c crypt-mod.c crypt-mod.h
755   
756   nodist_mutt_SOURCES = $(BUILT_SOURCES)
757   mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
758 --- 308,315 ----
759         score.c send.c sendlib.c signal.c sort.c \
760         status.c system.c thread.c charset.c history.c lib.c \
761         muttlib.c editmsg.c mbyte.c \
762 !       url.c ascii.c crypt-mod.c crypt-mod.h \
763 !       sidebar.c
764   
765   nodist_mutt_SOURCES = $(BUILT_SOURCES)
766   mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
767 ***************
768 *** 339,345 ****
769         README.SSL smime.h \
770         muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
771         ChangeLog mkchangelog.sh mutt_idna.h \
772 !       snprintf.c regex.c crypt-gpgme.h hcachever.sh.in
773   
774   EXTRA_SCRIPTS = smime_keys
775   mutt_dotlock_SOURCES = mutt_dotlock.c
776 --- 341,347 ----
777         README.SSL smime.h \
778         muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
779         ChangeLog mkchangelog.sh mutt_idna.h \
780 !       snprintf.c regex.c crypt-gpgme.h sidebar.h hcachever.sh.in
781   
782   EXTRA_SCRIPTS = smime_keys
783   mutt_dotlock_SOURCES = mutt_dotlock.c
784 *** mutt-1.5.19-orig/mbox.c     2008-08-15 13:30:12.000000000 -0500
785 --- mutt-1.5.19-patched/mbox.c  2009-05-21 23:08:38.000000000 -0500
786 ***************
787 *** 100,105 ****
788 --- 100,106 ----
789       mutt_perror (ctx->path);
790       return (-1);
791     }
792 +   ctx->atime = sb.st_atime;
793     ctx->mtime = sb.st_mtime;
794     ctx->size = sb.st_size;
795   
796 ***************
797 *** 255,260 ****
798 --- 256,262 ----
799   
800     ctx->size = sb.st_size;
801     ctx->mtime = sb.st_mtime;
802 +   ctx->atime = sb.st_atime;
803   
804   #ifdef NFS_ATTRIBUTE_HACK
805     if (sb.st_mtime > sb.st_atime)
806 *** mutt-1.5.19-orig/menu.c     2009-01-05 13:20:53.000000000 -0600
807 --- mutt-1.5.19-patched/menu.c  2009-05-21 23:08:38.000000000 -0500
808 ***************
809 *** 24,29 ****
810 --- 24,30 ----
811   #include "mutt_curses.h"
812   #include "mutt_menu.h"
813   #include "mbyte.h"
814 + #include "sidebar.h"
815   
816   #include <string.h>
817   #include <stdlib.h>
818 ***************
819 *** 156,162 ****
820   {
821     char *scratch = safe_strdup (s);
822     int shift = option (OPTARROWCURSOR) ? 3 : 0;
823 !   int cols = COLS - shift;
824   
825     mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1);
826     s[n - 1] = 0;
827 --- 157,163 ----
828   {
829     char *scratch = safe_strdup (s);
830     int shift = option (OPTARROWCURSOR) ? 3 : 0;
831 !   int cols = COLS - shift - SidebarWidth;
832   
833     mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1);
834     s[n - 1] = 0;
835 ***************
836 *** 207,212 ****
837 --- 208,214 ----
838     char buf[LONG_STRING];
839     int i;
840   
841 +   draw_sidebar(1);
842     for (i = menu->top; i < menu->top + menu->pagelen; i++)
843     {
844       if (i < menu->max)
845 ***************
846 *** 217,223 ****
847         if (option (OPTARROWCURSOR))
848         {
849           attrset (menu->color (i));
850 !       CLEARLINE (i - menu->top + menu->offset);
851   
852         if (i == menu->current)
853         {
854 --- 219,225 ----
855         if (option (OPTARROWCURSOR))
856         {
857           attrset (menu->color (i));
858 !       CLEARLINE_WIN (i - menu->top + menu->offset);
859   
860         if (i == menu->current)
861         {
862 ***************
863 *** 246,259 ****
864           BKGDSET (MT_COLOR_INDICATOR);
865         }
866   
867 !       CLEARLINE (i - menu->top + menu->offset);
868         print_enriched_string (menu->color(i), (unsigned char *) buf, i != menu->current);
869           SETCOLOR (MT_COLOR_NORMAL);
870           BKGDSET (MT_COLOR_NORMAL);
871         }
872       }
873       else
874 !       CLEARLINE (i - menu->top + menu->offset);
875     }
876     menu->redraw = 0;
877   }
878 --- 248,261 ----
879           BKGDSET (MT_COLOR_INDICATOR);
880         }
881   
882 !       CLEARLINE_WIN (i - menu->top + menu->offset);
883         print_enriched_string (menu->color(i), (unsigned char *) buf, i != menu->current);
884           SETCOLOR (MT_COLOR_NORMAL);
885           BKGDSET (MT_COLOR_NORMAL);
886         }
887       }
888       else
889 !       CLEARLINE_WIN (i - menu->top + menu->offset);
890     }
891     menu->redraw = 0;
892   }
893 ***************
894 *** 268,274 ****
895       return;
896     }
897     
898 !   move (menu->oldcurrent + menu->offset - menu->top, 0);
899     SETCOLOR (MT_COLOR_NORMAL);
900     BKGDSET (MT_COLOR_NORMAL);
901   
902 --- 270,276 ----
903       return;
904     }
905     
906 !   move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth);
907     SETCOLOR (MT_COLOR_NORMAL);
908     BKGDSET (MT_COLOR_NORMAL);
909   
910 ***************
911 *** 283,295 ****
912         clrtoeol ();
913         menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
914         menu_pad_string (buf, sizeof (buf));
915 !       move (menu->oldcurrent + menu->offset - menu->top, 3);
916         print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
917         SETCOLOR (MT_COLOR_NORMAL);
918       }
919   
920       /* now draw it in the new location */
921 !     move (menu->current + menu->offset - menu->top, 0);
922       attrset (menu->color (menu->current));
923       ADDCOLOR (MT_COLOR_INDICATOR);
924       addstr ("->");
925 --- 285,297 ----
926         clrtoeol ();
927         menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
928         menu_pad_string (buf, sizeof (buf));
929 !       move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth + 3);
930         print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
931         SETCOLOR (MT_COLOR_NORMAL);
932       }
933   
934       /* now draw it in the new location */
935 !     move (menu->current + menu->offset - menu->top, SidebarWidth);
936       attrset (menu->color (menu->current));
937       ADDCOLOR (MT_COLOR_INDICATOR);
938       addstr ("->");
939 ***************
940 *** 310,316 ****
941       attrset (menu->color (menu->current));
942       ADDCOLOR (MT_COLOR_INDICATOR);
943       BKGDSET (MT_COLOR_INDICATOR);
944 !     CLEARLINE (menu->current - menu->top + menu->offset);
945       print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
946       SETCOLOR (MT_COLOR_NORMAL);
947       BKGDSET (MT_COLOR_NORMAL);
948 --- 312,318 ----
949       attrset (menu->color (menu->current));
950       ADDCOLOR (MT_COLOR_INDICATOR);
951       BKGDSET (MT_COLOR_INDICATOR);
952 !     CLEARLINE_WIN (menu->current - menu->top + menu->offset);
953       print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
954       SETCOLOR (MT_COLOR_NORMAL);
955       BKGDSET (MT_COLOR_NORMAL);
956 ***************
957 *** 322,328 ****
958   {
959     char buf[LONG_STRING];
960     
961 !   move (menu->current + menu->offset - menu->top, 0);
962     menu_make_entry (buf, sizeof (buf), menu, menu->current);
963     menu_pad_string (buf, sizeof (buf));
964   
965 --- 324,330 ----
966   {
967     char buf[LONG_STRING];
968     
969 !   move (menu->current + menu->offset - menu->top, SidebarWidth);
970     menu_make_entry (buf, sizeof (buf), menu, menu->current);
971     menu_pad_string (buf, sizeof (buf));
972   
973 ***************
974 *** 882,888 ****
975       
976       
977       if (option (OPTARROWCURSOR))
978 !       move (menu->current - menu->top + menu->offset, 2);
979       else if (option (OPTBRAILLEFRIENDLY))
980         move (menu->current - menu->top + menu->offset, 0);
981       else
982 --- 884,890 ----
983       
984       
985       if (option (OPTARROWCURSOR))
986 !       move (menu->current - menu->top + menu->offset, SidebarWidth + 2);
987       else if (option (OPTBRAILLEFRIENDLY))
988         move (menu->current - menu->top + menu->offset, 0);
989       else
990 *** mutt-1.5.19-orig/mutt_curses.h      2008-03-19 15:07:57.000000000 -0500
991 --- mutt-1.5.19-patched/mutt_curses.h   2009-05-21 23:08:38.000000000 -0500
992 ***************
993 *** 64,69 ****
994 --- 64,70 ----
995   #undef lines
996   #endif /* lines */
997   
998 + #define CLEARLINE_WIN(x) move(x,SidebarWidth), clrtoeol()
999   #define CLEARLINE(x) move(x,0), clrtoeol()
1000   #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
1001   #define BEEP() do { if (option (OPTBEEP)) beep(); } while (0)
1002 ***************
1003 *** 126,131 ****
1004 --- 127,134 ----
1005     MT_COLOR_BOLD,
1006     MT_COLOR_UNDERLINE,
1007     MT_COLOR_INDEX,
1008 +   MT_COLOR_NEW,
1009 +   MT_COLOR_FLAGGED,
1010     MT_COLOR_MAX
1011   };
1012   
1013 *** mutt-1.5.19-orig/mutt.h     2008-09-25 17:00:03.000000000 -0500
1014 --- mutt-1.5.19-patched/mutt.h  2009-05-21 23:08:38.000000000 -0500
1015 ***************
1016 *** 409,414 ****
1017 --- 409,415 ----
1018     OPTSAVEEMPTY,
1019     OPTSAVENAME,
1020     OPTSCORE,
1021 +   OPTSIDEBAR,
1022     OPTSIGDASHES,
1023     OPTSIGONTOP,
1024     OPTSORTRE,
1025 ***************
1026 *** 843,848 ****
1027 --- 844,850 ----
1028   {
1029     char *path;
1030     FILE *fp;
1031 +   time_t atime;
1032     time_t mtime;
1033     off_t size;
1034     off_t vsize;
1035 ***************
1036 *** 877,882 ****
1037 --- 879,885 ----
1038     unsigned int quiet : 1;     /* inhibit status messages? */
1039     unsigned int collapsed : 1;   /* are all threads collapsed? */
1040     unsigned int closing : 1;   /* mailbox is being closed */
1041 +   unsigned int peekonly : 1;  /* just taking a glance, revert atime */
1042   
1043     /* driver hooks */
1044     void *data;                 /* driver specific data */
1045 *** mutt-1.5.19-orig/muttlib.c  2009-01-05 13:20:53.000000000 -0600
1046 --- mutt-1.5.19-patched/muttlib.c       2009-05-21 23:08:38.000000000 -0500
1047 ***************
1048 *** 1217,1222 ****
1049 --- 1217,1224 ----
1050           pl = pw = 1;
1051   
1052         /* see if there's room to add content, else ignore */
1053 +         if ( DrawFullLine )
1054 +         {
1055         if ((col < COLS && wlen < destlen) || soft)
1056         {
1057           int pad;
1058 ***************
1059 *** 1259,1264 ****
1060 --- 1261,1312 ----
1061           col += wid;
1062           src += pl;
1063         }
1064 +         }
1065 +         else
1066 +         {
1067 +       if ((col < COLS-SidebarWidth && wlen < destlen) || soft)
1068 +         {
1069 +         int pad;
1070
1071 +         /* get contents after padding */
1072 +         mutt_FormatString (buf, sizeof (buf), 0, src + pl, callback, data, flags);
1073 +         len = mutt_strlen (buf);
1074 +         wid = mutt_strwidth (buf);
1075
1076 +         /* try to consume as many columns as we can, if we don't have
1077 +          * memory for that, use as much memory as possible */
1078 +         pad = (COLS - SidebarWidth - col - wid) / pw;
1079 +         if (pad > 0 && wlen + (pad * pl) + len > destlen)
1080 +           pad = ((signed)(destlen - wlen - len)) / pl;
1081 +         if (pad > 0)
1082 +         {
1083 +           while (pad--)
1084 +           {
1085 +             memcpy (wptr, src, pl);
1086 +             wptr += pl;
1087 +             wlen += pl;
1088 +             col += pw;
1089 +           }
1090 +         }
1091 +         else if (soft && pad < 0)
1092 +         {
1093 +           /* \0-terminate dest for length computation in mutt_wstr_trunc() */
1094 +           *wptr = 0;
1095 +           /* make sure right part is at most as wide as display */
1096 +           len = mutt_wstr_trunc (buf, destlen, COLS, &wid);
1097 +           /* truncate left so that right part fits completely in */
1098 +           wlen = mutt_wstr_trunc (dest, destlen - len, col + pad, &col);
1099 +           wptr = dest + wlen;
1100 +         }
1101 +         if (len + wlen > destlen)
1102 +           len = mutt_wstr_trunc (buf, destlen - wlen, COLS - SidebarWidth - col, NULL);
1103 +         memcpy (wptr, buf, len);
1104 +         wptr += len;
1105 +         wlen += len;
1106 +         col += wid;
1107 +         src += pl;
1108 +       }
1109 +         }
1110         break; /* skip rest of input */
1111         }
1112         else if (ch == '|')
1113 *** mutt-1.5.19-orig/mx.c       2009-01-05 13:20:53.000000000 -0600
1114 --- mutt-1.5.19-patched/mx.c    2009-05-21 23:08:38.000000000 -0500
1115 ***************
1116 *** 611,616 ****
1117 --- 611,617 ----
1118    *            M_APPEND        open mailbox for appending
1119    *            M_READONLY      open mailbox in read-only mode
1120    *            M_QUIET         only print error messages
1121 +  *            M_PEEK          revert atime where applicable
1122    *    ctx     if non-null, context struct to use
1123    */
1124   CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT *pctx)
1125 ***************
1126 *** 633,638 ****
1127 --- 634,641 ----
1128       ctx->quiet = 1;
1129     if (flags & M_READONLY)
1130       ctx->readonly = 1;
1131 +   if (flags & M_PEEK)
1132 +     ctx->peekonly = 1;
1133   
1134     if (flags & (M_APPEND|M_NEWFOLDER))
1135     {
1136 ***************
1137 *** 732,740 ****
1138 --- 735,755 ----
1139   void mx_fastclose_mailbox (CONTEXT *ctx)
1140   {
1141     int i;
1142 + #ifndef BUFFY_SIZE
1143 +   struct utimbuf ut;
1144 + #endif
1145   
1146     if(!ctx) 
1147       return;
1148 + #ifndef BUFFY_SIZE
1149 +   /* fix up the times so buffy won't get confused */
1150 +   if (ctx->peekonly && ctx->path && ctx->mtime > ctx->atime)
1151 +   {
1152 +     ut.actime = ctx->atime;
1153 +     ut.modtime = ctx->mtime;
1154 +     utime (ctx->path, &ut); 
1155 +   }
1156 + #endif
1157   
1158     if (ctx->mx_close)
1159       ctx->mx_close (ctx);
1160 *** mutt-1.5.19-orig/OPS        2008-03-19 15:07:57.000000000 -0500
1161 --- mutt-1.5.19-patched/OPS     2009-05-21 23:08:38.000000000 -0500
1162 ***************
1163 *** 178,180 ****
1164 --- 178,185 ----
1165   OP_MAIN_SHOW_LIMIT "show currently active limit pattern"
1166   OP_MAIN_COLLAPSE_THREAD "collapse/uncollapse current thread"
1167   OP_MAIN_COLLAPSE_ALL "collapse/uncollapse all threads"
1168 + OP_SIDEBAR_SCROLL_UP "scroll the mailbox pane up 1 page"
1169 + OP_SIDEBAR_SCROLL_DOWN "scroll the mailbox pane down 1 page"
1170 + OP_SIDEBAR_NEXT "go down to next mailbox"
1171 + OP_SIDEBAR_PREV "go to previous mailbox"
1172 + OP_SIDEBAR_OPEN "open hilighted mailbox"
1173 *** mutt-1.5.19-orig/pager.c    2009-01-05 13:20:53.000000000 -0600
1174 --- mutt-1.5.19-patched/pager.c 2009-05-21 23:08:38.000000000 -0500
1175 ***************
1176 *** 29,34 ****
1177 --- 29,35 ----
1178   #include "pager.h"
1179   #include "attach.h"
1180   #include "mbyte.h"
1181 + #include "sidebar.h"
1182   
1183   #include "mutt_crypt.h"
1184   
1185 ***************
1186 *** 1060,1065 ****
1187 --- 1061,1068 ----
1188     mbstate_t mbstate;
1189   
1190     int wrap_cols = mutt_term_width ((flags & M_PAGER_NOWRAP) ? 0 : Wrap);
1191
1192 +   wrap_cols -= SidebarWidth;
1193     
1194     /* FIXME: this should come from lineInfo */
1195     memset(&mbstate, 0, sizeof(mbstate));
1196 ***************
1197 *** 1694,1700 ****
1198       if ((redraw & REDRAW_BODY) || topline != oldtopline)
1199       {
1200         do {
1201 !       move (bodyoffset, 0);
1202         curline = oldtopline = topline;
1203         lines = 0;
1204         force_redraw = 0;
1205 --- 1697,1703 ----
1206       if ((redraw & REDRAW_BODY) || topline != oldtopline)
1207       {
1208         do {
1209 !       move (bodyoffset, SidebarWidth);
1210         curline = oldtopline = topline;
1211         lines = 0;
1212         force_redraw = 0;
1213 ***************
1214 *** 1707,1712 ****
1215 --- 1710,1716 ----
1216                             &QuoteList, &q_level, &force_redraw, &SearchRE) > 0)
1217             lines++;
1218           curline++;
1219 +         move(lines + bodyoffset, SidebarWidth);
1220         }
1221         last_offset = lineInfo[curline].offset;
1222         } while (force_redraw);
1223 ***************
1224 *** 1720,1725 ****
1225 --- 1724,1730 ----
1226           addch ('~');
1227         addch ('\n');
1228         lines++;
1229 +       move(lines + bodyoffset, SidebarWidth);
1230         }
1231         /* We are going to update the pager status bar, so it isn't
1232          * necessary to reset to normal color now. */
1233 ***************
1234 *** 1743,1764 ****
1235         /* print out the pager status bar */
1236         SETCOLOR (MT_COLOR_STATUS);
1237         BKGDSET (MT_COLOR_STATUS);
1238 !       CLEARLINE (statusoffset);
1239         if (IsHeader (extra))
1240         {
1241 !       size_t l1 = COLS * MB_LEN_MAX;
1242         size_t l2 = sizeof (buffer);
1243         hfi.hdr = extra->hdr;
1244         mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), &hfi, M_FORMAT_MAKEPRINT);
1245         }
1246         else if (IsMsgAttach (extra))
1247         {
1248 !       size_t l1 = COLS * MB_LEN_MAX;
1249         size_t l2 = sizeof (buffer);
1250         hfi.hdr = extra->bdy->hdr;
1251         mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), &hfi, M_FORMAT_MAKEPRINT);
1252         }
1253 !       mutt_paddstr (COLS, IsHeader (extra) || IsMsgAttach (extra) ?  buffer : banner);
1254         BKGDSET (MT_COLOR_NORMAL);
1255         SETCOLOR (MT_COLOR_NORMAL);
1256       }
1257 --- 1748,1769 ----
1258         /* print out the pager status bar */
1259         SETCOLOR (MT_COLOR_STATUS);
1260         BKGDSET (MT_COLOR_STATUS);
1261 !       CLEARLINE_WIN (statusoffset);
1262         if (IsHeader (extra))
1263         {
1264 !       size_t l1 = (COLS-SidebarWidth) * MB_LEN_MAX;
1265         size_t l2 = sizeof (buffer);
1266         hfi.hdr = extra->hdr;
1267         mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), &hfi, M_FORMAT_MAKEPRINT);
1268         }
1269         else if (IsMsgAttach (extra))
1270         {
1271 !       size_t l1 = (COLS-SidebarWidth) * MB_LEN_MAX;
1272         size_t l2 = sizeof (buffer);
1273         hfi.hdr = extra->bdy->hdr;
1274         mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), &hfi, M_FORMAT_MAKEPRINT);
1275         }
1276 !       mutt_paddstr (COLS-SidebarWidth, IsHeader (extra) || IsMsgAttach (extra) ?  buffer : banner);
1277         BKGDSET (MT_COLOR_NORMAL);
1278         SETCOLOR (MT_COLOR_NORMAL);
1279       }
1280 ***************
1281 *** 1768,1785 ****
1282         /* redraw the pager_index indicator, because the
1283          * flags for this message might have changed. */
1284         menu_redraw_current (index);
1285   
1286         /* print out the index status bar */
1287         menu_status_line (buffer, sizeof (buffer), index, NONULL(Status));
1288    
1289 !       move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), 0);
1290         SETCOLOR (MT_COLOR_STATUS);
1291         BKGDSET (MT_COLOR_STATUS);
1292 !       mutt_paddstr (COLS, buffer);
1293         SETCOLOR (MT_COLOR_NORMAL);
1294         BKGDSET (MT_COLOR_NORMAL);
1295       }
1296   
1297       redraw = 0;
1298   
1299       if (option(OPTBRAILLEFRIENDLY)) {
1300 --- 1773,1795 ----
1301         /* redraw the pager_index indicator, because the
1302          * flags for this message might have changed. */
1303         menu_redraw_current (index);
1304 +       draw_sidebar(MENU_PAGER);
1305   
1306         /* print out the index status bar */
1307         menu_status_line (buffer, sizeof (buffer), index, NONULL(Status));
1308    
1309 !       move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), SidebarWidth);
1310         SETCOLOR (MT_COLOR_STATUS);
1311         BKGDSET (MT_COLOR_STATUS);
1312 !       mutt_paddstr (COLS-SidebarWidth, buffer);
1313         SETCOLOR (MT_COLOR_NORMAL);
1314         BKGDSET (MT_COLOR_NORMAL);
1315       }
1316   
1317 +     /* if we're not using the index, update every time */
1318 +     if ( index == 0 )
1319 +       draw_sidebar(MENU_PAGER);
1320
1321       redraw = 0;
1322   
1323       if (option(OPTBRAILLEFRIENDLY)) {
1324 ***************
1325 *** 2671,2676 ****
1326 --- 2681,2693 ----
1327         mutt_what_key ();
1328         break;
1329   
1330 +       case OP_SIDEBAR_SCROLL_UP:
1331 +       case OP_SIDEBAR_SCROLL_DOWN:
1332 +       case OP_SIDEBAR_NEXT:
1333 +       case OP_SIDEBAR_PREV:
1334 +       scroll_sidebar(ch, MENU_PAGER);
1335 +       break;
1336
1337         default:
1338         ch = -1;
1339         break;
1340 *** mutt-1.5.19-orig/PATCHES    2008-03-19 15:07:06.000000000 -0500
1341 --- mutt-1.5.19-patched/PATCHES 2009-05-22 08:45:39.000000000 -0500
1342 ***************
1343 *** 0 ****
1344 --- 1 ----
1345 + patch-1.5.19.sidebar.20090522.txt
1346 *** mutt-1.5.19-orig/sidebar.c  1969-12-31 18:00:00.000000000 -0600
1347 --- mutt-1.5.19-patched/sidebar.c       2009-05-21 23:08:38.000000000 -0500
1348 ***************
1349 *** 0 ****
1350 --- 1,333 ----
1351 + /*
1352 +  * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu>
1353 +  * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com>
1354 +  * 
1355 +  *     This program is free software; you can redistribute it and/or modify
1356 +  *     it under the terms of the GNU General Public License as published by
1357 +  *     the Free Software Foundation; either version 2 of the License, or
1358 +  *     (at your option) any later version.
1359 +  * 
1360 +  *     This program is distributed in the hope that it will be useful,
1361 +  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
1362 +  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1363 +  *     GNU General Public License for more details.
1364 +  * 
1365 +  *     You should have received a copy of the GNU General Public License
1366 +  *     along with this program; if not, write to the Free Software
1367 +  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
1368 +  */ 
1369
1370
1371 + #if HAVE_CONFIG_H
1372 + # include "config.h"
1373 + #endif
1374
1375 + #include "mutt.h"
1376 + #include "mutt_menu.h"
1377 + #include "mutt_curses.h"
1378 + #include "sidebar.h"
1379 + #include "buffy.h"
1380 + #include <libgen.h>
1381 + #include "keymap.h"
1382 + #include <stdbool.h>
1383
1384 + /*BUFFY *CurBuffy = 0;*/
1385 + static BUFFY *TopBuffy = 0;
1386 + static BUFFY *BottomBuffy = 0;
1387 + static int known_lines = 0;
1388
1389 + static int quick_log10(int n)
1390 + {
1391 +         char string[32];
1392 +         sprintf(string, "%d", n);
1393 +         return strlen(string);
1394 + }
1395
1396 + void calc_boundaries (int menu)
1397 + {
1398 +       BUFFY *tmp = Incoming;
1399
1400 +       if ( known_lines != LINES ) {
1401 +               TopBuffy = BottomBuffy = 0;
1402 +               known_lines = LINES;
1403 +       }
1404 +       for ( ; tmp->next != 0; tmp = tmp->next )
1405 +               tmp->next->prev = tmp;
1406
1407 +       if ( TopBuffy == 0 && BottomBuffy == 0 )
1408 +               TopBuffy = Incoming;
1409 +       if ( BottomBuffy == 0 ) {
1410 +               int count = LINES - 2 - (menu != MENU_PAGER || option(OPTSTATUSONTOP));
1411 +               BottomBuffy = TopBuffy;
1412 +               while ( --count && BottomBuffy->next )
1413 +                       BottomBuffy = BottomBuffy->next;
1414 +       }
1415 +       else if ( TopBuffy == CurBuffy->next ) {
1416 +               int count = LINES - 2 - (menu != MENU_PAGER);
1417 +               BottomBuffy = CurBuffy;
1418 +               tmp = BottomBuffy;
1419 +               while ( --count && tmp->prev)
1420 +                       tmp = tmp->prev;
1421 +               TopBuffy = tmp;
1422 +       }
1423 +       else if ( BottomBuffy == CurBuffy->prev ) {
1424 +               int count = LINES - 2 - (menu != MENU_PAGER);
1425 +               TopBuffy = CurBuffy;
1426 +               tmp = TopBuffy;
1427 +               while ( --count && tmp->next )
1428 +                       tmp = tmp->next;
1429 +               BottomBuffy = tmp;
1430 +       }
1431 + }
1432
1433 + char *make_sidebar_entry(char *box, int size, int new, int flagged)
1434 + {
1435 +       static char *entry = 0;
1436 +       char *c;
1437 +       int i = 0;
1438 +       int delim_len = strlen(SidebarDelim);
1439
1440 +       c = realloc(entry, SidebarWidth - delim_len + 2);
1441 +       if ( c ) entry = c;
1442 +       entry[SidebarWidth - delim_len + 1] = 0;
1443 +       for (; i < SidebarWidth - delim_len + 1; entry[i++] = ' ' );
1444 +       i = strlen(box);
1445 +       strncpy( entry, box, i < (SidebarWidth - delim_len + 1) ? i : (SidebarWidth - delim_len + 1) );
1446
1447 +         if (size == -1)
1448 +                 sprintf(entry + SidebarWidth - delim_len - 3, "?");
1449 +         else if ( new ) {
1450 +           if (flagged > 0) {
1451 +               sprintf(
1452 +                       entry + SidebarWidth - delim_len - 5 - quick_log10(size) - quick_log10(new) - quick_log10(flagged),
1453 +                       "% d(%d)[%d]", size, new, flagged);
1454 +           } else {
1455 +               sprintf(
1456 +                       entry + SidebarWidth - delim_len - 3 - quick_log10(size) - quick_log10(new),
1457 +                       "% d(%d)", size, new);
1458 +           }
1459 +         } else if (flagged > 0) {
1460 +               sprintf( entry + SidebarWidth - delim_len - 3 - quick_log10(size) - quick_log10(flagged), "% d[%d]", size, flagged);
1461 +         } else {
1462 +               sprintf( entry + SidebarWidth - delim_len - 1 - quick_log10(size), "% d", size);
1463 +         }
1464 +       return entry;
1465 + }
1466
1467 + void set_curbuffy(char buf[LONG_STRING])
1468 + {
1469 +   BUFFY* tmp = CurBuffy = Incoming;
1470
1471 +   if (!Incoming)
1472 +     return;
1473
1474 +   while(1) {
1475 +     if(!strcmp(tmp->path, buf)) {
1476 +       CurBuffy = tmp;
1477 +       break;
1478 +     }
1479
1480 +     if(tmp->next)
1481 +       tmp = tmp->next;
1482 +     else
1483 +       break;
1484 +   }
1485 + }
1486
1487 + int draw_sidebar(int menu) {
1488
1489 +       int lines = option(OPTHELP) ? 1 : 0;
1490 +       BUFFY *tmp;
1491 + #ifndef USE_SLANG_CURSES
1492 +         attr_t attrs;
1493 + #endif
1494 +         short delim_len = strlen(SidebarDelim);
1495 +         short color_pair;
1496
1497 +         static bool initialized = false;
1498 +         static int prev_show_value;
1499 +         static short saveSidebarWidth;
1500
1501 +         /* initialize first time */
1502 +         if(!initialized) {
1503 +                 prev_show_value = option(OPTSIDEBAR);
1504 +                 saveSidebarWidth = SidebarWidth;
1505 +                 if(!option(OPTSIDEBAR)) SidebarWidth = 0;
1506 +                 initialized = true;
1507 +         }
1508
1509 +         /* save or restore the value SidebarWidth */
1510 +         if(prev_show_value != option(OPTSIDEBAR)) {
1511 +                 if(prev_show_value && !option(OPTSIDEBAR)) {
1512 +                         saveSidebarWidth = SidebarWidth;
1513 +                         SidebarWidth = 0;
1514 +                 } else if(!prev_show_value && option(OPTSIDEBAR)) {
1515 +                         SidebarWidth = saveSidebarWidth;
1516 +                 }
1517 +                 prev_show_value = option(OPTSIDEBAR);
1518 +         }
1519
1520
1521 + //    if ( SidebarWidth == 0 ) return 0;
1522 +        if (SidebarWidth > 0 && option (OPTSIDEBAR)
1523 +            && delim_len >= SidebarWidth) {
1524 +          unset_option (OPTSIDEBAR);
1525 +          /* saveSidebarWidth = SidebarWidth; */
1526 +          if (saveSidebarWidth > delim_len) {
1527 +            SidebarWidth = saveSidebarWidth;
1528 +            mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar."));
1529 +            sleep (2);
1530 +          } else {
1531 +            SidebarWidth = 0;
1532 +            mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar. Please set your sidebar_width to a sane value."));
1533 +            sleep (4); /* the advise to set a sane value should be seen long enough */
1534 +          }
1535 +          saveSidebarWidth = 0;
1536 +          return (0);
1537 +        }
1538
1539 +     if ( SidebarWidth == 0 || !option(OPTSIDEBAR)) {
1540 +       if (SidebarWidth > 0) {
1541 +         saveSidebarWidth = SidebarWidth;
1542 +         SidebarWidth = 0;
1543 +       }
1544 +       unset_option(OPTSIDEBAR);
1545 +       return 0;
1546 +     }
1547
1548 +         /* get attributes for divider */
1549 +       SETCOLOR(MT_COLOR_STATUS);
1550 + #ifndef USE_SLANG_CURSES
1551 +         attr_get(&attrs, &color_pair, 0);
1552 + #else
1553 +         color_pair = attr_get();
1554 + #endif
1555 +       SETCOLOR(MT_COLOR_NORMAL);
1556
1557 +       /* draw the divider */
1558
1559 +       for ( ; lines < LINES-1-(menu != MENU_PAGER || option(OPTSTATUSONTOP)); lines++ ) {
1560 +               move(lines, SidebarWidth - delim_len);
1561 +               addstr(NONULL(SidebarDelim));
1562 + #ifndef USE_SLANG_CURSES
1563 +                 mvchgat(lines, SidebarWidth - delim_len, delim_len, 0, color_pair, NULL);
1564 + #endif
1565 +       }
1566
1567 +       if ( Incoming == 0 ) return 0;
1568 +       lines = option(OPTHELP) ? 1 : 0; /* go back to the top */
1569
1570 +       if ( known_lines != LINES || TopBuffy == 0 || BottomBuffy == 0 ) 
1571 +               calc_boundaries(menu);
1572 +       if ( CurBuffy == 0 ) CurBuffy = Incoming;
1573
1574 +       tmp = TopBuffy;
1575
1576 +       SETCOLOR(MT_COLOR_NORMAL);
1577
1578 +       for ( ; tmp && lines < LINES-1 - (menu != MENU_PAGER || option(OPTSTATUSONTOP)); tmp = tmp->next ) {
1579 +               if ( tmp == CurBuffy )
1580 +                       SETCOLOR(MT_COLOR_INDICATOR);
1581 +               else if ( tmp->msg_unread > 0 )
1582 +                       SETCOLOR(MT_COLOR_NEW);
1583 +               else if ( tmp->msg_flagged > 0 )
1584 +                       SETCOLOR(MT_COLOR_FLAGGED);
1585 +               else
1586 +                       SETCOLOR(MT_COLOR_NORMAL);
1587
1588 +               move( lines, 0 );
1589 +               if ( Context && !strcmp( tmp->path, Context->path ) ) {
1590 +                       tmp->msg_unread = Context->unread;
1591 +                       tmp->msgcount = Context->msgcount;
1592 +                       tmp->msg_flagged = Context->flagged;
1593 +               }
1594 +               // check whether Maildir is a prefix of the current folder's path
1595 +               short maildir_is_prefix = 0;
1596 +               if ( (strlen(tmp->path) > strlen(Maildir)) &&
1597 +                       (strncmp(Maildir, tmp->path, strlen(Maildir)) == 0) )
1598 +                       maildir_is_prefix = 1;
1599 +               // calculate depth of current folder and generate its display name with indented spaces
1600 +               int sidebar_folder_depth = 0;
1601 +               char *sidebar_folder_name;
1602 +               sidebar_folder_name = basename(tmp->path);
1603 +               if ( maildir_is_prefix ) {
1604 +                       char *tmp_folder_name;
1605 +                       int i;
1606 +                       tmp_folder_name = tmp->path + strlen(Maildir);
1607 +                       for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) {
1608 +                               if (tmp_folder_name[i] == '/') sidebar_folder_depth++;
1609 +                       }   
1610 +                       if (sidebar_folder_depth > 0) {
1611 +                               sidebar_folder_name = malloc(strlen(basename(tmp->path)) + sidebar_folder_depth + 1);
1612 +                               for (i=0; i < sidebar_folder_depth; i++)
1613 +                                       sidebar_folder_name[i]=' ';
1614 +                               sidebar_folder_name[i]=0;
1615 +                               strncat(sidebar_folder_name, basename(tmp->path), strlen(basename(tmp->path)) + sidebar_folder_depth);
1616 +                       }
1617 +               }
1618 +               printw( "%.*s", SidebarWidth - delim_len + 1,
1619 +                       make_sidebar_entry(sidebar_folder_name, tmp->msgcount,
1620 +                       tmp->msg_unread, tmp->msg_flagged));
1621 +               if (sidebar_folder_depth > 0)
1622 +                       free(sidebar_folder_name);
1623 +               lines++;
1624 +       }
1625 +       SETCOLOR(MT_COLOR_NORMAL);
1626 +       for ( ; lines < LINES-1 - (menu != MENU_PAGER || option(OPTSTATUSONTOP)); lines++ ) {
1627 +               int i = 0;
1628 +               move( lines, 0 );
1629 +               for ( ; i < SidebarWidth - delim_len; i++ )
1630 +                       addch(' ');
1631 +       }
1632 +       return 0;
1633 + }
1634
1635
1636 + void set_buffystats(CONTEXT* Context)
1637 + {
1638 +         BUFFY *tmp = Incoming;
1639 +         while(tmp) {
1640 +                 if(Context && !strcmp(tmp->path, Context->path)) {
1641 +                       tmp->msg_unread = Context->unread;
1642 +                       tmp->msgcount = Context->msgcount;
1643 +                         break;
1644 +                 }
1645 +                 tmp = tmp->next;
1646 +         }
1647 + }
1648
1649 + void scroll_sidebar(int op, int menu)
1650 + {
1651 +         if(!SidebarWidth) return;
1652 +         if(!CurBuffy) return;
1653
1654 +       switch (op) {
1655 +               case OP_SIDEBAR_NEXT:
1656 +                       if ( CurBuffy->next == NULL ) return;
1657 +                       CurBuffy = CurBuffy->next;
1658 +                       break;
1659 +               case OP_SIDEBAR_PREV:
1660 +                       if ( CurBuffy->prev == NULL ) return;
1661 +                       CurBuffy = CurBuffy->prev;
1662 +                       break;
1663 +               case OP_SIDEBAR_SCROLL_UP:
1664 +                       CurBuffy = TopBuffy;
1665 +                       if ( CurBuffy != Incoming ) {
1666 +                               calc_boundaries(menu);
1667 +                               CurBuffy = CurBuffy->prev;
1668 +                       }
1669 +                       break;
1670 +               case OP_SIDEBAR_SCROLL_DOWN:
1671 +                       CurBuffy = BottomBuffy;
1672 +                       if ( CurBuffy->next ) {
1673 +                               calc_boundaries(menu);
1674 +                               CurBuffy = CurBuffy->next;
1675 +                       }
1676 +                       break;
1677 +               default:
1678 +                       return;
1679 +       }
1680 +       calc_boundaries(menu);
1681 +       draw_sidebar(menu);
1682 + }
1683
1684 *** mutt-1.5.19-orig/sidebar.h  1969-12-31 18:00:00.000000000 -0600
1685 --- mutt-1.5.19-patched/sidebar.h       2009-05-21 23:08:38.000000000 -0500
1686 ***************
1687 *** 0 ****
1688 --- 1,36 ----
1689 + /*
1690 +  * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu>
1691 +  * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com>
1692 +  * 
1693 +  *     This program is free software; you can redistribute it and/or modify
1694 +  *     it under the terms of the GNU General Public License as published by
1695 +  *     the Free Software Foundation; either version 2 of the License, or
1696 +  *     (at your option) any later version.
1697 +  * 
1698 +  *     This program is distributed in the hope that it will be useful,
1699 +  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
1700 +  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1701 +  *     GNU General Public License for more details.
1702 +  * 
1703 +  *     You should have received a copy of the GNU General Public License
1704 +  *     along with this program; if not, write to the Free Software
1705 +  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
1706 +  */ 
1707
1708 + #ifndef SIDEBAR_H
1709 + #define SIDEBAR_H
1710
1711 + struct MBOX_LIST {
1712 +       char *path;
1713 +       int msgcount;
1714 +       int new;
1715 + } MBLIST;
1716
1717 + /* parameter is whether or not to go to the status line */
1718 + /* used for omitting the last | that covers up the status bar in the index */
1719 + int draw_sidebar(int);
1720 + void scroll_sidebar(int, int);
1721 + void set_curbuffy(char*);
1722 + void set_buffystats(CONTEXT*);
1723
1724 + #endif /* SIDEBAR_H */
1725 *** mutt-1.5.19-orig/doc/Muttrc 2009-01-05 18:36:17.000000000 -0600
1726 --- mutt-1.5.19-patched/doc/Muttrc      2009-05-21 23:08:38.000000000 -0500
1727 ***************
1728 *** 2167,2172 ****
1729 --- 2167,2192 ----
1730   # function.
1731   # 
1732   # 
1733 + # set sidebar_visible=no
1734 + #
1735 + # Name: sidebar_visible
1736 + # Type: boolean
1737 + # Default: no
1738 + # 
1739 + # 
1740 + # This specifies whether or not to show sidebar (left-side list of folders).
1741 + # 
1742 + # 
1743 + # set sidebar_width=0
1744 + #
1745 + # Name: sidebar_width
1746 + # Type: number
1747 + # Default: 0
1748 + # 
1749 + # 
1750 + # The width of the sidebar.
1751 + # 
1752 + # 
1753   # set crypt_autosign=no
1754   #
1755   # Name: crypt_autosign
1756 *** mutt-1.5.19-orig/imap/imap.c        2009-01-05 17:50:39.000000000 -0600
1757 --- mutt-1.5.19-patched/imap/imap.c     2009-05-21 23:08:38.000000000 -0500
1758 ***************
1759 *** 1513,1519 ****
1760   
1761       imap_munge_mbox_name (munged, sizeof (munged), name);
1762       snprintf (command, sizeof (command),
1763 !             "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT)", munged);
1764   
1765       if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0)
1766       {
1767 --- 1513,1519 ----
1768   
1769       imap_munge_mbox_name (munged, sizeof (munged), name);
1770       snprintf (command, sizeof (command),
1771 !             "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT MESSAGES)", munged);
1772   
1773       if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0)
1774       {
1775 *** mutt-1.5.19-orig/imap/command.c     2009-01-05 17:57:30.000000000 -0600
1776 --- mutt-1.5.19-patched/imap/command.c  2009-05-21 23:08:38.000000000 -0500
1777 ***************
1778 *** 1009,1014 ****
1779 --- 1009,1021 ----
1780              opened */
1781           status->uidnext = oldun;
1782   
1783 +         /* Added to make the sidebar show the correct numbers */
1784 +         if (status->messages)
1785 +         {
1786 +           inc->msgcount = status->messages;
1787 +           inc->msg_unread = status->unseen;
1788 +         }
1789
1790           FREE (&value);
1791           return;
1792         }