]> pilppa.org Git - familiar-h63xx-build.git/blob - org.handhelds.familiar/packages/mutt/mutt-1.5.9i/patch-1.5.9i.sidebar.20050628.txt.hackedfornntp
OE tree imported from monotone branch org.openembedded.oz354fam083 at revision 8b12e3...
[familiar-h63xx-build.git] / org.handhelds.familiar / packages / mutt / mutt-1.5.9i / patch-1.5.9i.sidebar.20050628.txt.hackedfornntp
1 diff -N -c -r mutt-1.5.9i-orig/buffy.c mutt-1.5.9i-patched/buffy.c
2 *** mutt-1.5.9i-orig/buffy.c    2005-02-03 13:47:52.000000000 -0500
3 --- mutt-1.5.9i-patched/buffy.c 2005-05-25 14:53:34.000000000 -0400
4 ***************
5 *** 267,273 ****
6     char path[_POSIX_PATH_MAX];
7     struct stat contex_sb;
8     time_t t;
9
10   #ifdef USE_IMAP
11     /* update postponed count as well, on force */
12     if (force)
13 --- 267,273 ----
14     char path[_POSIX_PATH_MAX];
15     struct stat contex_sb;
16     time_t t;
17 !   CONTEXT *ctx;
18   #ifdef USE_IMAP
19     /* update postponed count as well, on force */
20     if (force)
21 ***************
22 *** 300,305 ****
23 --- 300,307 ----
24     
25     for (tmp = Incoming; tmp; tmp = tmp->next)
26     {
27 +       if ( tmp->new == 1 )
28 +               tmp->has_new = 1;
29       tmp->new = 0;
30   
31   #ifdef USE_IMAP
32 ***************
33 *** 353,362 ****
34         case M_MBOX:
35         case M_MMDF:
36   
37 !       if (STAT_CHECK)
38         {
39           BuffyCount++;
40 !         tmp->new = 1;
41         }
42   #ifdef BUFFY_SIZE
43         else
44 --- 355,380 ----
45         case M_MBOX:
46         case M_MMDF:
47   
48 !     {
49 !       if (STAT_CHECK || tmp->msgcount == 0)
50         {
51 +         BUFFY b = *tmp;
52 +         int msgcount = 0;
53 +         int msg_unread = 0;
54           BuffyCount++;
55 !         /* parse the mailbox, to see how much mail there is */
56 !         ctx = mx_open_mailbox( tmp->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL);
57 !         if(ctx)
58 !         {
59 !             msgcount = ctx->msgcount;
60 !             msg_unread = ctx->unread;
61 !             mx_close_mailbox(ctx, 0);
62 !         }
63 !         *tmp = b;
64 !         tmp->msgcount = msgcount;
65 !         tmp->msg_unread = msg_unread;
66 !         if(STAT_CHECK)
67 !             tmp->has_new = tmp->new = 1;
68         }
69   #ifdef BUFFY_SIZE
70         else
71 ***************
72 *** 368,408 ****
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   #ifdef USE_IMAP
108         case M_IMAP:
109 !       if ((tmp->new = imap_mailbox_check (tmp->path, 1)) > 0)
110           BuffyCount++;
111         else
112           tmp->new = 0;
113   
114 --- 386,471 ----
115         if (tmp->newly_created &&
116             (sb.st_ctime != sb.st_mtime || sb.st_ctime != sb.st_atime))
117           tmp->newly_created = 0;
118 !       }
119         break;
120   
121         case M_MAILDIR:
122   
123 +         /* count new message */
124         snprintf (path, sizeof (path), "%s/new", tmp->path);
125         if ((dirp = opendir (path)) == NULL)
126         {
127           tmp->magic = 0;
128           break;
129         }
130 +       tmp->msgcount = 0;
131 +       tmp->msg_unread = 0;
132         while ((de = readdir (dirp)) != NULL)
133         {
134           char *p;
135           if (*de->d_name != '.' && 
136               (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')))
137           {
138 !           tmp->has_new = tmp->new = 1;
139 !             tmp->msgcount++;
140 !             tmp->msg_unread++;
141 !         }
142 !       }
143 !         if(tmp->msg_unread)
144 !           BuffyCount++;
145
146 !       closedir (dirp);
147
148 !         /*
149 !          * count read messages (for folderlist (sidebar) we also need to count
150 !          * messages in cur so that we the total number of messages
151 !          */
152 !       snprintf (path, sizeof (path), "%s/cur", tmp->path);
153 !       if ((dirp = opendir (path)) == NULL)
154 !       {
155 !         tmp->magic = 0;
156 !         break;
157 !       }
158 !       while ((de = readdir (dirp)) != NULL)
159 !       {
160 !         char *p;
161 !         if (*de->d_name != '.' && 
162 !             (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')))
163 !         {
164 !             tmp->msgcount++;
165           }
166         }
167         closedir (dirp);
168         break;
169   
170         case M_MH:
171 !       {
172 !       DIR *dp;
173 !       struct dirent *de;
174 !         if ((tmp->new = mh_buffy (tmp->path)) > 0)
175 !           BuffyCount++;
176 !   
177 !       if ((dp = opendir (path)) == NULL)
178 !         break;
179 !         tmp->msgcount = 0;
180 !       while ((de = readdir (dp)))
181 !       {
182 !         if (mh_valid_message (de->d_name))
183 !         {
184 !                 tmp->msgcount++;
185 !                 tmp->has_new = tmp->new = 1;
186 !         }
187 !       }
188 !       closedir (dp);
189 !     }
190         break;
191         
192   #ifdef USE_IMAP
193         case M_IMAP:
194 !         tmp->msgcount = imap_mailbox_check(tmp->path, 0);
195 !       if ((tmp->new = imap_mailbox_check (tmp->path, 1)) > 0) {
196           BuffyCount++;
197 +       }
198         else
199           tmp->new = 0;
200   
201 diff -N -c -r mutt-1.5.9i-orig/buffy.h mutt-1.5.9i-patched/buffy.h
202 *** mutt-1.5.9i-orig/buffy.h    2002-12-11 06:19:39.000000000 -0500
203 --- mutt-1.5.9i-patched/buffy.h 2005-05-25 14:53:34.000000000 -0400
204 ***************
205 *** 27,33 ****
206 --- 27,37 ----
207     long size;
208   #endif                                /* BUFFY_SIZE */
209     struct buffy_t *next;
210 +   struct buffy_t *prev;
211     short new;                  /* mailbox has new mail */
212 +   short has_new;              /* set it new if new and not read */
213 +   int msgcount;                       /* total number of messages */
214 +   int msg_unread;             /* number of unread messages */
215     short notified;             /* user has been notified */
216     short magic;                        /* mailbox type */
217     short newly_created;                /* mbox or mmdf just popped into existence */
218 diff -N -c -r mutt-1.5.9i-orig/color.c mutt-1.5.9i-patched/color.c
219 *** mutt-1.5.9i-orig/color.c    2005-02-03 13:47:52.000000000 -0500
220 --- mutt-1.5.9i-patched/color.c 2005-05-25 14:53:34.000000000 -0400
221 ***************
222 *** 93,98 ****
223 --- 93,99 ----
224     { "bold",           MT_COLOR_BOLD },
225     { "underline",      MT_COLOR_UNDERLINE },
226     { "index",          MT_COLOR_INDEX },
227 +   { "sidebar_new",    MT_COLOR_NEW },
228     { NULL,             0 }
229   };
230   
231 diff -N -c -r mutt-1.5.9i-orig/compose.c mutt-1.5.9i-patched/compose.c
232 *** mutt-1.5.9i-orig/compose.c  2005-02-03 13:47:52.000000000 -0500
233 --- mutt-1.5.9i-patched/compose.c       2005-05-25 14:53:34.000000000 -0400
234 ***************
235 *** 72,78 ****
236   
237   #define HDR_XOFFSET 10
238   #define TITLE_FMT "%14s" /* Used for Prompts, which are ASCII */
239 ! #define W (COLS - HDR_XOFFSET)
240   
241   static char *Prompts[] =
242   {
243 --- 72,78 ----
244   
245   #define HDR_XOFFSET 10
246   #define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
247 ! #define W (COLS - HDR_XOFFSET - SidebarWidth)
248   
249   static char *Prompts[] =
250   {
251 ***************
252 *** 148,154 ****
253       }
254     clrtoeol ();
255   
256 !   move (HDR_CRYPTINFO, 0);
257     clrtoeol ();
258     if ((WithCrypto & APPLICATION_PGP)
259         && msg->security & APPLICATION_PGP  && msg->security & SIGN)
260 --- 148,154 ----
261       }
262     clrtoeol ();
263   
264 !   move (HDR_CRYPTINFO, SidebarWidth);
265     clrtoeol ();
266     if ((WithCrypto & APPLICATION_PGP)
267         && msg->security & APPLICATION_PGP  && msg->security & SIGN)
268 ***************
269 *** 164,170 ****
270         && (msg->security & ENCRYPT)
271         && SmimeCryptAlg
272         && *SmimeCryptAlg) {
273 !       mvprintw (HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "),
274                 NONULL(SmimeCryptAlg));
275         off = 20;
276     }
277 --- 164,170 ----
278         && (msg->security & ENCRYPT)
279         && SmimeCryptAlg
280         && *SmimeCryptAlg) {
281 !       mvprintw (HDR_CRYPTINFO, SidebarWidth + 40, "%s%s", _("Encrypt with: "),
282                 NONULL(SmimeCryptAlg));
283         off = 20;
284     }
285 ***************
286 *** 178,184 ****
287     int c;
288     char *t;
289   
290 !   mvaddstr (HDR_MIX, 0,     "     Mix: ");
291   
292     if (!chain)
293     {
294 --- 178,184 ----
295     int c;
296     char *t;
297   
298 !   mvaddstr (HDR_MIX, SidebarWidth,     "     Mix: ");
299   
300     if (!chain)
301     {
302 ***************
303 *** 193,199 ****
304       if (t && t[0] == '0' && t[1] == '\0')
305         t = "<random>";
306       
307 !     if (c + mutt_strlen (t) + 2 >= COLS)
308         break;
309   
310       addstr (NONULL(t));
311 --- 193,199 ----
312       if (t && t[0] == '0' && t[1] == '\0')
313         t = "<random>";
314       
315 !     if (c + mutt_strlen (t) + 2 >= COLS - SidebarWidth)
316         break;
317   
318       addstr (NONULL(t));
319 ***************
320 *** 245,251 ****
321   
322     buf[0] = 0;
323     rfc822_write_address (buf, sizeof (buf), addr, 1);
324 !   mvprintw (line, 0, TITLE_FMT, Prompts[line - 1]);
325     mutt_paddstr (W, buf);
326   }
327   
328 --- 245,251 ----
329   
330     buf[0] = 0;
331     rfc822_write_address (buf, sizeof (buf), addr, 1);
332 !   mvprintw (line, SidebarWidth, TITLE_FMT, Prompts[line - 1]);
333     mutt_paddstr (W, buf);
334   }
335   
336 ***************
337 *** 269,275 ****
338   #endif
339   
340     SETCOLOR (MT_COLOR_STATUS);
341 !   mvaddstr (HDR_ATTACH - 1, 0, _("-- Attachments"));
342     BKGDSET (MT_COLOR_STATUS);
343     clrtoeol ();
344   
345 --- 269,275 ----
346   #endif
347   
348     SETCOLOR (MT_COLOR_STATUS);
349 !   mvaddstr (HDR_ATTACH - 1, SidebarWidth, _("-- Attachments"));
350     BKGDSET (MT_COLOR_STATUS);
351     clrtoeol ();
352   
353 ***************
354 *** 307,313 ****
355     /* redraw the expanded list so the user can see the result */
356     buf[0] = 0;
357     rfc822_write_address (buf, sizeof (buf), *addr, 1);
358 !   move (line, HDR_XOFFSET);
359     mutt_paddstr (W, buf);
360     
361     return 0;
362 --- 307,313 ----
363     /* redraw the expanded list so the user can see the result */
364     buf[0] = 0;
365     rfc822_write_address (buf, sizeof (buf), *addr, 1);
366 !   move (line, HDR_XOFFSET+SidebarWidth);
367     mutt_paddstr (W, buf);
368     
369     return 0;
370 ***************
371 *** 553,559 ****
372         if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
373         {
374           mutt_str_replace (&msg->env->subject, buf);
375 !         move (HDR_SUBJECT, HDR_XOFFSET);
376           clrtoeol ();
377           if (msg->env->subject)
378             mutt_paddstr (W, msg->env->subject);
379 --- 553,559 ----
380         if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
381         {
382           mutt_str_replace (&msg->env->subject, buf);
383 !         move (HDR_SUBJECT, HDR_XOFFSET + SidebarWidth);
384           clrtoeol ();
385           if (msg->env->subject)
386             mutt_paddstr (W, msg->env->subject);
387 ***************
388 *** 570,576 ****
389         {
390           strfcpy (fcc, buf, _POSIX_PATH_MAX);
391           mutt_pretty_mailbox (fcc);
392 !         move (HDR_FCC, HDR_XOFFSET);
393           mutt_paddstr (W, fcc);
394           fccSet = 1;
395         }
396 --- 570,576 ----
397         {
398           strfcpy (fcc, buf, _POSIX_PATH_MAX);
399           mutt_pretty_mailbox (fcc);
400 !         move (HDR_FCC, HDR_XOFFSET + SidebarWidth);
401           mutt_paddstr (W, fcc);
402           fccSet = 1;
403         }
404 diff -N -c -r mutt-1.5.9i-orig/curs_main.c mutt-1.5.9i-patched/curs_main.c
405 *** mutt-1.5.9i-orig/curs_main.c        2005-02-28 13:36:35.000000000 -0500
406 --- mutt-1.5.9i-patched/curs_main.c     2005-05-25 14:53:34.000000000 -0400
407 ***************
408 *** 28,33 ****
409 --- 28,34 ----
410   #include "sort.h"
411   #include "buffy.h"
412   #include "mx.h"
413 + #include "sidebar.h"
414   
415   #ifdef USE_POP
416   #include "pop.h"
417 ***************
418 *** 538,543 ****
419 --- 539,545 ----
420       if (menu->redraw & REDRAW_FULL)
421       {
422         menu_redraw_full (menu);
423 +       draw_sidebar(menu->menu);
424         mutt_show_error ();
425       }
426   
427 ***************
428 *** 560,570 ****
429 --- 562,575 ----
430   
431         if (menu->redraw & REDRAW_STATUS) 
432         {
433 +       DrawFullLine = 1;
434         menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
435 +       DrawFullLine = 0;
436         CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES-2);
437         SETCOLOR (MT_COLOR_STATUS);
438         mutt_paddstr (COLS, buf);
439         SETCOLOR (MT_COLOR_NORMAL);
440 +         set_buffystats(Context);
441         menu->redraw &= ~REDRAW_STATUS;
442         }
443   
444 ***************
445 *** 1040,1045 ****
446 --- 1045,1051 ----
447           menu->redraw = REDRAW_FULL;
448         break;
449   
450 +       case OP_SIDEBAR_OPEN:
451         case OP_MAIN_CHANGE_FOLDER:
452         
453         if (attach_msg)
454 ***************
455 *** 1057,1063 ****
456         buf[0] = '\0';
457         mutt_buffy (buf, sizeof (buf));
458   
459 !       if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
460           break;
461         if (!buf[0])
462         {
463 --- 1063,1073 ----
464         buf[0] = '\0';
465         mutt_buffy (buf, sizeof (buf));
466   
467 !       if ( op == OP_SIDEBAR_OPEN ) {
468 !           if(!CurBuffy)
469 !             break;
470 !         strncpy( buf, CurBuffy->path, sizeof(buf) );
471 !         } else if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
472           break;
473         if (!buf[0])
474         {
475 ***************
476 *** 1066,1071 ****
477 --- 1076,1082 ----
478         }
479   
480         mutt_expand_path (buf, sizeof (buf));
481 +         set_curbuffy(buf);
482         if (mx_get_magic (buf) <= 0)
483         {
484           mutt_error (_("%s is not a mailbox."), buf);
485 ***************
486 *** 2092,2097 ****
487 --- 2103,2114 ----
488         mutt_what_key();
489         break;
490   
491 +         case OP_SIDEBAR_SCROLL_UP:
492 +         case OP_SIDEBAR_SCROLL_DOWN:
493 +         case OP_SIDEBAR_NEXT:
494 +         case OP_SIDEBAR_PREV:
495 +           scroll_sidebar(op, menu->menu);
496 +               break;
497         default:
498         if (menu->menu == MENU_MAIN)
499           km_error_key (MENU_MAIN);
500 diff -N -c -r mutt-1.5.9i-orig/flags.c mutt-1.5.9i-patched/flags.c
501 *** mutt-1.5.9i-orig/flags.c    2005-02-03 13:47:52.000000000 -0500
502 --- mutt-1.5.9i-patched/flags.c 2005-05-25 14:53:34.000000000 -0400
503 ***************
504 *** 22,29 ****
505 --- 22,31 ----
506   
507   #include "mutt.h"
508   #include "mutt_curses.h"
509 + #include "mutt_menu.h"
510   #include "sort.h"
511   #include "mx.h"
512 + #include "sidebar.h"
513   
514   #ifdef USE_IMAP
515   #include "imap_private.h"
516 ***************
517 *** 274,279 ****
518 --- 276,282 ----
519      */
520     if (h->searched && (changed != h->changed || deleted != ctx->deleted || tagged != ctx->tagged))
521       h->searched = 0;
522 +       draw_sidebar(0);
523   }
524   
525   void mutt_tag_set_flag (int flag, int bf)
526 diff -N -c -r mutt-1.5.9i-orig/functions.h mutt-1.5.9i-patched/functions.h
527 *** mutt-1.5.9i-orig/functions.h        2005-02-19 08:49:39.000000000 -0500
528 --- mutt-1.5.9i-patched/functions.h     2005-05-25 14:53:34.000000000 -0400
529 ***************
530 *** 149,154 ****
531 --- 149,159 ----
532     { "decrypt-save",           OP_DECRYPT_SAVE,                NULL },
533   
534   
535 +   { "sidebar-scroll-up",      OP_SIDEBAR_SCROLL_UP, NULL },
536 +   { "sidebar-scroll-down",    OP_SIDEBAR_SCROLL_DOWN, NULL },
537 +   { "sidebar-next",   OP_SIDEBAR_NEXT, NULL },
538 +   { "sidebar-prev",   OP_SIDEBAR_PREV, NULL },
539 +   { "sidebar-open", OP_SIDEBAR_OPEN, NULL },
540     { NULL,                     0,                              NULL }
541   };
542   
543 ***************
544 *** 243,248 ****
545 --- 248,258 ----
546     { "decrypt-save",           OP_DECRYPT_SAVE,                NULL },
547   
548   
549 +   { "sidebar-scroll-up",      OP_SIDEBAR_SCROLL_UP, NULL },
550 +   { "sidebar-scroll-down",    OP_SIDEBAR_SCROLL_DOWN, NULL },
551 +   { "sidebar-next",   OP_SIDEBAR_NEXT, NULL },
552 +   { "sidebar-prev",   OP_SIDEBAR_PREV, NULL },
553 +   { "sidebar-open", OP_SIDEBAR_OPEN, NULL },
554     { NULL,             0,                              NULL }
555   };
556   
557 diff -N -c -r mutt-1.5.9i-orig/globals.h mutt-1.5.9i-patched/globals.h
558 *** mutt-1.5.9i-orig/globals.h  2005-02-12 15:01:02.000000000 -0500
559 --- mutt-1.5.9i-patched/globals.h       2005-05-25 14:53:34.000000000 -0400
560 ***************
561 *** 179,184 ****
562 --- 179,187 ----
563   WHERE short ScoreThresholdRead;
564   WHERE short ScoreThresholdFlag;
565   
566 + WHERE struct buffy_t *CurBuffy INITVAL(0);
567 + WHERE short DrawFullLine INITVAL(0);
568 + WHERE short SidebarWidth;
569   #ifdef USE_IMAP
570   WHERE short ImapKeepalive;
571   #endif
572 diff -N -c -r mutt-1.5.9i-orig/init.h mutt-1.5.9i-patched/init.h
573 *** mutt-1.5.9i-orig/init.h     2005-03-01 10:56:02.000000000 -0500
574 --- mutt-1.5.9i-patched/init.h  2005-05-25 14:53:34.000000000 -0400
575 ***************
576 *** 1078,1083 ****
577 --- 1078,1093 ----
578     ** This specifies the folder into which read mail in your ``$$spoolfile''
579     ** folder will be appended.
580     */
581 +   { "sidebar_visible", DT_BOOL, R_BOTH, OPTSIDEBAR, 0 },
582 +   /*
583 +   ** .pp
584 +   ** This specifies whether or not to show sidebar (left-side list of folders).
585 +   */
586 +   { "sidebar_width", DT_NUM, R_BOTH, UL &SidebarWidth, 0 },
587 +   /*
588 +   ** .pp
589 +   ** The width of the sidebar.
590 +   */
591     { "mbox_type",      DT_MAGIC,R_NONE, UL &DefaultMagic, M_MBOX },
592     /*
593     ** .pp
594 diff -N -c -r mutt-1.5.9i-orig/mailbox.h mutt-1.5.9i-patched/mailbox.h
595 *** mutt-1.5.9i-orig/mailbox.h  2002-11-12 02:53:09.000000000 -0500
596 --- mutt-1.5.9i-patched/mailbox.h       2005-05-25 14:53:34.000000000 -0400
597 ***************
598 *** 27,32 ****
599 --- 27,33 ----
600   #define M_NEWFOLDER   (1<<4) /* create a new folder - same as M_APPEND, but uses
601                                 * safe_fopen() for mbox-style folders.
602                                 */
603 + #define M_PEEK                (1<<5) /* revert atime back after taking a look (if applicable) */
604   
605   /* mx_open_new_message() */
606   #define M_ADD_FROM    1       /* add a From_ line */
607 diff -N -c -r mutt-1.5.9i-orig/Makefile.in mutt-1.5.9i-patched/Makefile.in
608 *** mutt-1.5.9i-orig/Makefile.in        2005-03-13 11:37:46.000000000 -0500
609 --- mutt-1.5.9i-patched/Makefile.in     2005-05-25 14:53:34.000000000 -0400
610 ***************
611 *** 94,100 ****
612         history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
613         editmsg.$(OBJEXT) utf8.$(OBJEXT) mbyte.$(OBJEXT) \
614         wcwidth.$(OBJEXT) url.$(OBJEXT) ascii.$(OBJEXT) \
615 !       mutt_idna.$(OBJEXT) crypt-mod.$(OBJEXT)
616   mutt_OBJECTS = $(am_mutt_OBJECTS)
617   am__DEPENDENCIES_1 =
618   am_mutt_dotlock_OBJECTS = mutt_dotlock.$(OBJEXT)
619 --- 94,101 ----
620         history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
621         editmsg.$(OBJEXT) utf8.$(OBJEXT) mbyte.$(OBJEXT) \
622         wcwidth.$(OBJEXT) url.$(OBJEXT) ascii.$(OBJEXT) \
623 !       mutt_idna.$(OBJEXT) crypt-mod.$(OBJEXT) \
624 !       sidebar.$(OBJEXT)
625   mutt_OBJECTS = $(am_mutt_OBJECTS)
626   am__DEPENDENCIES_1 =
627   am_mutt_dotlock_OBJECTS = mutt_dotlock.$(OBJEXT)
628 ***************
629 *** 304,310 ****
630         score.c send.c sendlib.c signal.c sort.c \
631         status.c system.c thread.c charset.c history.c lib.c \
632         muttlib.c editmsg.c utf8.c mbyte.c wcwidth.c \
633 !       url.c ascii.c mutt_idna.c crypt-mod.c crypt-mod.h
634   
635   mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
636         $(INTLLIBS) $(LIBICONV)  $(LIBGPGME_LIBS)
637 --- 305,312 ----
638         score.c send.c sendlib.c signal.c sort.c \
639         status.c system.c thread.c charset.c history.c lib.c \
640         muttlib.c editmsg.c utf8.c mbyte.c wcwidth.c \
641 !       url.c ascii.c mutt_idna.c crypt-mod.c crypt-mod.h \
642 !       sidebar.c
643   
644   mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
645         $(INTLLIBS) $(LIBICONV)  $(LIBGPGME_LIBS)
646 ***************
647 *** 337,343 ****
648         makedoc.c stamp-doc-rc README.SSL smime.h\
649         muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
650         ChangeLog.old mkchangelog.sh cvslog2changelog.pl mutt_idna.h \
651 !       snprintf.c regex.c crypt-gpgme.h
652   
653   EXTRA_SCRIPTS = smime_keys
654   mutt_dotlock_SOURCES = mutt_dotlock.c
655 --- 339,345 ----
656         makedoc.c stamp-doc-rc README.SSL smime.h\
657         muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
658         ChangeLog.old mkchangelog.sh cvslog2changelog.pl mutt_idna.h \
659 !       snprintf.c regex.c crypt-gpgme.h sidebar.h
660   
661   EXTRA_SCRIPTS = smime_keys
662   mutt_dotlock_SOURCES = mutt_dotlock.c
663 diff -N -c -r mutt-1.5.9i-orig/mbox.c mutt-1.5.9i-patched/mbox.c
664 *** mutt-1.5.9i-orig/mbox.c     2005-02-03 13:47:53.000000000 -0500
665 --- mutt-1.5.9i-patched/mbox.c  2005-05-25 14:53:34.000000000 -0400
666 ***************
667 *** 97,102 ****
668 --- 97,103 ----
669       mutt_perror (ctx->path);
670       return (-1);
671     }
672 +   ctx->atime = sb.st_atime;
673     ctx->mtime = sb.st_mtime;
674     ctx->size = sb.st_size;
675   
676 ***************
677 *** 245,250 ****
678 --- 246,252 ----
679   
680     ctx->size = sb.st_size;
681     ctx->mtime = sb.st_mtime;
682 +   ctx->atime = sb.st_atime;
683   
684   #ifdef NFS_ATTRIBUTE_HACK
685     if (sb.st_mtime > sb.st_atime)
686 diff -N -c -r mutt-1.5.9i-orig/menu.c mutt-1.5.9i-patched/menu.c
687 *** mutt-1.5.9i-orig/menu.c     2005-02-28 10:13:57.000000000 -0500
688 --- mutt-1.5.9i-patched/menu.c  2005-05-25 14:53:34.000000000 -0400
689 ***************
690 *** 24,29 ****
691 --- 24,30 ----
692   #include "mutt_curses.h"
693   #include "mutt_menu.h"
694   #include "mbyte.h"
695 + #include "sidebar.h"
696   
697   #ifdef USE_IMAP
698   #include "imap.h"
699 ***************
700 *** 157,163 ****
701   void menu_pad_string (char *s, size_t n)
702   {
703     int shift = option (OPTARROWCURSOR) ? 3 : 0;
704 !   int cols = COLS - shift;
705   
706     mutt_format_string (s, n, cols, cols, 0, ' ', s, strlen (s), 1);
707     s[n - 1] = 0;
708 --- 158,164 ----
709   void menu_pad_string (char *s, size_t n)
710   {
711     int shift = option (OPTARROWCURSOR) ? 3 : 0;
712 !   int cols = COLS - shift - SidebarWidth;
713   
714     mutt_format_string (s, n, cols, cols, 0, ' ', s, strlen (s), 1);
715     s[n - 1] = 0;
716 ***************
717 *** 207,212 ****
718 --- 208,214 ----
719     char buf[STRING];
720     int i;
721   
722 +   draw_sidebar(1);
723     for (i = menu->top; i < menu->top + menu->pagelen; i++)
724     {
725       if (i < menu->max)
726 ***************
727 *** 217,223 ****
728         if (option (OPTARROWCURSOR))
729         {
730           attrset (menu->color (i));
731 !       CLEARLINE (i - menu->top + menu->offset);
732   
733         if (i == menu->current)
734         {
735 --- 219,225 ----
736         if (option (OPTARROWCURSOR))
737         {
738           attrset (menu->color (i));
739 !       CLEARLINE_WIN (i - menu->top + menu->offset);
740   
741         if (i == menu->current)
742         {
743 ***************
744 *** 228,234 ****
745           addch (' ');
746         }
747         else
748 !         move (i - menu->top + menu->offset, 3);
749   
750           print_enriched_string (menu->color(i), (unsigned char *) buf, 1);
751           SETCOLOR (MT_COLOR_NORMAL);          
752 --- 230,236 ----
753           addch (' ');
754         }
755         else
756 !         move (i - menu->top + menu->offset, SidebarWidth + 3);
757   
758           print_enriched_string (menu->color(i), (unsigned char *) buf, 1);
759           SETCOLOR (MT_COLOR_NORMAL);          
760 ***************
761 *** 243,256 ****
762           BKGDSET (MT_COLOR_INDICATOR);
763         }
764   
765 !       CLEARLINE (i - menu->top + menu->offset);
766         print_enriched_string (menu->color(i), (unsigned char *) buf, i != menu->current);
767           SETCOLOR (MT_COLOR_NORMAL);
768           BKGDSET (MT_COLOR_NORMAL);
769         }
770       }
771       else
772 !       CLEARLINE (i - menu->top + menu->offset);
773     }
774     menu->redraw = 0;
775   }
776 --- 245,258 ----
777           BKGDSET (MT_COLOR_INDICATOR);
778         }
779   
780 !       CLEARLINE_WIN (i - menu->top + menu->offset);
781         print_enriched_string (menu->color(i), (unsigned char *) buf, i != menu->current);
782           SETCOLOR (MT_COLOR_NORMAL);
783           BKGDSET (MT_COLOR_NORMAL);
784         }
785       }
786       else
787 !       CLEARLINE_WIN (i - menu->top + menu->offset);
788     }
789     menu->redraw = 0;
790   }
791 ***************
792 *** 265,271 ****
793       return;
794     }
795     
796 !   move (menu->oldcurrent + menu->offset - menu->top, 0);
797     SETCOLOR (MT_COLOR_NORMAL);
798     BKGDSET (MT_COLOR_NORMAL);
799   
800 --- 267,273 ----
801       return;
802     }
803     
804 !   move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth);
805     SETCOLOR (MT_COLOR_NORMAL);
806     BKGDSET (MT_COLOR_NORMAL);
807   
808 ***************
809 *** 280,292 ****
810         clrtoeol ();
811         menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
812         menu_pad_string (buf, sizeof (buf));
813 !       move (menu->oldcurrent + menu->offset - menu->top, 3);
814         print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
815         SETCOLOR (MT_COLOR_NORMAL);
816       }
817   
818       /* now draw it in the new location */
819 !     move (menu->current + menu->offset - menu->top, 0);
820       attrset (menu->color (menu->current));
821       ADDCOLOR (MT_COLOR_INDICATOR);
822       addstr ("->");
823 --- 282,294 ----
824         clrtoeol ();
825         menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
826         menu_pad_string (buf, sizeof (buf));
827 !       move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth + 3);
828         print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
829         SETCOLOR (MT_COLOR_NORMAL);
830       }
831   
832       /* now draw it in the new location */
833 !     move (menu->current + menu->offset - menu->top, SidebarWidth);
834       attrset (menu->color (menu->current));
835       ADDCOLOR (MT_COLOR_INDICATOR);
836       addstr ("->");
837 ***************
838 *** 307,313 ****
839       attrset (menu->color (menu->current));
840       ADDCOLOR (MT_COLOR_INDICATOR);
841       BKGDSET (MT_COLOR_INDICATOR);
842 !     CLEARLINE (menu->current - menu->top + menu->offset);
843       print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
844       SETCOLOR (MT_COLOR_NORMAL);
845       BKGDSET (MT_COLOR_NORMAL);
846 --- 309,315 ----
847       attrset (menu->color (menu->current));
848       ADDCOLOR (MT_COLOR_INDICATOR);
849       BKGDSET (MT_COLOR_INDICATOR);
850 !     CLEARLINE_WIN (menu->current - menu->top + menu->offset);
851       print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
852       SETCOLOR (MT_COLOR_NORMAL);
853       BKGDSET (MT_COLOR_NORMAL);
854 ***************
855 *** 319,325 ****
856   {
857     char buf[STRING];
858     
859 !   move (menu->current + menu->offset - menu->top, 0);
860     menu_make_entry (buf, sizeof (buf), menu, menu->current);
861     menu_pad_string (buf, sizeof (buf));
862   
863 --- 321,327 ----
864   {
865     char buf[STRING];
866     
867 !   move (menu->current + menu->offset - menu->top, SidebarWidth);
868     menu_make_entry (buf, sizeof (buf), menu, menu->current);
869     menu_pad_string (buf, sizeof (buf));
870   
871 diff -N -c -r mutt-1.5.9i-orig/mutt_curses.h mutt-1.5.9i-patched/mutt_curses.h
872 *** mutt-1.5.9i-orig/mutt_curses.h      2004-06-17 16:33:04.000000000 -0400
873 --- mutt-1.5.9i-patched/mutt_curses.h   2005-05-25 14:53:34.000000000 -0400
874 ***************
875 *** 59,64 ****
876 --- 59,65 ----
877   #undef lines
878   #endif /* lines */
879   
880 + #define CLEARLINE_WIN(x) move(x,SidebarWidth), clrtoeol()
881   #define CLEARLINE(x) move(x,0), clrtoeol()
882   #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
883   #define BEEP() do { if (option (OPTBEEP)) beep(); } while (0)
884 ***************
885 *** 121,126 ****
886 --- 122,128 ----
887     MT_COLOR_BOLD,
888     MT_COLOR_UNDERLINE,
889     MT_COLOR_INDEX,
890 +   MT_COLOR_NEW,
891     MT_COLOR_MAX
892   };
893   
894 diff -N -c -r mutt-1.5.9i-orig/mutt.h mutt-1.5.9i-patched/mutt.h
895 *** mutt-1.5.9i-orig/mutt.h     2005-02-28 10:13:57.000000000 -0500
896 --- mutt-1.5.9i-patched/mutt.h  2005-05-25 14:53:34.000000000 -0400
897 ***************
898 *** 415,420 ****
899 --- 415,421 ----
900     OPTSAVEEMPTY,
901     OPTSAVENAME,
902     OPTSCORE,
903 +   OPTSIDEBAR,
904     OPTSIGDASHES,
905     OPTSIGONTOP,
906     OPTSORTRE,
907 ***************
908 *** 799,804 ****
909 --- 800,806 ----
910   {
911     char *path;
912     FILE *fp;
913 +   time_t atime;
914     time_t mtime;
915     time_t mtime_cur;           /* used with maildir folders */
916     off_t size;
917 ***************
918 *** 834,839 ****
919 --- 836,842 ----
920     unsigned int quiet : 1;     /* inhibit status messages? */
921     unsigned int collapsed : 1;   /* are all threads collapsed? */
922     unsigned int closing : 1;   /* mailbox is being closed */
923 +   unsigned int peekonly : 1;  /* just taking a glance, revert atime */
924   } CONTEXT;
925   
926   typedef struct attachptr
927 diff -N -c -r mutt-1.5.9i-orig/muttlib.c mutt-1.5.9i-patched/muttlib.c
928 *** mutt-1.5.9i-orig/muttlib.c  2005-02-12 14:30:16.000000000 -0500
929 --- mutt-1.5.9i-patched/muttlib.c       2005-05-25 14:53:34.000000000 -0400
930 ***************
931 *** 1020,1026 ****
932         ch = *src++; /* pad char */
933         /* calculate space left on line.  if we've already written more data
934            than will fit on the line, ignore the rest of the line */
935 !       count = (COLS < destlen ? COLS : destlen);
936         if (count > col)
937         {
938           count -= col; /* how many columns left on this line */
939 --- 1020,1029 ----
940         ch = *src++; /* pad char */
941         /* calculate space left on line.  if we've already written more data
942            than will fit on the line, ignore the rest of the line */
943 !       if ( DrawFullLine )
944 !         count = (COLS < destlen ? COLS : destlen);
945 !       else
946 !         count = ((COLS-SidebarWidth) < destlen ? COLS - SidebarWidth : destlen);
947         if (count > col)
948         {
949           count -= col; /* how many columns left on this line */
950 diff -N -c -r mutt-1.5.9i-orig/Muttrc mutt-1.5.9i-patched/Muttrc
951 *** mutt-1.5.9i-orig/Muttrc     2005-03-13 11:37:11.000000000 -0500
952 --- mutt-1.5.9i-patched/Muttrc  2005-05-25 14:53:34.000000000 -0400
953 ***************
954 *** 1770,1775 ****
955 --- 1770,1795 ----
956   # function.
957   # 
958   # 
959 + # set sidebar_visible=no
960 + #
961 + # Name: sidebar_visible
962 + # Type: boolean
963 + # Default: no
964 + # 
965 + # 
966 + # This specifies whether or not to show sidebar (left-side list of folders).
967 + # 
968 + # 
969 + # set sidebar_width=0
970 + #
971 + # Name: sidebar_width
972 + # Type: number
973 + # Default: 0
974 + # 
975 + # 
976 + # The width of the sidebar.
977 + # 
978 + # 
979   # set crypt_autosign=no
980   #
981   # Name: crypt_autosign
982 diff -N -c -r mutt-1.5.9i-orig/mx.c mutt-1.5.9i-patched/mx.c
983 *** mutt-1.5.9i-orig/mx.c       2005-02-03 13:47:53.000000000 -0500
984 --- mutt-1.5.9i-patched/mx.c    2005-05-25 14:53:34.000000000 -0400
985 ***************
986 *** 620,625 ****
987 --- 620,626 ----
988    *            M_APPEND        open mailbox for appending
989    *            M_READONLY      open mailbox in read-only mode
990    *            M_QUIET         only print error messages
991 +  *            M_PEEK          revert atime where applicable
992    *    ctx     if non-null, context struct to use
993    */
994   CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT *pctx)
995 ***************
996 *** 639,644 ****
997 --- 640,647 ----
998       ctx->quiet = 1;
999     if (flags & M_READONLY)
1000       ctx->readonly = 1;
1001 +   if (flags & M_PEEK)
1002 +     ctx->peekonly = 1;
1003   
1004     if (flags & (M_APPEND|M_NEWFOLDER))
1005     {
1006 ***************
1007 *** 738,746 ****
1008 --- 741,761 ----
1009   void mx_fastclose_mailbox (CONTEXT *ctx)
1010   {
1011     int i;
1012 + #ifndef BUFFY_SIZE
1013 +   struct utimbuf ut;
1014 + #endif
1015   
1016     if(!ctx) 
1017       return;
1018 + #ifndef BUFFY_SIZE
1019 +   /* fix up the times so buffy won't get confused */
1020 +   if (ctx->peekonly && ctx->path && ctx->mtime > ctx->atime)
1021 +   {
1022 +     ut.actime = ctx->atime;
1023 +     ut.modtime = ctx->mtime;
1024 +     utime (ctx->path, &ut); 
1025 +   }
1026 + #endif
1027     
1028   #ifdef USE_IMAP
1029     if (ctx->magic == M_IMAP)
1030 diff -N -c -r mutt-1.5.9i-orig/OPS mutt-1.5.9i-patched/OPS
1031 *** mutt-1.5.9i-orig/OPS        2005-02-19 08:49:37.000000000 -0500
1032 --- mutt-1.5.9i-patched/OPS     2005-05-25 14:53:34.000000000 -0400
1033 ***************
1034 *** 175,177 ****
1035 --- 175,182 ----
1036   OP_MAIN_SHOW_LIMIT "show currently active limit pattern"
1037   OP_MAIN_COLLAPSE_THREAD "collapse/uncollapse current thread"
1038   OP_MAIN_COLLAPSE_ALL "collapse/uncollapse all threads"
1039 + OP_SIDEBAR_SCROLL_UP "scroll the mailbox pane up 1 page"
1040 + OP_SIDEBAR_SCROLL_DOWN "scroll the mailbox pane down 1 page"
1041 + OP_SIDEBAR_NEXT "go down to next mailbox"
1042 + OP_SIDEBAR_PREV "go to previous mailbox"
1043 + OP_SIDEBAR_OPEN "open hilighted mailbox"
1044 diff -N -c -r mutt-1.5.9i-orig/pager.c mutt-1.5.9i-patched/pager.c
1045 *** mutt-1.5.9i-orig/pager.c    2005-02-12 14:30:16.000000000 -0500
1046 --- mutt-1.5.9i-patched/pager.c 2005-05-25 14:53:34.000000000 -0400
1047 ***************
1048 *** 30,35 ****
1049 --- 30,36 ----
1050   #include "pager.h"
1051   #include "attach.h"
1052   #include "mbyte.h"
1053 + #include "sidebar.h"
1054   
1055   #include "mx.h"
1056   
1057 ***************
1058 *** 1036,1042 ****
1059     wchar_t wc;
1060     mbstate_t mbstate;
1061   
1062 !   int wrap_cols = COLS - WrapMargin;
1063     
1064     if (wrap_cols <= 0)
1065       wrap_cols = COLS;
1066 --- 1037,1043 ----
1067     wchar_t wc;
1068     mbstate_t mbstate;
1069   
1070 !   int wrap_cols = COLS - WrapMargin - SidebarWidth;
1071     
1072     if (wrap_cols <= 0)
1073       wrap_cols = COLS;
1074 ***************
1075 *** 1669,1675 ****
1076       if ((redraw & REDRAW_BODY) || topline != oldtopline)
1077       {
1078         do {
1079 !       move (bodyoffset, 0);
1080         curline = oldtopline = topline;
1081         lines = 0;
1082         force_redraw = 0;
1083 --- 1670,1676 ----
1084       if ((redraw & REDRAW_BODY) || topline != oldtopline)
1085       {
1086         do {
1087 !       move (bodyoffset, SidebarWidth);
1088         curline = oldtopline = topline;
1089         lines = 0;
1090         force_redraw = 0;
1091 ***************
1092 *** 1682,1687 ****
1093 --- 1683,1689 ----
1094                             &QuoteList, &q_level, &force_redraw, &SearchRE) > 0)
1095             lines++;
1096           curline++;
1097 +               move(lines + bodyoffset, SidebarWidth);
1098         }
1099         last_offset = lineInfo[curline].offset;
1100         } while (force_redraw);
1101 ***************
1102 *** 1695,1700 ****
1103 --- 1697,1703 ----
1104           addch ('~');
1105         addch ('\n');
1106         lines++;
1107 +       move(lines + bodyoffset, SidebarWidth);
1108         }
1109         /* We are going to update the pager status bar, so it isn't
1110          * necessary to reset to normal color now. */
1111 ***************
1112 *** 1707,1728 ****
1113         /* print out the pager status bar */
1114         SETCOLOR (MT_COLOR_STATUS);
1115         BKGDSET (MT_COLOR_STATUS);
1116 !       CLEARLINE (statusoffset);
1117         if (IsHeader (extra))
1118         {
1119 !       size_t l1 = (COLS - 9) * MB_LEN_MAX;
1120         size_t l2 = sizeof (buffer);
1121         _mutt_make_string (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt),
1122                            Context, extra->hdr, M_FORMAT_MAKEPRINT);
1123         }
1124         else if (IsMsgAttach (extra))
1125         {
1126 !       size_t l1 = (COLS - 9) * MB_LEN_MAX;
1127         size_t l2 = sizeof (buffer);
1128         _mutt_make_string (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt),
1129                            Context, extra->bdy->hdr, M_FORMAT_MAKEPRINT);
1130         }
1131 !       mutt_paddstr (COLS-10, IsHeader (extra) || IsMsgAttach (extra) ?
1132                     buffer : banner);
1133         addstr (" -- (");
1134         if (last_pos < sb.st_size - 1)
1135 --- 1710,1731 ----
1136         /* print out the pager status bar */
1137         SETCOLOR (MT_COLOR_STATUS);
1138         BKGDSET (MT_COLOR_STATUS);
1139 !       CLEARLINE_WIN(statusoffset);
1140         if (IsHeader (extra))
1141         {
1142 !       size_t l1 = ((COLS - 9) * MB_LEN_MAX) - (SidebarWidth * MB_LEN_MAX);
1143         size_t l2 = sizeof (buffer);
1144         _mutt_make_string (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt),
1145                            Context, extra->hdr, M_FORMAT_MAKEPRINT);
1146         }
1147         else if (IsMsgAttach (extra))
1148         {
1149 !       size_t l1 = (COLS - 9) * MB_LEN_MAX - (SidebarWidth * MB_LEN_MAX);
1150         size_t l2 = sizeof (buffer);
1151         _mutt_make_string (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt),
1152                            Context, extra->bdy->hdr, M_FORMAT_MAKEPRINT);
1153         }
1154 !       mutt_paddstr (COLS-10-SidebarWidth, IsHeader (extra) || IsMsgAttach (extra) ?
1155                     buffer : banner);
1156         addstr (" -- (");
1157         if (last_pos < sb.st_size - 1)
1158 ***************
1159 *** 1738,1752 ****
1160         /* redraw the pager_index indicator, because the
1161          * flags for this message might have changed. */
1162         menu_redraw_current (index);
1163
1164         /* print out the index status bar */
1165         menu_status_line (buffer, sizeof (buffer), index, NONULL(Status));
1166 !  
1167 !       move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), 0);
1168         SETCOLOR (MT_COLOR_STATUS);
1169 !       mutt_paddstr (COLS, buffer);
1170         SETCOLOR (MT_COLOR_NORMAL);
1171       }
1172   
1173       redraw = 0;
1174   
1175 --- 1741,1758 ----
1176         /* redraw the pager_index indicator, because the
1177          * flags for this message might have changed. */
1178         menu_redraw_current (index);
1179 !         draw_sidebar(MENU_PAGER);
1180         /* print out the index status bar */
1181         menu_status_line (buffer, sizeof (buffer), index, NONULL(Status));
1182 !       move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)),
1183 !                 SidebarWidth);
1184         SETCOLOR (MT_COLOR_STATUS);
1185 !       mutt_paddstr (COLS-SidebarWidth, buffer);
1186         SETCOLOR (MT_COLOR_NORMAL);
1187       }
1188 +       /* if we're not using the index, update every time */
1189 +       if ( index == 0 )
1190 +               draw_sidebar(MENU_PAGER);
1191   
1192       redraw = 0;
1193   
1194 ***************
1195 *** 2624,2629 ****
1196 --- 2630,2641 ----
1197           redraw = REDRAW_FULL;
1198           break;
1199   
1200 +         case OP_SIDEBAR_SCROLL_UP:
1201 +         case OP_SIDEBAR_SCROLL_DOWN:
1202 +         case OP_SIDEBAR_NEXT:
1203 +         case OP_SIDEBAR_PREV:
1204 +           scroll_sidebar(ch, MENU_PAGER);
1205 +               break;
1206         default:
1207         ch = -1;
1208         break;
1209 diff -N -c -r mutt-1.5.9i-orig/PATCHES mutt-1.5.9i-patched/PATCHES
1210 *** mutt-1.5.9i-orig/PATCHES    2005-03-13 11:33:06.000000000 -0500
1211 --- mutt-1.5.9i-patched/PATCHES 2005-06-28 15:36:06.000000000 -0400
1212 ***************
1213 *** 0 ****
1214 --- 1 ----
1215 + patch-1.5.9i.sidebar.20050628
1216 diff -N -c -r mutt-1.5.9i-orig/sidebar.c mutt-1.5.9i-patched/sidebar.c
1217 *** mutt-1.5.9i-orig/sidebar.c  1969-12-31 19:00:00.000000000 -0500
1218 --- mutt-1.5.9i-patched/sidebar.c       2005-06-28 15:32:07.000000000 -0400
1219 ***************
1220 *** 0 ****
1221 --- 1,264 ----
1222 + /*
1223 +  * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu>
1224 +  * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com>
1225 +  * 
1226 +  *     This program is free software; you can redistribute it and/or modify
1227 +  *     it under the terms of the GNU General Public License as published by
1228 +  *     the Free Software Foundation; either version 2 of the License, or
1229 +  *     (at your option) any later version.
1230 +  * 
1231 +  *     This program is distributed in the hope that it will be useful,
1232 +  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
1233 +  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1234 +  *     GNU General Public License for more details.
1235 +  * 
1236 +  *     You should have received a copy of the GNU General Public License
1237 +  *     along with this program; if not, write to the Free Software
1238 +  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
1239 +  */ 
1240
1241
1242 + #if HAVE_CONFIG_H
1243 + # include "config.h"
1244 + #endif
1245
1246 + #include "mutt.h"
1247 + #include "mutt_menu.h"
1248 + #include "mutt_curses.h"
1249 + #include "sidebar.h"
1250 + #include "buffy.h"
1251 + #include <libgen.h>
1252 + #include "keymap.h"
1253 + #include <stdbool.h>
1254
1255 + /*BUFFY *CurBuffy = 0;*/
1256 + static BUFFY *TopBuffy = 0;
1257 + static BUFFY *BottomBuffy = 0;
1258 + static int known_lines = 0;
1259
1260 + static int quick_log10(int n)
1261 + {
1262 +         char string[32];
1263 +         sprintf(string, "%d", n);
1264 +         return strlen(string);
1265 + }
1266
1267 + void calc_boundaries (int menu)
1268 + {
1269 +       BUFFY *tmp = Incoming;
1270
1271 +       if ( known_lines != LINES ) {
1272 +               TopBuffy = BottomBuffy = 0;
1273 +               known_lines = LINES;
1274 +       }
1275 +       for ( ; tmp->next != 0; tmp = tmp->next )
1276 +               tmp->next->prev = tmp;
1277
1278 +       if ( TopBuffy == 0 && BottomBuffy == 0 )
1279 +               TopBuffy = Incoming;
1280 +       if ( BottomBuffy == 0 ) {
1281 +               int count = LINES - 2 - (menu != MENU_PAGER || option(OPTSTATUSONTOP));
1282 +               BottomBuffy = TopBuffy;
1283 +               while ( --count && BottomBuffy->next )
1284 +                       BottomBuffy = BottomBuffy->next;
1285 +       }
1286 +       else if ( TopBuffy == CurBuffy->next ) {
1287 +               int count = LINES - 2 - (menu != MENU_PAGER);
1288 +               BottomBuffy = CurBuffy;
1289 +               tmp = BottomBuffy;
1290 +               while ( --count && tmp->prev)
1291 +                       tmp = tmp->prev;
1292 +               TopBuffy = tmp;
1293 +       }
1294 +       else if ( BottomBuffy == CurBuffy->prev ) {
1295 +               int count = LINES - 2 - (menu != MENU_PAGER);
1296 +               TopBuffy = CurBuffy;
1297 +               tmp = TopBuffy;
1298 +               while ( --count && tmp->next )
1299 +                       tmp = tmp->next;
1300 +               BottomBuffy = tmp;
1301 +       }
1302 + }
1303
1304 + char *make_sidebar_entry(char *box, int size, int new)
1305 + {
1306 +       static char *entry = 0;
1307 +       char *c;
1308 +       int i = 0;
1309
1310 +       c = realloc(entry, SidebarWidth + 1);
1311 +       if ( c ) entry = c;
1312 +       entry[SidebarWidth] = 0;
1313 +       for (; i < SidebarWidth; entry[i++] = ' ' );
1314 +       i = strlen(box);
1315 +       strncpy( entry, box, i < SidebarWidth ? i :SidebarWidth );
1316
1317 +       if ( new ) 
1318 +               sprintf(
1319 +                       entry + SidebarWidth - 5 - quick_log10(size) - quick_log10(new),
1320 +                       "% d(%d)", size, new);
1321 +       else
1322 +               sprintf( entry + SidebarWidth - 3 - quick_log10(size), "% d", size);
1323 +       return entry;
1324 + }
1325
1326 + void set_curbuffy(char buf[LONG_STRING])
1327 + {
1328 +   BUFFY* tmp = CurBuffy = Incoming;
1329
1330 +   if (!Incoming)
1331 +     return;
1332
1333 +   while(1) {
1334 +     if(!strcmp(tmp->path, buf)) {
1335 +       CurBuffy = tmp;
1336 +       break;
1337 +     }
1338
1339 +     if(tmp->next)
1340 +       tmp = tmp->next;
1341 +     else
1342 +       break;
1343 +   }
1344 + }
1345
1346 + int draw_sidebar(int menu) {
1347
1348 +       int lines = option(OPTHELP) ? 1 : 0;
1349 +       BUFFY *tmp;
1350 + #ifndef USE_SLANG_CURSES
1351 +         attr_t attrs;
1352 + #endif
1353 +         short color_pair;
1354
1355 +         static bool initialized = false;
1356 +         static int prev_show_value;
1357 +         static short saveSidebarWidth;
1358
1359 +         /* initialize first time */
1360 +         if(!initialized) {
1361 +                 prev_show_value = option(OPTSIDEBAR);
1362 +                 saveSidebarWidth = SidebarWidth;
1363 +                 if(!option(OPTSIDEBAR)) SidebarWidth = 0;
1364 +                 initialized = true;
1365 +         }
1366
1367 +         /* save or restore the value SidebarWidth */
1368 +         if(prev_show_value != option(OPTSIDEBAR)) {
1369 +                 if(prev_show_value && !option(OPTSIDEBAR)) {
1370 +                         saveSidebarWidth = SidebarWidth;
1371 +                         SidebarWidth = 0;
1372 +                 } else if(!prev_show_value && option(OPTSIDEBAR)) {
1373 +                         SidebarWidth = saveSidebarWidth;
1374 +                 }
1375 +                 prev_show_value = option(OPTSIDEBAR);
1376 +         }
1377
1378
1379 +       if ( SidebarWidth == 0 ) return 0;
1380
1381 +         /* get attributes for divider */
1382 +       SETCOLOR(MT_COLOR_STATUS);
1383 + #ifndef USE_SLANG_CURSES
1384 +         attr_get(&attrs, &color_pair, 0);
1385 + #else
1386 +         color_pair = attr_get();
1387 + #endif
1388 +         SETCOLOR(MT_COLOR_NORMAL);
1389
1390 +       /* draw the divider */
1391
1392 +       for ( ; lines < LINES-1-(menu != MENU_PAGER || option(OPTSTATUSONTOP)); lines++ ) {
1393 +               move(lines, SidebarWidth - 1);
1394 +               addch('|');
1395 + #ifndef USE_SLANG_CURSES
1396 +                 mvchgat(lines, SidebarWidth - 1, 1, 0, color_pair, NULL);
1397 + #endif
1398 +       }
1399 +       if ( Incoming == 0 ) return 0;
1400 +       lines = option(OPTHELP) ? 1 : 0; /* go back to the top */
1401
1402 +       if ( known_lines != LINES || TopBuffy == 0 || BottomBuffy == 0 ) 
1403 +               calc_boundaries(menu);
1404 +       if ( CurBuffy == 0 ) CurBuffy = Incoming;
1405
1406 +       tmp = TopBuffy;
1407
1408 +       SETCOLOR(MT_COLOR_NORMAL);
1409
1410 +       for ( ; tmp && lines < LINES-1 - (menu != MENU_PAGER || option(OPTSTATUSONTOP)); tmp = tmp->next ) {
1411 +               if ( tmp == CurBuffy )
1412 +                       SETCOLOR(MT_COLOR_INDICATOR);
1413 +               else if ( tmp->msg_unread > 0 )
1414 +                       SETCOLOR(MT_COLOR_NEW);
1415 +               else
1416 +                       SETCOLOR(MT_COLOR_NORMAL);
1417
1418 +               move( lines, 0 );
1419 +               if ( Context && !strcmp( tmp->path, Context->path ) ) {
1420 +                       tmp->msg_unread = Context->unread;
1421 +                       tmp->msgcount = Context->msgcount;
1422 +               }
1423 +                 printw( "%.*s", SidebarWidth,
1424 +                         make_sidebar_entry(basename(tmp->path), tmp->msgcount,
1425 +                         tmp->msg_unread));
1426 +               lines++;
1427 +       }
1428 +       SETCOLOR(MT_COLOR_NORMAL);
1429 +       for ( ; lines < LINES-1 - (menu != MENU_PAGER || option(OPTSTATUSONTOP)); lines++ ) {
1430 +               int i = 0;
1431 +               move( lines, 0 );
1432 +               for ( ; i < SidebarWidth - 1; i++ )
1433 +                       addch(' ');
1434 +       }
1435 +       return 0;
1436 + }
1437
1438
1439 + void set_buffystats(CONTEXT* Context)
1440 + {
1441 +         BUFFY *tmp = Incoming;
1442 +         while(tmp) {
1443 +                 if(Context && !strcmp(tmp->path, Context->path)) {
1444 +                       tmp->msg_unread = Context->unread;
1445 +                       tmp->msgcount = Context->msgcount;
1446 +                         break;
1447 +                 }
1448 +                 tmp = tmp->next;
1449 +         }
1450 + }
1451
1452 + void scroll_sidebar(int op, int menu)
1453 + {
1454 +         if(!SidebarWidth) return;
1455 +         if(!CurBuffy) return;
1456
1457 +       switch (op) {
1458 +               case OP_SIDEBAR_NEXT:
1459 +                       if ( CurBuffy->next == NULL ) return;
1460 +                       CurBuffy = CurBuffy->next;
1461 +                       break;
1462 +               case OP_SIDEBAR_PREV:
1463 +                       if ( CurBuffy->prev == NULL ) return;
1464 +                       CurBuffy = CurBuffy->prev;
1465 +                       break;
1466 +               case OP_SIDEBAR_SCROLL_UP:
1467 +                       CurBuffy = TopBuffy;
1468 +                       if ( CurBuffy != Incoming ) {
1469 +                               calc_boundaries(menu);
1470 +                               CurBuffy = CurBuffy->prev;
1471 +                       }
1472 +                       break;
1473 +               case OP_SIDEBAR_SCROLL_DOWN:
1474 +                       CurBuffy = BottomBuffy;
1475 +                       if ( CurBuffy->next ) {
1476 +                               calc_boundaries(menu);
1477 +                               CurBuffy = CurBuffy->next;
1478 +                       }
1479 +                       break;
1480 +               default:
1481 +                       return;
1482 +       }
1483 +       calc_boundaries(menu);
1484 +       draw_sidebar(menu);
1485 + }
1486 diff -N -c -r mutt-1.5.9i-orig/sidebar.h mutt-1.5.9i-patched/sidebar.h
1487 *** mutt-1.5.9i-orig/sidebar.h  1969-12-31 19:00:00.000000000 -0500
1488 --- mutt-1.5.9i-patched/sidebar.h       2005-05-25 14:53:34.000000000 -0400
1489 ***************
1490 *** 0 ****
1491 --- 1,36 ----
1492 + /*
1493 +  * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu>
1494 +  * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com>
1495 +  * 
1496 +  *     This program is free software; you can redistribute it and/or modify
1497 +  *     it under the terms of the GNU General Public License as published by
1498 +  *     the Free Software Foundation; either version 2 of the License, or
1499 +  *     (at your option) any later version.
1500 +  * 
1501 +  *     This program is distributed in the hope that it will be useful,
1502 +  *     but WITHOUT ANY WARRANTY; without even the implied warranty of
1503 +  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1504 +  *     GNU General Public License for more details.
1505 +  * 
1506 +  *     You should have received a copy of the GNU General Public License
1507 +  *     along with this program; if not, write to the Free Software
1508 +  *     Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
1509 +  */ 
1510
1511 + #ifndef SIDEBAR_H
1512 + #define SIDEBAR_H
1513
1514 + struct MBOX_LIST {
1515 +       char *path;
1516 +       int msgcount;
1517 +       int new;
1518 + } MBLIST;
1519
1520 + /* parameter is whether or not to go to the status line */
1521 + /* used for omitting the last | that covers up the status bar in the index */
1522 + int draw_sidebar(int);
1523 + void scroll_sidebar(int, int);
1524 + void set_curbuffy(char*);
1525 + void set_buffystats(CONTEXT*);
1526
1527 + #endif /* SIDEBAR_H */