1 *** mutt-1.5.24-orig/buffy.c 2015-08-30 12:06:38.000000000 -0500
2 --- mutt-1.5.24/buffy.c 2015-09-16 23:18:13.000000000 -0500
9 + static int buffy_compare_name(const void *a, const void *b) {
10 + const BUFFY *b1 = * (BUFFY * const *) a;
11 + const BUFFY *b2 = * (BUFFY * const *) b;
13 + return mutt_strcoll(b1->path, b2->path);
16 + static BUFFY *buffy_sort(BUFFY *b)
23 + if (!option(OPTSIDEBARSORT))
26 + for (; tmp != NULL; tmp = tmp->next)
29 + ary = (BUFFY **) safe_calloc(buffycount, sizeof (*ary));
32 + for (i = 0; tmp != NULL; tmp = tmp->next, i++) {
36 + qsort(ary, buffycount, sizeof(*ary), buffy_compare_name);
38 + for (i = 0; i < buffycount - 1; i++) {
39 + ary[i]->next = ary[i+1];
41 + ary[buffycount - 1]->next = NULL;
42 + for (i = 1; i < buffycount; i++) {
43 + ary[i]->prev = ary[i-1];
45 + ary[0]->prev = NULL;
52 BUFFY *mutt_find_mailbox (const char *path)
58 static BUFFY *buffy_new (const char *path)
64 buffy = (BUFFY *) safe_calloc (1, sizeof (BUFFY));
65 strfcpy (buffy->path, path, sizeof (buffy->path));
66 + r = realpath(path, rp);
67 + strfcpy (buffy->realpath, r ? rp : path, sizeof (buffy->realpath));
73 p = realpath (buf, f1);
74 for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next))
76 ! q = realpath ((*tmp)->path, f2);
77 ! if (mutt_strcmp (p ? p : buf, q ? q : (*tmp)->path) == 0)
79 dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path));
82 p = realpath (buf, f1);
83 for (tmp = &Incoming; *tmp; tmp = &((*tmp)->next))
85 ! q = (*tmp)->realpath;
86 ! if (mutt_strcmp (p ? p : buf, q) == 0)
88 dprint(3,(debugfile,"mailbox '%s' already registered as '%s'\n", buf, (*tmp)->path));
96 + Incoming = buffy_sort(Incoming);
106 + if (option(OPTSIDEBAR) && mailbox->msg_unread > 0) {
111 if ((dirp = opendir (path)) == NULL)
121 + /* update message counts for the sidebar */
122 + void buffy_maildir_update (BUFFY* mailbox)
124 + char path[_POSIX_PATH_MAX];
129 + if(!option(OPTSIDEBAR))
132 + mailbox->msgcount = 0;
133 + mailbox->msg_unread = 0;
134 + mailbox->msg_flagged = 0;
136 + snprintf (path, sizeof (path), "%s/new", mailbox->path);
138 + if ((dirp = opendir (path)) == NULL)
140 + mailbox->magic = 0;
144 + while ((de = readdir (dirp)) != NULL)
146 + if (*de->d_name == '.')
149 + if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
151 + mailbox->msgcount++;
152 + mailbox->msg_unread++;
157 + snprintf (path, sizeof (path), "%s/cur", mailbox->path);
159 + if ((dirp = opendir (path)) == NULL)
161 + mailbox->magic = 0;
165 + while ((de = readdir (dirp)) != NULL)
167 + if (*de->d_name == '.')
170 + if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
171 + mailbox->msgcount++;
172 + if ((p = strstr (de->d_name, ":2,"))) {
173 + if (!strchr (p + 3, 'T')) {
174 + if (!strchr (p + 3, 'S'))
175 + mailbox->msg_unread++;
176 + if (strchr(p + 3, 'F'))
177 + mailbox->msg_flagged++;
183 + mailbox->sb_last_checked = time(NULL);
187 /* returns 1 if mailbox has new mail */
188 static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
193 statcheck = sb->st_mtime > sb->st_atime
194 || (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
197 if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
201 statcheck = sb->st_mtime > sb->st_atime
202 || (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
203 ! if ((!option(OPTSIDEBAR) && statcheck) || (option(OPTSIDEBAR) && mailbox->msg_unread > 0))
205 if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
213 + /* update message counts for the sidebar */
214 + void buffy_mbox_update (BUFFY* mailbox, struct stat *sb)
216 + CONTEXT *ctx = NULL;
218 + if(!option(OPTSIDEBAR))
220 + if(mailbox->sb_last_checked > sb->st_mtime && mailbox->msgcount != 0)
221 + return; /* no check necessary */
223 + ctx = mx_open_mailbox(mailbox->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL);
226 + mailbox->msgcount = ctx->msgcount;
227 + mailbox->msg_unread = ctx->unread;
228 + mailbox->msg_flagged = ctx->flagged;
229 + mailbox->sb_last_checked = time(NULL);
230 + mx_close_mailbox(ctx, 0);
234 int mutt_buffy_check (int force)
242 if (buffy_mbox_hasnew (tmp, &sb) > 0)
247 if (buffy_maildir_hasnew (tmp) > 0)
260 + buffy_mbox_update (tmp, &sb);
261 if (buffy_mbox_hasnew (tmp, &sb) > 0)
266 + buffy_maildir_update (tmp);
267 if (buffy_maildir_hasnew (tmp) > 0)
272 ! mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked);
277 *** mutt-1.5.24-orig/buffy.h 2015-08-30 12:06:38.000000000 -0500
278 --- mutt-1.5.24/buffy.h 2015-09-16 23:18:13.000000000 -0500
282 typedef struct buffy_t
284 char path[_POSIX_PATH_MAX];
285 + char realpath[_POSIX_PATH_MAX];
287 struct buffy_t *next;
288 + struct buffy_t *prev;
289 short new; /* mailbox has new mail */
290 + int msgcount; /* total number of messages */
291 + int msg_unread; /* number of unread messages */
292 + int msg_flagged; /* number of flagged messages */
293 short notified; /* user has been notified */
294 short magic; /* mailbox type */
295 short newly_created; /* mbox or mmdf just popped into existence */
296 time_t last_visited; /* time of last exit from this mailbox */
297 + time_t sb_last_checked; /* time of last buffy check from sidebar */
301 *** mutt-1.5.24-orig/color.c 2015-08-30 12:06:38.000000000 -0500
302 --- mutt-1.5.24/color.c 2015-09-16 23:18:13.000000000 -0500
306 { "underline", MT_COLOR_UNDERLINE },
307 { "index", MT_COLOR_INDEX },
308 { "prompt", MT_COLOR_PROMPT },
309 + { "sidebar_new", MT_COLOR_NEW },
310 + { "sidebar_flagged", MT_COLOR_FLAGGED },
314 *** mutt-1.5.24-orig/compose.c 2015-08-30 12:06:38.000000000 -0500
315 --- mutt-1.5.24/compose.c 2015-09-16 23:18:13.000000000 -0500
319 #define HDR_XOFFSET 10
320 #define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
321 ! #define W (COLS - HDR_XOFFSET)
323 static const char * const Prompts[] =
327 #define HDR_XOFFSET 10
328 #define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
329 ! #define W (COLS - HDR_XOFFSET - SidebarWidth)
331 static const char * const Prompts[] =
336 static void redraw_crypt_lines (HEADER *msg)
338 ! mvaddstr (HDR_CRYPT, 0, "Security: ");
340 if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
344 static void redraw_crypt_lines (HEADER *msg)
346 ! mvaddstr (HDR_CRYPT, SidebarWidth, "Security: ");
348 if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
352 addstr (_(" (OppEnc mode)"));
355 ! move (HDR_CRYPTINFO, 0);
358 if ((WithCrypto & APPLICATION_PGP)
360 addstr (_(" (OppEnc mode)"));
363 ! move (HDR_CRYPTINFO, SidebarWidth);
366 if ((WithCrypto & APPLICATION_PGP)
369 && (msg->security & ENCRYPT)
372 ! mvprintw (HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "),
373 NONULL(SmimeCryptAlg));
377 && (msg->security & ENCRYPT)
380 ! mvprintw (HDR_CRYPTINFO, SidebarWidth + 40, "%s%s", _("Encrypt with: "),
381 NONULL(SmimeCryptAlg));
389 ! mvaddstr (HDR_MIX, 0, " Mix: ");
397 ! mvaddstr (HDR_MIX, SidebarWidth, " Mix: ");
403 if (t && t[0] == '0' && t[1] == '\0')
406 ! if (c + mutt_strlen (t) + 2 >= COLS)
411 if (t && t[0] == '0' && t[1] == '\0')
414 ! if (c + mutt_strlen (t) + 2 >= COLS - SidebarWidth)
422 rfc822_write_address (buf, sizeof (buf), addr, 1);
423 ! mvprintw (line, 0, TITLE_FMT, Prompts[line - 1]);
424 mutt_paddstr (W, buf);
430 rfc822_write_address (buf, sizeof (buf), addr, 1);
431 ! mvprintw (line, SidebarWidth, TITLE_FMT, Prompts[line - 1]);
432 mutt_paddstr (W, buf);
437 draw_envelope_addr (HDR_TO, msg->env->to);
438 draw_envelope_addr (HDR_CC, msg->env->cc);
439 draw_envelope_addr (HDR_BCC, msg->env->bcc);
440 ! mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
441 mutt_paddstr (W, NONULL (msg->env->subject));
442 draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
443 ! mvprintw (HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]);
444 mutt_paddstr (W, fcc);
448 draw_envelope_addr (HDR_TO, msg->env->to);
449 draw_envelope_addr (HDR_CC, msg->env->cc);
450 draw_envelope_addr (HDR_BCC, msg->env->bcc);
451 ! mvprintw (HDR_SUBJECT, SidebarWidth, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
452 mutt_paddstr (W, NONULL (msg->env->subject));
453 draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
454 ! mvprintw (HDR_FCC, SidebarWidth, TITLE_FMT, Prompts[HDR_FCC - 1]);
455 mutt_paddstr (W, fcc);
462 SETCOLOR (MT_COLOR_STATUS);
463 ! mvaddstr (HDR_ATTACH - 1, 0, _("-- Attachments"));
470 SETCOLOR (MT_COLOR_STATUS);
471 ! mvaddstr (HDR_ATTACH - 1, SidebarWidth, _("-- Attachments"));
477 /* redraw the expanded list so the user can see the result */
479 rfc822_write_address (buf, sizeof (buf), *addr, 1);
480 ! move (line, HDR_XOFFSET);
481 mutt_paddstr (W, buf);
485 /* redraw the expanded list so the user can see the result */
487 rfc822_write_address (buf, sizeof (buf), *addr, 1);
488 ! move (line, HDR_XOFFSET+SidebarWidth);
489 mutt_paddstr (W, buf);
494 if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
496 mutt_str_replace (&msg->env->subject, buf);
497 ! move (HDR_SUBJECT, HDR_XOFFSET);
498 if (msg->env->subject)
499 mutt_paddstr (W, msg->env->subject);
502 if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
504 mutt_str_replace (&msg->env->subject, buf);
505 ! move (HDR_SUBJECT, HDR_XOFFSET + SidebarWidth);
506 if (msg->env->subject)
507 mutt_paddstr (W, msg->env->subject);
512 strfcpy (fcc, buf, fcclen);
513 mutt_pretty_mailbox (fcc, fcclen);
514 ! move (HDR_FCC, HDR_XOFFSET);
515 mutt_paddstr (W, fcc);
520 strfcpy (fcc, buf, fcclen);
521 mutt_pretty_mailbox (fcc, fcclen);
522 ! move (HDR_FCC, HDR_XOFFSET + SidebarWidth);
523 mutt_paddstr (W, fcc);
526 *** mutt-1.5.24-orig/configure.ac 2015-08-30 12:24:20.000000000 -0500
527 --- mutt-1.5.24/configure.ac 2015-09-16 23:18:13.000000000 -0500
531 AC_DEFINE(HAVE_LANGINFO_YESEXPR,1,[ Define if you have <langinfo.h> and nl_langinfo(YESEXPR). ])
534 + AC_CHECK_FUNCS(fmemopen open_memstream)
536 dnl Documentation tools
538 AC_PATH_PROG([OSPCAT], [ospcat], [none])
539 *** mutt-1.5.24-orig/curs_main.c 2015-08-30 12:06:38.000000000 -0500
540 --- mutt-1.5.24/curs_main.c 2015-09-16 23:18:13.000000000 -0500
549 + #include "sidebar.h"
555 menu->redraw |= REDRAW_STATUS;
558 ! if (mutt_buffy_notify () && option (OPTBEEPNEW))
568 if (menu->redraw & REDRAW_FULL)
570 menu_redraw_full (menu);
574 if (menu->menu == MENU_MAIN)
576 menu->redraw |= REDRAW_STATUS;
579 ! if (mutt_buffy_notify ())
581 ! menu->redraw |= REDRAW_STATUS;
582 ! if (option (OPTBEEPNEW))
590 + if(option(OPTSIDEBAR))
591 + menu->redraw |= REDRAW_SIDEBAR;
596 if (menu->redraw & REDRAW_FULL)
598 menu_redraw_full (menu);
599 + draw_sidebar(menu->menu);
601 + } else if(menu->redraw & REDRAW_SIDEBAR) {
602 + draw_sidebar(menu->menu);
603 + menu->redraw &= ~REDRAW_SIDEBAR;
606 if (menu->menu == MENU_MAIN)
611 if (menu->redraw & REDRAW_STATUS)
614 menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
616 move (option (OPTSTATUSONTOP) ? 0 : LINES-2, 0);
617 SETCOLOR (MT_COLOR_STATUS);
618 + set_buffystats(Context);
619 mutt_paddstr (COLS, buf);
621 menu->redraw &= ~REDRAW_STATUS;
624 menu->oldcurrent = -1;
626 if (option (OPTARROWCURSOR))
627 ! move (menu->current - menu->top + menu->offset, 2);
628 else if (option (OPTBRAILLEFRIENDLY))
629 move (menu->current - menu->top + menu->offset, 0);
632 menu->oldcurrent = -1;
634 if (option (OPTARROWCURSOR))
635 ! move (menu->current - menu->top + menu->offset, SidebarWidth + 2);
636 else if (option (OPTBRAILLEFRIENDLY))
637 move (menu->current - menu->top + menu->offset, 0);
648 int oldvcount = Context->vcount;
652 menu->redraw = REDRAW_FULL;
655 + case OP_SIDEBAR_OPEN:
656 case OP_MAIN_CHANGE_FOLDER:
657 case OP_MAIN_NEXT_UNREAD_MAILBOX:
662 mutt_buffy (buf, sizeof (buf));
664 ! if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
666 if (menu->menu == MENU_PAGER)
670 mutt_buffy (buf, sizeof (buf));
672 ! if ( op == OP_SIDEBAR_OPEN ) {
675 ! strncpy( buf, CurBuffy->path, sizeof(buf) );
676 ! } else if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
678 if (menu->menu == MENU_PAGER)
685 mutt_expand_path (buf, sizeof (buf));
687 if (mx_get_magic (buf) <= 0)
689 mutt_error (_("%s is not a mailbox."), buf);
696 + case OP_SIDEBAR_SCROLL_UP:
697 + case OP_SIDEBAR_SCROLL_DOWN:
698 + case OP_SIDEBAR_NEXT:
699 + case OP_SIDEBAR_PREV:
700 + scroll_sidebar(op, menu->menu);
703 if (menu->menu == MENU_MAIN)
704 km_error_key (MENU_MAIN);
705 *** mutt-1.5.24-orig/flags.c 2015-08-30 12:06:38.000000000 -0500
706 --- mutt-1.5.24/flags.c 2015-09-16 23:18:13.000000000 -0500
712 #include "mutt_curses.h"
713 + #include "mutt_menu.h"
716 + #include "sidebar.h"
718 void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
724 if (h->searched && (changed != h->changed || deleted != ctx->deleted || tagged != ctx->tagged || flagged != ctx->flagged))
729 void mutt_tag_set_flag (int flag, int bf)
730 *** mutt-1.5.24-orig/functions.h 2015-08-30 12:06:38.000000000 -0500
731 --- mutt-1.5.24/functions.h 2015-09-16 23:18:13.000000000 -0500
735 { "decrypt-save", OP_DECRYPT_SAVE, NULL },
738 + { "sidebar-scroll-up", OP_SIDEBAR_SCROLL_UP, NULL },
739 + { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL },
740 + { "sidebar-next", OP_SIDEBAR_NEXT, NULL },
741 + { "sidebar-prev", OP_SIDEBAR_PREV, NULL },
742 + { "sidebar-open", OP_SIDEBAR_OPEN, NULL },
750 { "what-key", OP_WHAT_KEY, NULL },
752 + { "sidebar-scroll-up", OP_SIDEBAR_SCROLL_UP, NULL },
753 + { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL },
754 + { "sidebar-next", OP_SIDEBAR_NEXT, NULL },
755 + { "sidebar-prev", OP_SIDEBAR_PREV, NULL },
756 + { "sidebar-open", OP_SIDEBAR_OPEN, NULL },
760 *** mutt-1.5.24-orig/globals.h 2015-08-30 12:06:38.000000000 -0500
761 --- mutt-1.5.24/globals.h 2015-09-16 23:18:13.000000000 -0500
765 WHERE char *SendCharset;
766 WHERE char *Sendmail;
768 + WHERE char *SidebarDelim;
769 + WHERE char *SidebarFormat;
770 + WHERE char *SidebarIndentStr;
771 WHERE char *Signature;
772 WHERE char *SimpleSearch;
777 WHERE short ScoreThresholdRead;
778 WHERE short ScoreThresholdFlag;
780 + WHERE struct buffy_t *CurBuffy INITVAL(0);
781 + WHERE short DrawFullLine INITVAL(0);
782 + WHERE short SidebarWidth;
784 WHERE short ImapKeepalive;
785 WHERE short ImapPipelineDepth;
786 *** mutt-1.5.24-orig/handler.c 2015-08-30 12:06:38.000000000 -0500
787 --- mutt-1.5.24/handler.c 2015-09-16 23:18:13.000000000 -0500
792 fseeko (s->fpin, b->offset, 0);
794 + #ifdef HAVE_FMEMOPEN
799 /* see if we need to decode this part before processing it */
800 if (b->encoding == ENCBASE64 || b->encoding == ENCQUOTEDPRINTABLE ||
801 b->encoding == ENCUUENCODED || plaintext ||
806 /* decode to a tempfile, saving the original destination */
808 + #ifdef HAVE_FMEMOPEN
809 + if ((s->fpout = open_memstream(&temp, &tempsize)) == NULL)
811 + mutt_error _("Unable to open memory stream!");
812 + dprint (1, (debugfile, "Can't open memory stream.\n"));
816 mutt_mktemp (tempfile, sizeof (tempfile));
817 if ((s->fpout = safe_fopen (tempfile, "w")) == NULL)
822 dprint (1, (debugfile, "Can't open %s.\n", tempfile));
826 /* decoding the attachment changes the size and offset, so save a copy
827 * of the "real" values now, and restore them after processing
831 /* restore final destination and substitute the tempfile for input */
834 s->fpin = fopen (tempfile, "r");
837 /* restore the prefix */
838 s->prefix = savePrefix;
841 /* restore final destination and substitute the tempfile for input */
844 + #ifdef HAVE_FMEMOPEN
846 + s->fpin = fmemopen(temp, tempsize, "r");
847 + else /* fmemopen cannot handle zero-length buffers */
848 + s->fpin = safe_fopen ("/dev/null", "r");
849 + if(s->fpin == NULL) {
850 + mutt_perror("failed to re-open memstream!");
854 s->fpin = fopen (tempfile, "r");
857 /* restore the prefix */
858 s->prefix = savePrefix;
864 /* restore the original source stream */
865 safe_fclose (&s->fpin);
866 + #ifdef HAVE_FMEMOPEN
873 *** mutt-1.5.24-orig/init.h 2015-08-30 12:06:38.000000000 -0500
874 --- mutt-1.5.24/init.h 2015-09-16 23:18:13.000000000 -0500
881 + {"sidebar_delim", DT_STR, R_BOTH, UL &SidebarDelim, UL "|"},
884 + ** This specifies the delimiter between the sidebar (if visible) and
887 + {"sidebar_indentstr", DT_STR, R_BOTH, UL &SidebarIndentStr, UL " "},
890 + ** This specifies the string that is used to indent items
891 + ** with sidebar_folderindent= yes
893 + { "sidebar_visible", DT_BOOL, R_BOTH, OPTSIDEBAR, 0 },
896 + ** This specifies whether or not to show sidebar (left-side list of folders).
898 + { "sidebar_sort", DT_BOOL, R_BOTH, OPTSIDEBARSORT, 0 },
901 + ** This specifies whether or not to sort the sidebar alphabetically.
903 + { "sidebar_width", DT_NUM, R_BOTH, UL &SidebarWidth, 0 },
906 + ** The width of the sidebar.
908 + { "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 0 },
911 + ** Should the sidebar shorten the path showed.
913 + {"sidebar_format", DT_STR, R_NONE, UL &SidebarFormat, UL "%B%?F? [%F]?%* %?N?%N/?%4S"},
916 + ** Format string for the sidebar. The sequences `%N', `%F' and `%S'
917 + ** will be replaced by the number of new or flagged messages or the total
918 + ** size of them mailbox. `%B' will be replaced with the name of the mailbox.
919 + ** The `%!' sequence will be expanded to `!' if there is one flagged message;
920 + ** to `!!' if there are two flagged messages; and to `n!' for n flagged
923 + { "sidebar_folderindent", DT_BOOL, R_BOTH, OPTSIDEBARFOLDERINDENT, 0 },
926 + ** Should folders be indented in the sidebar.
929 { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0},
932 *** mutt-1.5.24-orig/mailbox.h 2015-08-30 12:06:38.000000000 -0500
933 --- mutt-1.5.24/mailbox.h 2015-09-16 23:18:13.000000000 -0500
937 #define M_NEWFOLDER (1<<4) /* create a new folder - same as M_APPEND, but uses
938 * safe_fopen() for mbox-style folders.
940 + #define M_PEEK (1<<5) /* revert atime back after taking a look (if applicable) */
942 /* mx_open_new_message() */
943 #define M_ADD_FROM (1<<0) /* add a From_ line */
944 *** mutt-1.5.24-orig/main.c 2015-08-30 12:06:38.000000000 -0500
945 --- mutt-1.5.24/main.c 2015-09-16 23:18:13.000000000 -0500
951 #include <sys/stat.h>
952 + #include <limits.h>
953 #include <sys/utsname.h>
959 int main (int argc, char **argv)
961 ! char folder[_POSIX_PATH_MAX] = "";
962 char *subject = NULL;
963 char *includeFile = NULL;
964 char *draftFile = NULL;
967 int main (int argc, char **argv)
969 ! char folder[PATH_MAX] = "";
970 char *subject = NULL;
971 char *includeFile = NULL;
972 char *draftFile = NULL;
976 strfcpy (folder, NONULL(Spoolfile), sizeof (folder));
977 mutt_expand_path (folder, sizeof (folder));
980 + char tmpfolder[PATH_MAX];
981 + strfcpy (tmpfolder, folder, sizeof (tmpfolder));
982 + if(!realpath(tmpfolder, folder))
983 + strfcpy (folder, tmpfolder, sizeof (tmpfolder));
986 mutt_str_replace (&CurrentFolder, folder);
987 mutt_str_replace (&LastFolder, folder);
992 if((Context = mx_open_mailbox (folder, ((flags & M_RO) || option (OPTREADONLY)) ? M_READONLY : 0, NULL))
995 + set_curbuffy(folder);
999 *** mutt-1.5.24-orig/Makefile.am 2015-08-30 12:06:38.000000000 -0500
1000 --- mutt-1.5.24/Makefile.am 2015-09-16 23:18:13.000000000 -0500
1004 rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \
1005 score.c send.c sendlib.c signal.c sort.c \
1006 status.c system.c thread.c charset.c history.c lib.c \
1008 muttlib.c editmsg.c mbyte.c \
1009 url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
1011 *** mutt-1.5.24-orig/Makefile.in 2015-08-30 12:24:26.000000000 -0500
1012 --- mutt-1.5.24/Makefile.in 2015-09-16 23:18:13.000000000 -0500
1015 $(srcdir)/Makefile.am $(top_srcdir)/configure \
1016 $(am__configure_deps) $(srcdir)/config.h.in \
1017 $(top_srcdir)/intl/Makefile.in $(srcdir)/hcachever.sh.in \
1018 ! $(srcdir)/muttbug.sh.in strtok_r.c strcasecmp.c regex.c \
1019 ! snprintf.c wcscasecmp.c strcasestr.c setenv.c mkdtemp.c \
1020 ! strsep.c strdup.c depcomp ABOUT-NLS ChangeLog INSTALL NEWS \
1021 ! README TODO compile config.guess config.sub install-sh missing
1022 EXTRA_PROGRAMS = mutt_dotlock$(EXEEXT) pgpring$(EXEEXT) \
1023 pgpewrap$(EXEEXT) mutt_md5$(EXEEXT)
1024 bin_PROGRAMS = mutt$(EXEEXT) $(DOTLOCK_TARGET) $(PGPAUX_TARGET)
1026 $(srcdir)/Makefile.am $(top_srcdir)/configure \
1027 $(am__configure_deps) $(srcdir)/config.h.in \
1028 $(top_srcdir)/intl/Makefile.in $(srcdir)/hcachever.sh.in \
1029 ! $(srcdir)/muttbug.sh.in snprintf.c strtok_r.c regex.c strdup.c \
1030 ! strcasecmp.c setenv.c strcasestr.c wcscasecmp.c mkdtemp.c \
1031 ! strsep.c depcomp ABOUT-NLS ChangeLog INSTALL NEWS README TODO \
1032 ! compile config.guess config.sub install-sh missing
1033 EXTRA_PROGRAMS = mutt_dotlock$(EXEEXT) pgpring$(EXEEXT) \
1034 pgpewrap$(EXEEXT) mutt_md5$(EXEEXT)
1035 bin_PROGRAMS = mutt$(EXEEXT) $(DOTLOCK_TARGET) $(PGPAUX_TARGET)
1038 score.$(OBJEXT) send.$(OBJEXT) sendlib.$(OBJEXT) \
1039 signal.$(OBJEXT) sort.$(OBJEXT) status.$(OBJEXT) \
1040 system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
1041 ! history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
1042 ! editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \
1043 ! ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT)
1045 am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \
1048 score.$(OBJEXT) send.$(OBJEXT) sendlib.$(OBJEXT) \
1049 signal.$(OBJEXT) sort.$(OBJEXT) status.$(OBJEXT) \
1050 system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
1051 ! history.$(OBJEXT) lib.$(OBJEXT) sidebar.$(OBJEXT) \
1052 ! muttlib.$(OBJEXT) editmsg.$(OBJEXT) mbyte.$(OBJEXT) \
1053 ! url.$(OBJEXT) ascii.$(OBJEXT) crypt-mod.$(OBJEXT) \
1054 ! safe_asprintf.$(OBJEXT)
1056 am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \
1061 rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \
1062 score.c send.c sendlib.c signal.c sort.c \
1063 status.c system.c thread.c charset.c history.c lib.c \
1065 muttlib.c editmsg.c mbyte.c \
1066 url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
1071 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/send.Po@am__quote@
1072 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendlib.Po@am__quote@
1073 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sha1.Po@am__quote@
1074 + @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sidebar.Po@am__quote@
1075 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/signal.Po@am__quote@
1076 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smime.Po@am__quote@
1077 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smtp.Po@am__quote@
1078 *** mutt-1.5.24-orig/mbox.c 2015-08-30 12:06:38.000000000 -0500
1079 --- mutt-1.5.24/mbox.c 2015-09-16 23:18:13.000000000 -0500
1083 mutt_perror (ctx->path);
1086 + ctx->atime = sb.st_atime;
1087 ctx->mtime = sb.st_mtime;
1088 ctx->size = sb.st_size;
1094 ctx->size = sb.st_size;
1095 ctx->mtime = sb.st_mtime;
1096 + ctx->atime = sb.st_atime;
1098 #ifdef NFS_ATTRIBUTE_HACK
1099 if (sb.st_mtime > sb.st_atime)
1100 *** mutt-1.5.24-orig/menu.c 2015-08-30 12:06:38.000000000 -0500
1101 --- mutt-1.5.24/menu.c 2015-09-16 23:18:13.000000000 -0500
1105 #include "mutt_curses.h"
1106 #include "mutt_menu.h"
1108 + #include "sidebar.h"
1110 extern size_t UngetCount;
1115 char *scratch = safe_strdup (s);
1116 int shift = option (OPTARROWCURSOR) ? 3 : 0;
1117 ! int cols = COLS - shift;
1119 mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1);
1123 char *scratch = safe_strdup (s);
1124 int shift = option (OPTARROWCURSOR) ? 3 : 0;
1125 ! int cols = COLS - shift - SidebarWidth;
1127 mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1);
1136 for (i = menu->top; i < menu->top + menu->pagelen; i++)
1141 menu_pad_string (buf, sizeof (buf));
1144 ! move(i - menu->top + menu->offset, 0);
1147 if (i == menu->current)
1149 menu_pad_string (buf, sizeof (buf));
1152 ! move(i - menu->top + menu->offset, SidebarWidth);
1155 if (i == menu->current)
1161 ! CLEARLINE(i - menu->top + menu->offset);
1169 ! CLEARLINE_WIN (i - menu->top + menu->offset);
1178 ! move (menu->oldcurrent + menu->offset - menu->top, 0);
1179 ATTRSET(menu->color (menu->oldcurrent));
1181 if (option (OPTARROWCURSOR))
1186 ! move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth);
1187 ATTRSET(menu->color (menu->oldcurrent));
1189 if (option (OPTARROWCURSOR))
1193 menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
1194 menu_pad_string (buf, sizeof (buf));
1195 ! move (menu->oldcurrent + menu->offset - menu->top, 3);
1196 print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
1199 /* now draw it in the new location */
1200 SETCOLOR(MT_COLOR_INDICATOR);
1201 ! mvaddstr(menu->current + menu->offset - menu->top, 0, "->");
1207 menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
1208 menu_pad_string (buf, sizeof (buf));
1209 ! move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth + 3);
1210 print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
1213 /* now draw it in the new location */
1214 SETCOLOR(MT_COLOR_INDICATOR);
1215 ! mvaddstr(menu->current + menu->offset - menu->top, SidebarWidth, "->");
1221 menu_make_entry (buf, sizeof (buf), menu, menu->current);
1222 menu_pad_string (buf, sizeof (buf));
1223 SETCOLOR(MT_COLOR_INDICATOR);
1224 ! move(menu->current - menu->top + menu->offset, 0);
1225 print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
1227 menu->redraw &= REDRAW_STATUS;
1229 menu_make_entry (buf, sizeof (buf), menu, menu->current);
1230 menu_pad_string (buf, sizeof (buf));
1231 SETCOLOR(MT_COLOR_INDICATOR);
1232 ! move(menu->current - menu->top + menu->offset, SidebarWidth);
1233 print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
1235 menu->redraw &= REDRAW_STATUS;
1238 char buf[LONG_STRING];
1239 int attr = menu->color (menu->current);
1241 ! move (menu->current + menu->offset - menu->top, 0);
1242 menu_make_entry (buf, sizeof (buf), menu, menu->current);
1243 menu_pad_string (buf, sizeof (buf));
1246 char buf[LONG_STRING];
1247 int attr = menu->color (menu->current);
1249 ! move (menu->current + menu->offset - menu->top, SidebarWidth);
1250 menu_make_entry (buf, sizeof (buf), menu, menu->current);
1251 menu_pad_string (buf, sizeof (buf));
1257 if (option (OPTARROWCURSOR))
1258 ! move (menu->current - menu->top + menu->offset, 2);
1259 else if (option (OPTBRAILLEFRIENDLY))
1260 move (menu->current - menu->top + menu->offset, 0);
1265 if (option (OPTARROWCURSOR))
1266 ! move (menu->current - menu->top + menu->offset, SidebarWidth + 2);
1267 else if (option (OPTBRAILLEFRIENDLY))
1268 move (menu->current - menu->top + menu->offset, 0);
1270 *** mutt-1.5.24-orig/mh.c 2015-08-30 12:06:38.000000000 -0500
1271 --- mutt-1.5.24/mh.c 2015-09-16 23:18:13.000000000 -0500
1275 mhs_free_sequences (&mhs);
1278 + void mh_buffy_update (const char *path, int *msgcount, int *msg_unread, int *msg_flagged, time_t *sb_last_checked)
1281 + struct mh_sequences mhs;
1282 + memset (&mhs, 0, sizeof (mhs));
1284 + if(!option(OPTSIDEBAR))
1287 + if (mh_read_sequences (&mhs, path) < 0)
1293 + for (i = 0; i <= mhs.max; i++)
1295 + if (mhs_check (&mhs, i) & MH_SEQ_UNSEEN) {
1298 + if (mhs_check (&mhs, i) & MH_SEQ_FLAGGED)
1300 + mhs_free_sequences (&mhs);
1301 + *sb_last_checked = time(NULL);
1304 static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt)
1307 *** mutt-1.5.24-orig/mutt_curses.h 2015-08-30 12:06:38.000000000 -0500
1308 --- mutt-1.5.24/mutt_curses.h 2015-09-16 23:18:13.000000000 -0500
1315 + #define CLEARLINE_WIN(x) move(x,SidebarWidth), clrtoeol()
1316 #define CLEARLINE(x) move(x,0), clrtoeol()
1317 #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
1318 #define BEEP() do { if (option (OPTBEEP)) beep(); } while (0)
1330 *** mutt-1.5.24-orig/mutt_menu.h 2015-08-30 12:06:38.000000000 -0500
1331 --- mutt-1.5.24/mutt_menu.h 2015-09-16 23:18:13.000000000 -0500
1335 #define REDRAW_FULL (1<<5)
1336 #define REDRAW_BODY (1<<6)
1337 #define REDRAW_SIGWINCH (1<<7)
1338 + #define REDRAW_SIDEBAR (1<<8)
1340 #define M_MODEFMT "-- Mutt: %s"
1342 *** mutt-1.5.24-orig/mutt.h 2015-08-30 12:06:38.000000000 -0500
1343 --- mutt-1.5.24/mutt.h 2015-09-16 23:18:13.000000000 -0500
1351 + OPTSIDEBARSHORTPATH,
1353 + OPTSIDEBARFOLDERINDENT,
1370 unsigned int quiet : 1; /* inhibit status messages? */
1371 unsigned int collapsed : 1; /* are all threads collapsed? */
1372 unsigned int closing : 1; /* mailbox is being closed */
1373 + unsigned int peekonly : 1; /* just taking a glance, revert atime */
1376 void *data; /* driver specific data */
1377 *** mutt-1.5.24-orig/muttlib.c 2015-08-30 12:06:38.000000000 -0500
1378 --- mutt-1.5.24/muttlib.c 2015-09-16 23:18:13.000000000 -0500
1384 /* see if there's room to add content, else ignore */
1385 + if ( DrawFullLine )
1387 if ((col < COLS && wlen < destlen) || soft)
1399 + if ((col < COLS-SidebarWidth && wlen < destlen) || soft)
1403 + /* get contents after padding */
1404 + mutt_FormatString (buf, sizeof (buf), 0, src + pl, callback, data, flags);
1405 + len = mutt_strlen (buf);
1406 + wid = mutt_strwidth (buf);
1408 + /* try to consume as many columns as we can, if we don't have
1409 + * memory for that, use as much memory as possible */
1410 + pad = (COLS - SidebarWidth - col - wid) / pw;
1411 + if (pad > 0 && wlen + (pad * pl) + len > destlen)
1412 + pad = ((signed)(destlen - wlen - len)) / pl;
1417 + memcpy (wptr, src, pl);
1423 + else if (soft && pad < 0)
1425 + /* \0-terminate dest for length computation in mutt_wstr_trunc() */
1427 + /* make sure right part is at most as wide as display */
1428 + len = mutt_wstr_trunc (buf, destlen, COLS, &wid);
1429 + /* truncate left so that right part fits completely in */
1430 + wlen = mutt_wstr_trunc (dest, destlen - len, col + pad, &col);
1431 + wptr = dest + wlen;
1433 + if (len + wlen > destlen)
1434 + len = mutt_wstr_trunc (buf, destlen - wlen, COLS - SidebarWidth - col, NULL);
1435 + memcpy (wptr, buf, len);
1442 break; /* skip rest of input */
1445 *** mutt-1.5.24-orig/mx.c 2015-08-30 12:06:38.000000000 -0500
1446 --- mutt-1.5.24/mx.c 2015-09-16 23:18:13.000000000 -0500
1450 * M_APPEND open mailbox for appending
1451 * M_READONLY open mailbox in read-only mode
1452 * M_QUIET only print error messages
1453 + * M_PEEK revert atime where applicable
1454 * ctx if non-null, context struct to use
1456 CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT *pctx)
1461 if (flags & M_READONLY)
1463 + if (flags & M_PEEK)
1464 + ctx->peekonly = 1;
1466 if (flags & (M_APPEND|M_NEWFOLDER))
1470 void mx_fastclose_mailbox (CONTEXT *ctx)
1477 /* never announce that a mailbox we've just left has new mail. #3290
1478 * XXX: really belongs in mx_close_mailbox, but this is a nice hook point */
1479 ! mutt_buffy_setnotified(ctx->path);
1482 ctx->mx_close (ctx);
1484 void mx_fastclose_mailbox (CONTEXT *ctx)
1487 + #ifndef BUFFY_SIZE
1488 + struct utimbuf ut;
1493 + #ifndef BUFFY_SIZE
1494 + /* fix up the times so buffy won't get confused */
1495 + if (ctx->peekonly && ctx->path && ctx->mtime > ctx->atime)
1497 + ut.actime = ctx->atime;
1498 + ut.modtime = ctx->mtime;
1499 + utime (ctx->path, &ut);
1503 /* never announce that a mailbox we've just left has new mail. #3290
1504 * XXX: really belongs in mx_close_mailbox, but this is a nice hook point */
1505 ! if(!ctx->peekonly)
1506 ! mutt_buffy_setnotified(ctx->path);
1509 ctx->mx_close (ctx);
1513 mutt_clear_threads (ctx);
1514 for (i = 0; i < ctx->msgcount; i++)
1515 mutt_free_header (&ctx->hdrs[i]);
1516 + ctx->msgcount -= ctx->deleted;
1517 + set_buffystats(ctx);
1524 if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->read
1525 && !(ctx->hdrs[i]->flagged && option (OPTKEEPFLAGGED)))
1527 + if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->read)
1529 + if (ctx->hdrs[i]->deleted && ctx->hdrs[i]->flagged)
1533 if (read_msgs && quadoption (OPT_MOVE) != M_NO)
1534 *** mutt-1.5.24-orig/mx.h 2015-08-30 12:06:38.000000000 -0500
1535 --- mutt-1.5.24/mx.h 2015-09-16 23:18:13.000000000 -0500
1539 int mh_read_dir (CONTEXT *, const char *);
1540 int mh_sync_mailbox (CONTEXT *, int *);
1541 int mh_check_mailbox (CONTEXT *, int *);
1542 + void mh_buffy_update (const char *, int *, int *, int *, time_t *);
1543 int mh_check_empty (const char *);
1545 int maildir_read_dir (CONTEXT *);
1546 *** mutt-1.5.24-orig/OPS 2015-08-30 12:06:38.000000000 -0500
1547 --- mutt-1.5.24/OPS 2015-09-16 23:18:13.000000000 -0500
1551 OP_MAIN_SHOW_LIMIT "show currently active limit pattern"
1552 OP_MAIN_COLLAPSE_THREAD "collapse/uncollapse current thread"
1553 OP_MAIN_COLLAPSE_ALL "collapse/uncollapse all threads"
1554 + OP_SIDEBAR_SCROLL_UP "scroll the mailbox pane up 1 page"
1555 + OP_SIDEBAR_SCROLL_DOWN "scroll the mailbox pane down 1 page"
1556 + OP_SIDEBAR_NEXT "go down to next mailbox"
1557 + OP_SIDEBAR_PREV "go to previous mailbox"
1558 + OP_SIDEBAR_OPEN "open hilighted mailbox"
1559 *** mutt-1.5.24-orig/pager.c 2015-08-30 12:06:38.000000000 -0500
1560 --- mutt-1.5.24/pager.c 2015-09-16 23:18:13.000000000 -0500
1567 + #include "sidebar.h"
1569 #include "mutt_crypt.h"
1576 int wrap_cols = mutt_term_width ((flags & M_PAGER_NOWRAP) ? 0 : Wrap);
1577 + wrap_cols -= SidebarWidth;
1579 if (check_attachment_marker ((char *)buf) == 0)
1585 int bodyoffset = 1; /* offset of first line of real text */
1586 int statusoffset = 0; /* offset for the status bar */
1588 int helpoffset = LINES - 2; /* offset for the help bar. */
1589 int bodylen = LINES - 2 - bodyoffset; /* length of displayable area */
1593 if ((redraw & REDRAW_BODY) || topline != oldtopline)
1596 ! move (bodyoffset, 0);
1597 curline = oldtopline = topline;
1601 if ((redraw & REDRAW_BODY) || topline != oldtopline)
1604 ! move (bodyoffset, SidebarWidth);
1605 curline = oldtopline = topline;
1611 &QuoteList, &q_level, &force_redraw, &SearchRE) > 0)
1614 + move(lines + bodyoffset, SidebarWidth);
1616 last_offset = lineInfo[curline].offset;
1617 } while (force_redraw);
1624 + move(lines + bodyoffset, SidebarWidth);
1631 hfi.pager_progress = pager_progress_str;
1633 if (last_pos < sb.st_size - 1)
1634 snprintf(pager_progress_str, sizeof(pager_progress_str), OFF_T_FMT "%%", (100 * last_offset / sb.st_size));
1636 strfcpy(pager_progress_str, (topline == 0) ? "all" : "end", sizeof(pager_progress_str));
1638 /* print out the pager status bar */
1639 ! move (statusoffset, 0);
1640 SETCOLOR (MT_COLOR_STATUS);
1642 if (IsHeader (extra) || IsMsgAttach (extra))
1644 ! size_t l1 = COLS * MB_LEN_MAX;
1645 size_t l2 = sizeof (buffer);
1646 hfi.hdr = (IsHeader (extra)) ? extra->hdr : extra->bdy->hdr;
1647 mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), &hfi, M_FORMAT_MAKEPRINT);
1648 ! mutt_paddstr (COLS, buffer);
1653 snprintf (bn, sizeof (bn), "%s (%s)", banner, pager_progress_str);
1654 ! mutt_paddstr (COLS, bn);
1657 if (option(OPTTSENABLED) && TSSupported)
1661 hfi.pager_progress = pager_progress_str;
1663 + statuswidth = COLS - (option(OPTSTATUSONTOP) && PagerIndexLines > 0 ? SidebarWidth : 0);
1665 if (last_pos < sb.st_size - 1)
1666 snprintf(pager_progress_str, sizeof(pager_progress_str), OFF_T_FMT "%%", (100 * last_offset / sb.st_size));
1668 strfcpy(pager_progress_str, (topline == 0) ? "all" : "end", sizeof(pager_progress_str));
1670 /* print out the pager status bar */
1671 ! move (statusoffset, SidebarWidth);
1672 SETCOLOR (MT_COLOR_STATUS);
1673 + if(option(OPTSTATUSONTOP) && PagerIndexLines > 0) {
1674 + CLEARLINE_WIN (statusoffset);
1676 + CLEARLINE (statusoffset);
1677 + DrawFullLine = 1; /* for mutt_make_string_info */
1680 if (IsHeader (extra) || IsMsgAttach (extra))
1682 ! size_t l1 = statuswidth * MB_LEN_MAX;
1683 size_t l2 = sizeof (buffer);
1684 hfi.hdr = (IsHeader (extra)) ? extra->hdr : extra->bdy->hdr;
1685 mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), &hfi, M_FORMAT_MAKEPRINT);
1686 ! mutt_paddstr (statuswidth, buffer);
1691 snprintf (bn, sizeof (bn), "%s (%s)", banner, pager_progress_str);
1692 ! mutt_paddstr (statuswidth, bn);
1694 + if(!option(OPTSTATUSONTOP) || PagerIndexLines == 0)
1695 + DrawFullLine = 0; /* reset */
1697 if (option(OPTTSENABLED) && TSSupported)
1701 /* redraw the pager_index indicator, because the
1702 * flags for this message might have changed. */
1703 menu_redraw_current (index);
1705 /* print out the index status bar */
1706 menu_status_line (buffer, sizeof (buffer), index, NONULL(Status));
1708 ! move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), 0);
1709 SETCOLOR (MT_COLOR_STATUS);
1710 ! mutt_paddstr (COLS, buffer);
1716 if (option(OPTBRAILLEFRIENDLY)) {
1718 /* redraw the pager_index indicator, because the
1719 * flags for this message might have changed. */
1720 menu_redraw_current (index);
1721 + draw_sidebar(MENU_PAGER);
1723 /* print out the index status bar */
1724 menu_status_line (buffer, sizeof (buffer), index, NONULL(Status));
1726 ! move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)),
1727 ! (option(OPTSTATUSONTOP) ? 0: SidebarWidth));
1728 SETCOLOR (MT_COLOR_STATUS);
1729 ! mutt_paddstr (COLS - (option(OPTSTATUSONTOP) ? 0 : SidebarWidth), buffer);
1733 + /* if we're not using the index, update every time */
1735 + draw_sidebar(MENU_PAGER);
1739 if (option(OPTBRAILLEFRIENDLY)) {
1746 + case OP_SIDEBAR_SCROLL_UP:
1747 + case OP_SIDEBAR_SCROLL_DOWN:
1748 + case OP_SIDEBAR_NEXT:
1749 + case OP_SIDEBAR_PREV:
1750 + scroll_sidebar(ch, MENU_PAGER);
1756 *** mutt-1.5.24-orig/pattern.c 2015-08-30 12:06:38.000000000 -0500
1757 --- mutt-1.5.24/pattern.c 2015-09-16 23:18:13.000000000 -0500
1761 HEADER *h = ctx->hdrs[msgno];
1764 + #ifdef HAVE_FMEMOPEN
1769 if ((msg = mx_open_message (ctx, msgno)) != NULL)
1774 memset (&s, 0, sizeof (s));
1776 s.flags = M_CHARCONV;
1777 + #ifdef HAVE_FMEMOPEN
1778 + if((s.fpout = open_memstream(&temp, &tempsize)) == NULL)
1780 + mutt_perror ("Error opening memstream");
1784 mutt_mktemp (tempfile, sizeof (tempfile));
1785 if ((s.fpout = safe_fopen (tempfile, "w+")) == NULL)
1787 mutt_perror (tempfile);
1792 if (pat->op != M_BODY)
1793 mutt_copy_header (msg->fp, h, s.fpout, CH_FROM | CH_DECODE, NULL);
1799 safe_fclose (&s.fpout);
1800 + #ifdef HAVE_FMEMOPEN
1811 mutt_body_handler (h->content, &s);
1814 + #ifdef HAVE_FMEMOPEN
1819 + if ((fp = fmemopen(temp, tempsize, "r")) == NULL) {
1820 + mutt_perror ("Error re-opening memstream");
1823 + } else { /* fmemopen cannot handle empty buffers */
1824 + if ((fp = safe_fopen ("/dev/null", "r")) == NULL) {
1825 + mutt_perror ("Error opening /dev/null");
1833 fstat (fileno (fp), &st);
1834 lng = (long) st.st_size;
1842 if (option (OPTTHOROUGHSRC))
1845 + #ifdef HAVE_FMEMOPEN
1854 *** mutt-1.5.24-orig/PATCHES 2015-08-30 12:06:38.000000000 -0500
1855 --- mutt-1.5.24/PATCHES 2015-11-11 09:39:02.000000000 -0600
1859 + patch-1.5.24.sidebar.20151111.txt
1860 *** mutt-1.5.24-orig/protos.h 2015-08-30 12:06:38.000000000 -0500
1861 --- mutt-1.5.24/protos.h 2015-09-16 23:18:13.000000000 -0500
1865 const char *pager_progress;
1868 + struct sidebar_entry {
1869 + char box[SHORT_STRING];
1870 + unsigned int size;
1872 + unsigned int flagged;
1875 void mutt_make_string_info (char *, size_t, const char *, struct hdr_format_info *, format_flag);
1877 int mutt_extract_token (BUFFER *, BUFFER *, int);
1878 *** mutt-1.5.24-orig/sidebar.c 1969-12-31 18:00:00.000000000 -0600
1879 --- mutt-1.5.24/sidebar.c 2015-11-11 09:38:45.000000000 -0600
1884 + * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu>
1885 + * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com>
1887 + * This program is free software; you can redistribute it and/or modify
1888 + * it under the terms of the GNU General Public License as published by
1889 + * the Free Software Foundation; either version 2 of the License, or
1890 + * (at your option) any later version.
1892 + * This program is distributed in the hope that it will be useful,
1893 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1894 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1895 + * GNU General Public License for more details.
1897 + * You should have received a copy of the GNU General Public License
1898 + * along with this program; if not, write to the Free Software
1899 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
1904 + # include "config.h"
1908 + #include "mutt_menu.h"
1909 + #include "mutt_curses.h"
1910 + #include "sidebar.h"
1911 + #include "buffy.h"
1912 + #include <libgen.h>
1913 + #include "keymap.h"
1914 + #include <stdbool.h>
1916 + /*BUFFY *CurBuffy = 0;*/
1917 + static BUFFY *TopBuffy = 0;
1918 + static BUFFY *BottomBuffy = 0;
1919 + static int known_lines = 0;
1921 + void calc_boundaries() {
1923 + BUFFY *tmp = Incoming;
1925 + int count = LINES - 2 - (option(OPTHELP) ? 1 : 0);
1927 + if ( known_lines != LINES ) {
1928 + TopBuffy = BottomBuffy = 0;
1929 + known_lines = LINES;
1931 + for ( ; tmp->next != 0; tmp = tmp->next )
1932 + tmp->next->prev = tmp;
1934 + if ( TopBuffy == 0 && BottomBuffy == 0 )
1935 + TopBuffy = Incoming;
1936 + if ( BottomBuffy == 0 ) {
1937 + BottomBuffy = TopBuffy;
1938 + while ( --count && BottomBuffy->next )
1939 + BottomBuffy = BottomBuffy->next;
1941 + else if ( TopBuffy == CurBuffy->next ) {
1942 + BottomBuffy = CurBuffy;
1943 + tmp = BottomBuffy;
1944 + while ( --count && tmp->prev)
1948 + else if ( BottomBuffy == CurBuffy->prev ) {
1949 + TopBuffy = CurBuffy;
1951 + while ( --count && tmp->next )
1953 + BottomBuffy = tmp;
1957 + static const char *
1958 + sidebar_format_str (char *dest,
1963 + const char *prefix,
1964 + const char *ifstring,
1965 + const char *elsestring,
1966 + unsigned long data,
1967 + format_flag flags)
1969 + /* casting from unsigned long - srsly?! */
1970 + struct sidebar_entry *sbe = (struct sidebar_entry *) data;
1971 + unsigned int optional;
1972 + char fmt[SHORT_STRING], buf[SHORT_STRING];
1974 + optional = flags & M_FORMAT_OPTIONAL;
1979 + snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1980 + snprintf (dest, destlen, fmt, sbe->flagged);
1981 + } else if(sbe->flagged == 0) {
1987 + if(sbe->flagged == 0)
1988 + mutt_format_s(dest, destlen, prefix, "");
1989 + if(sbe->flagged == 1)
1990 + mutt_format_s(dest, destlen, prefix, "!");
1991 + if(sbe->flagged == 2)
1992 + mutt_format_s(dest, destlen, prefix, "!!");
1993 + if(sbe->flagged > 2) {
1994 + snprintf (buf, sizeof (buf), "%d!", sbe->flagged);
1995 + mutt_format_s(dest, destlen, prefix, buf);
2001 + snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
2002 + snprintf (dest, destlen, fmt, sbe->size);
2003 + } else if (sbe->size == 0) {
2010 + snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
2011 + snprintf (dest, destlen, fmt, sbe->new);
2012 + } else if(sbe->new == 0) {
2018 + mutt_format_s(dest, destlen, prefix, sbe->box);
2023 + mutt_FormatString (dest, destlen, col, ifstring, sidebar_format_str, (unsigned long) sbe, flags);
2024 + else if (flags & M_FORMAT_OPTIONAL)
2025 + mutt_FormatString (dest, destlen, col, elsestring, sidebar_format_str, (unsigned long) sbe, flags);
2030 + char *make_sidebar_entry(char *box, unsigned int size, unsigned int new, unsigned int flagged) {
2031 + static char *entry = 0;
2032 + struct sidebar_entry sbe;
2035 + SBvisual = SidebarWidth - strlen(SidebarDelim);
2040 + sbe.flagged = flagged;
2042 + strncpy(sbe.box, box, 31);
2044 + safe_realloc(&entry, SBvisual + 2);
2045 + entry[SBvisual + 1] = '\0';
2047 + mutt_FormatString (entry, SBvisual+1, 0, SidebarFormat, sidebar_format_str, (unsigned long) &sbe, 0);
2052 + void set_curbuffy(char buf[LONG_STRING])
2054 + BUFFY* tmp = CurBuffy = Incoming;
2060 + if(!strcmp(tmp->path, buf) || !strcmp(tmp->realpath, buf)) {
2072 + int draw_sidebar(int menu) {
2075 + #ifndef USE_SLANG_CURSES
2078 + short delim_len = strlen(SidebarDelim);
2081 + static bool initialized = false;
2082 + static int prev_show_value;
2083 + static short saveSidebarWidth;
2085 + int SidebarHeight;
2087 + if(option(OPTSTATUSONTOP) || option(OPTHELP))
2088 + lines++; /* either one will occupy the first line */
2090 + /* initialize first time */
2091 + if(!initialized) {
2092 + prev_show_value = option(OPTSIDEBAR);
2093 + saveSidebarWidth = SidebarWidth;
2094 + if(!option(OPTSIDEBAR)) SidebarWidth = 0;
2095 + initialized = true;
2098 + /* save or restore the value SidebarWidth */
2099 + if(prev_show_value != option(OPTSIDEBAR)) {
2100 + if(prev_show_value && !option(OPTSIDEBAR)) {
2101 + saveSidebarWidth = SidebarWidth;
2103 + } else if(!prev_show_value && option(OPTSIDEBAR)) {
2104 + mutt_buffy_check(1); /* we probably have bad or no numbers */
2105 + SidebarWidth = saveSidebarWidth;
2107 + prev_show_value = option(OPTSIDEBAR);
2111 + /* if ( SidebarWidth == 0 ) return 0; */
2112 + if (SidebarWidth > 0 && option (OPTSIDEBAR)
2113 + && delim_len >= SidebarWidth) {
2114 + unset_option (OPTSIDEBAR);
2115 + /* saveSidebarWidth = SidebarWidth; */
2116 + if (saveSidebarWidth > delim_len) {
2117 + SidebarWidth = saveSidebarWidth;
2118 + mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar."));
2122 + mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar. Please set your sidebar_width to a sane value."));
2123 + sleep (4); /* the advise to set a sane value should be seen long enough */
2125 + saveSidebarWidth = 0;
2129 + if ( SidebarWidth == 0 || !option(OPTSIDEBAR)) {
2130 + if (SidebarWidth > 0) {
2131 + saveSidebarWidth = SidebarWidth;
2134 + unset_option(OPTSIDEBAR);
2138 + /* get attributes for divider */
2139 + SETCOLOR(MT_COLOR_STATUS);
2140 + #ifndef USE_SLANG_CURSES
2141 + attr_get(&attrs, &color_pair, 0);
2143 + color_pair = attr_get();
2145 + SETCOLOR(MT_COLOR_NORMAL);
2147 + /* draw the divider */
2149 + SidebarHeight = LINES - 1;
2150 + if(option(OPTHELP) || !option(OPTSTATUSONTOP))
2153 + for ( ; lines < SidebarHeight; lines++ ) {
2154 + move(lines, SidebarWidth - delim_len);
2155 + addstr(NONULL(SidebarDelim));
2156 + #ifndef USE_SLANG_CURSES
2157 + mvchgat(lines, SidebarWidth - delim_len, delim_len, 0, color_pair, NULL);
2161 + if ( Incoming == 0 ) return 0;
2163 + if(option(OPTSTATUSONTOP) || option(OPTHELP))
2164 + lines++; /* either one will occupy the first line */
2166 + if ( known_lines != LINES || TopBuffy == 0 || BottomBuffy == 0 )
2167 + calc_boundaries(menu);
2168 + if ( CurBuffy == 0 ) CurBuffy = Incoming;
2172 + SETCOLOR(MT_COLOR_NORMAL);
2174 + for ( ; tmp && lines < SidebarHeight; tmp = tmp->next ) {
2175 + if ( tmp == CurBuffy )
2176 + SETCOLOR(MT_COLOR_INDICATOR);
2177 + else if ( tmp->msg_unread > 0 )
2178 + SETCOLOR(MT_COLOR_NEW);
2179 + else if ( tmp->msg_flagged > 0 )
2180 + SETCOLOR(MT_COLOR_FLAGGED);
2182 + SETCOLOR(MT_COLOR_NORMAL);
2185 + if ( Context && Context->path &&
2186 + (!strcmp(tmp->path, Context->path)||
2187 + !strcmp(tmp->realpath, Context->path)) ) {
2188 + tmp->msg_unread = Context->unread;
2189 + tmp->msgcount = Context->msgcount;
2190 + tmp->msg_flagged = Context->flagged;
2192 + /* check whether Maildir is a prefix of the current folder's path */
2193 + short maildir_is_prefix = 0;
2194 + if ( (strlen(tmp->path) > strlen(Maildir)) &&
2195 + (strncmp(Maildir, tmp->path, strlen(Maildir)) == 0) )
2196 + maildir_is_prefix = 1;
2197 + /* calculate depth of current folder and generate its display name with indented spaces */
2198 + int sidebar_folder_depth = 0;
2199 + char *sidebar_folder_name;
2200 + sidebar_folder_name = option(OPTSIDEBARSHORTPATH) ? mutt_basename(tmp->path) : tmp->path + maildir_is_prefix*(strlen(Maildir) + ((Maildir[strlen(Maildir) - 1] == '/' || Maildir[strlen(Maildir) - 1] == '}') ? 0 : 1));
2201 + if ( maildir_is_prefix && option(OPTSIDEBARFOLDERINDENT) ) {
2202 + char *tmp_folder_name;
2204 + tmp_folder_name = tmp->path + strlen(Maildir) + 1;
2205 + for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) {
2206 + if (tmp_folder_name[i] == '/' || tmp_folder_name[i] == '.') sidebar_folder_depth++;
2208 + if (sidebar_folder_depth > 0) {
2209 + if (option(OPTSIDEBARSHORTPATH)) {
2210 + tmp_folder_name = strrchr(tmp->path, '.');
2211 + if (tmp_folder_name == NULL)
2212 + tmp_folder_name = mutt_basename(tmp->path);
2214 + tmp_folder_name++;
2217 + tmp_folder_name = tmp->path + strlen(Maildir) + 1;
2218 + sidebar_folder_name = malloc(strlen(tmp_folder_name) + sidebar_folder_depth*strlen(NONULL(SidebarIndentStr)) + 1);
2219 + sidebar_folder_name[0]=0;
2220 + for (i=0; i < sidebar_folder_depth; i++)
2221 + strncat(sidebar_folder_name, NONULL(SidebarIndentStr), strlen(NONULL(SidebarIndentStr)));
2222 + strncat(sidebar_folder_name, tmp_folder_name, strlen(tmp_folder_name));
2225 + printw( "%.*s", SidebarWidth - delim_len + 1,
2226 + make_sidebar_entry(sidebar_folder_name, tmp->msgcount,
2227 + tmp->msg_unread, tmp->msg_flagged));
2228 + if (sidebar_folder_depth > 0)
2229 + free(sidebar_folder_name);
2232 + SETCOLOR(MT_COLOR_NORMAL);
2233 + for ( ; lines < SidebarHeight; lines++ ) {
2236 + for ( ; i < SidebarWidth - delim_len; i++ )
2243 + void set_buffystats(CONTEXT* Context)
2245 + BUFFY *tmp = Incoming;
2247 + if(Context && (!strcmp(tmp->path, Context->path) ||
2248 + !strcmp(tmp->realpath, Context->path))) {
2249 + tmp->msg_unread = Context->unread;
2250 + tmp->msgcount = Context->msgcount;
2251 + tmp->msg_flagged = Context->flagged;
2258 + void scroll_sidebar(int op, int menu)
2260 + if(!SidebarWidth) return;
2261 + if(!CurBuffy) return;
2264 + case OP_SIDEBAR_NEXT:
2265 + if ( CurBuffy->next == NULL ) return;
2266 + CurBuffy = CurBuffy->next;
2268 + case OP_SIDEBAR_PREV:
2269 + if ( CurBuffy->prev == NULL ) return;
2270 + CurBuffy = CurBuffy->prev;
2272 + case OP_SIDEBAR_SCROLL_UP:
2273 + CurBuffy = TopBuffy;
2274 + if ( CurBuffy != Incoming ) {
2275 + calc_boundaries(menu);
2276 + CurBuffy = CurBuffy->prev;
2279 + case OP_SIDEBAR_SCROLL_DOWN:
2280 + CurBuffy = BottomBuffy;
2281 + if ( CurBuffy->next ) {
2282 + calc_boundaries(menu);
2283 + CurBuffy = CurBuffy->next;
2289 + calc_boundaries(menu);
2290 + draw_sidebar(menu);
2293 *** mutt-1.5.24-orig/sidebar.h 1969-12-31 18:00:00.000000000 -0600
2294 --- mutt-1.5.24/sidebar.h 2015-09-16 23:18:13.000000000 -0500
2299 + * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu>
2300 + * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com>
2302 + * This program is free software; you can redistribute it and/or modify
2303 + * it under the terms of the GNU General Public License as published by
2304 + * the Free Software Foundation; either version 2 of the License, or
2305 + * (at your option) any later version.
2307 + * This program is distributed in the hope that it will be useful,
2308 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2309 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2310 + * GNU General Public License for more details.
2312 + * You should have received a copy of the GNU General Public License
2313 + * along with this program; if not, write to the Free Software
2314 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
2320 + struct MBOX_LIST {
2326 + /* parameter is whether or not to go to the status line */
2327 + /* used for omitting the last | that covers up the status bar in the index */
2328 + int draw_sidebar(int);
2329 + void scroll_sidebar(int, int);
2330 + void set_curbuffy(char*);
2331 + void set_buffystats(CONTEXT*);
2333 + #endif /* SIDEBAR_H */
2334 *** mutt-1.5.24-orig/doc/Muttrc 2015-08-30 12:24:53.000000000 -0500
2335 --- mutt-1.5.24/doc/Muttrc 2015-09-16 23:18:13.000000000 -0500
2339 # $crypt_autosign, $crypt_replysign and $smime_is_default.
2342 + # set sidebar_visible=no
2344 + # Name: sidebar_visible
2349 + # This specifies whether or not to show sidebar (left-side list of folders).
2352 + # set sidebar_width=0
2354 + # Name: sidebar_width
2359 + # The width of the sidebar.
2362 # set crypt_autosign=no
2364 # Name: crypt_autosign
2365 *** mutt-1.5.24-orig/imap/imap.c 2015-08-30 12:06:38.000000000 -0500
2366 --- mutt-1.5.24/imap/imap.c 2015-09-16 23:18:13.000000000 -0500
2370 imap_munge_mbox_name (munged, sizeof (munged), name);
2371 snprintf (command, sizeof (command),
2372 ! "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT)", munged);
2374 if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0)
2378 imap_munge_mbox_name (munged, sizeof (munged), name);
2379 snprintf (command, sizeof (command),
2380 ! "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT MESSAGES)", munged);
2382 if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0)
2384 *** mutt-1.5.24-orig/imap/command.c 2015-08-30 12:06:38.000000000 -0500
2385 --- mutt-1.5.24/imap/command.c 2015-09-16 23:18:13.000000000 -0500
2390 status->uidnext = oldun;
2392 + /* Added to make the sidebar show the correct numbers */
2393 + if (status->messages)
2395 + inc->msgcount = status->messages;
2396 + inc->msg_unread = status->unseen;