1 *** mutt-1.5.23-orig/buffy.c 2014-03-12 11:03:44.000000000 -0500
2 --- mutt-1.5.23/buffy.c 2014-04-12 15:33:54.000000000 -0500
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)
120 + /* update message counts for the sidebar */
121 + void buffy_maildir_update (BUFFY* mailbox)
123 + char path[_POSIX_PATH_MAX];
128 + if(!option(OPTSIDEBAR))
131 + mailbox->msgcount = 0;
132 + mailbox->msg_unread = 0;
133 + mailbox->msg_flagged = 0;
135 + snprintf (path, sizeof (path), "%s/new", mailbox->path);
137 + if ((dirp = opendir (path)) == NULL)
139 + mailbox->magic = 0;
143 + while ((de = readdir (dirp)) != NULL)
145 + if (*de->d_name == '.')
148 + if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
150 + mailbox->msgcount++;
151 + mailbox->msg_unread++;
156 + snprintf (path, sizeof (path), "%s/cur", mailbox->path);
158 + if ((dirp = opendir (path)) == NULL)
160 + mailbox->magic = 0;
164 + while ((de = readdir (dirp)) != NULL)
166 + if (*de->d_name == '.')
169 + if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) {
170 + mailbox->msgcount++;
171 + if ((p = strstr (de->d_name, ":2,"))) {
172 + if (!strchr (p + 3, 'T')) {
173 + if (!strchr (p + 3, 'S'))
174 + mailbox->msg_unread++;
175 + if (strchr(p + 3, 'F'))
176 + mailbox->msg_flagged++;
182 + mailbox->sb_last_checked = time(NULL);
186 /* returns 1 if mailbox has new mail */
187 static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb)
192 statcheck = sb->st_mtime > sb->st_atime
193 || (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
196 if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
200 statcheck = sb->st_mtime > sb->st_atime
201 || (mailbox->newly_created && sb->st_ctime == sb->st_mtime && sb->st_ctime == sb->st_atime);
202 ! if ((!option(OPTSIDEBAR) && statcheck) || (option(OPTSIDEBAR) && mailbox->msg_unread > 0))
204 if (!option(OPTMAILCHECKRECENT) || sb->st_mtime > mailbox->last_visited)
212 + /* update message counts for the sidebar */
213 + void buffy_mbox_update (BUFFY* mailbox, struct stat *sb)
215 + CONTEXT *ctx = NULL;
217 + if(!option(OPTSIDEBAR))
219 + if(mailbox->sb_last_checked > sb->st_mtime && mailbox->msgcount != 0)
220 + return; /* no check necessary */
222 + ctx = mx_open_mailbox(mailbox->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL);
225 + mailbox->msgcount = ctx->msgcount;
226 + mailbox->msg_unread = ctx->unread;
227 + mailbox->msg_flagged = ctx->flagged;
228 + mailbox->sb_last_checked = time(NULL);
229 + mx_close_mailbox(ctx, 0);
233 int mutt_buffy_check (int force)
241 if (buffy_mbox_hasnew (tmp, &sb) > 0)
246 if (buffy_maildir_hasnew (tmp) > 0)
259 + buffy_mbox_update (tmp, &sb);
260 if (buffy_mbox_hasnew (tmp, &sb) > 0)
265 + buffy_maildir_update (tmp);
266 if (buffy_maildir_hasnew (tmp) > 0)
271 ! mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged, &tmp->sb_last_checked);
276 *** mutt-1.5.23-orig/buffy.h 2014-03-12 11:03:44.000000000 -0500
277 --- mutt-1.5.23/buffy.h 2014-04-11 10:14:01.000000000 -0500
281 typedef struct buffy_t
283 char path[_POSIX_PATH_MAX];
284 + char realpath[_POSIX_PATH_MAX];
286 struct buffy_t *next;
287 + struct buffy_t *prev;
288 short new; /* mailbox has new mail */
289 + int msgcount; /* total number of messages */
290 + int msg_unread; /* number of unread messages */
291 + int msg_flagged; /* number of flagged messages */
292 short notified; /* user has been notified */
293 short magic; /* mailbox type */
294 short newly_created; /* mbox or mmdf just popped into existence */
295 time_t last_visited; /* time of last exit from this mailbox */
296 + time_t sb_last_checked; /* time of last buffy check from sidebar */
300 *** mutt-1.5.23-orig/color.c 2014-03-12 11:03:45.000000000 -0500
301 --- mutt-1.5.23/color.c 2014-04-11 10:14:01.000000000 -0500
305 { "bold", MT_COLOR_BOLD },
306 { "underline", MT_COLOR_UNDERLINE },
307 { "index", MT_COLOR_INDEX },
308 + { "sidebar_new", MT_COLOR_NEW },
309 + { "sidebar_flagged", MT_COLOR_FLAGGED },
313 *** mutt-1.5.23-orig/compose.c 2014-03-12 11:03:45.000000000 -0500
314 --- mutt-1.5.23/compose.c 2014-04-12 12:15:56.000000000 -0500
318 #define HDR_XOFFSET 10
319 #define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
320 ! #define W (COLS - HDR_XOFFSET)
322 static const char * const Prompts[] =
326 #define HDR_XOFFSET 10
327 #define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */
328 ! #define W (COLS - HDR_XOFFSET - SidebarWidth)
330 static const char * const Prompts[] =
335 static void redraw_crypt_lines (HEADER *msg)
337 ! mvaddstr (HDR_CRYPT, 0, "Security: ");
339 if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
343 static void redraw_crypt_lines (HEADER *msg)
345 ! mvaddstr (HDR_CRYPT, SidebarWidth, "Security: ");
347 if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0)
354 ! move (HDR_CRYPTINFO, 0);
357 if ((WithCrypto & APPLICATION_PGP)
362 ! move (HDR_CRYPTINFO, SidebarWidth);
365 if ((WithCrypto & APPLICATION_PGP)
368 && (msg->security & ENCRYPT)
371 ! mvprintw (HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "),
372 NONULL(SmimeCryptAlg));
376 && (msg->security & ENCRYPT)
379 ! mvprintw (HDR_CRYPTINFO, SidebarWidth + 40, "%s%s", _("Encrypt with: "),
380 NONULL(SmimeCryptAlg));
388 ! mvaddstr (HDR_MIX, 0, " Mix: ");
396 ! mvaddstr (HDR_MIX, SidebarWidth, " Mix: ");
402 if (t && t[0] == '0' && t[1] == '\0')
405 ! if (c + mutt_strlen (t) + 2 >= COLS)
410 if (t && t[0] == '0' && t[1] == '\0')
413 ! if (c + mutt_strlen (t) + 2 >= COLS - SidebarWidth)
421 rfc822_write_address (buf, sizeof (buf), addr, 1);
422 ! mvprintw (line, 0, TITLE_FMT, Prompts[line - 1]);
423 mutt_paddstr (W, buf);
429 rfc822_write_address (buf, sizeof (buf), addr, 1);
430 ! mvprintw (line, SidebarWidth, TITLE_FMT, Prompts[line - 1]);
431 mutt_paddstr (W, buf);
436 draw_envelope_addr (HDR_TO, msg->env->to);
437 draw_envelope_addr (HDR_CC, msg->env->cc);
438 draw_envelope_addr (HDR_BCC, msg->env->bcc);
439 ! mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
440 mutt_paddstr (W, NONULL (msg->env->subject));
441 draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
442 ! mvprintw (HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]);
443 mutt_paddstr (W, fcc);
447 draw_envelope_addr (HDR_TO, msg->env->to);
448 draw_envelope_addr (HDR_CC, msg->env->cc);
449 draw_envelope_addr (HDR_BCC, msg->env->bcc);
450 ! mvprintw (HDR_SUBJECT, SidebarWidth, TITLE_FMT, Prompts[HDR_SUBJECT - 1]);
451 mutt_paddstr (W, NONULL (msg->env->subject));
452 draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to);
453 ! mvprintw (HDR_FCC, SidebarWidth, TITLE_FMT, Prompts[HDR_FCC - 1]);
454 mutt_paddstr (W, fcc);
461 SETCOLOR (MT_COLOR_STATUS);
462 ! mvaddstr (HDR_ATTACH - 1, 0, _("-- Attachments"));
469 SETCOLOR (MT_COLOR_STATUS);
470 ! mvaddstr (HDR_ATTACH - 1, SidebarWidth, _("-- Attachments"));
476 /* redraw the expanded list so the user can see the result */
478 rfc822_write_address (buf, sizeof (buf), *addr, 1);
479 ! move (line, HDR_XOFFSET);
480 mutt_paddstr (W, buf);
484 /* redraw the expanded list so the user can see the result */
486 rfc822_write_address (buf, sizeof (buf), *addr, 1);
487 ! move (line, HDR_XOFFSET+SidebarWidth);
488 mutt_paddstr (W, buf);
493 if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
495 mutt_str_replace (&msg->env->subject, buf);
496 ! move (HDR_SUBJECT, HDR_XOFFSET);
497 if (msg->env->subject)
498 mutt_paddstr (W, msg->env->subject);
501 if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0)
503 mutt_str_replace (&msg->env->subject, buf);
504 ! move (HDR_SUBJECT, HDR_XOFFSET + SidebarWidth);
505 if (msg->env->subject)
506 mutt_paddstr (W, msg->env->subject);
511 strfcpy (fcc, buf, fcclen);
512 mutt_pretty_mailbox (fcc, fcclen);
513 ! move (HDR_FCC, HDR_XOFFSET);
514 mutt_paddstr (W, fcc);
519 strfcpy (fcc, buf, fcclen);
520 mutt_pretty_mailbox (fcc, fcclen);
521 ! move (HDR_FCC, HDR_XOFFSET + SidebarWidth);
522 mutt_paddstr (W, fcc);
525 *** mutt-1.5.23-orig/configure.ac 2014-03-12 11:26:40.000000000 -0500
526 --- mutt-1.5.23/configure.ac 2014-04-11 10:14:01.000000000 -0500
530 AC_DEFINE(HAVE_LANGINFO_YESEXPR,1,[ Define if you have <langinfo.h> and nl_langinfo(YESEXPR). ])
533 + AC_CHECK_FUNCS(fmemopen open_memstream)
535 dnl Documentation tools
537 AC_PATH_PROG([OSPCAT], [ospcat], [none])
538 *** mutt-1.5.23-orig/curs_main.c 2014-03-12 11:06:17.000000000 -0500
539 --- mutt-1.5.23/curs_main.c 2014-04-12 21:45:21.000000000 -0500
548 + #include "sidebar.h"
554 menu->redraw |= REDRAW_STATUS;
557 ! if (mutt_buffy_notify () && option (OPTBEEPNEW))
567 if (menu->redraw & REDRAW_FULL)
569 menu_redraw_full (menu);
573 if (menu->menu == MENU_MAIN)
575 menu->redraw |= REDRAW_STATUS;
578 ! if (mutt_buffy_notify ())
580 ! menu->redraw |= REDRAW_STATUS;
581 ! if (option (OPTBEEPNEW))
589 + if(option(OPTSIDEBAR))
590 + menu->redraw |= REDRAW_SIDEBAR;
595 if (menu->redraw & REDRAW_FULL)
597 menu_redraw_full (menu);
598 + draw_sidebar(menu->menu);
600 + } else if(menu->redraw & REDRAW_SIDEBAR) {
601 + draw_sidebar(menu->menu);
602 + menu->redraw &= ~REDRAW_SIDEBAR;
605 if (menu->menu == MENU_MAIN)
610 if (menu->redraw & REDRAW_STATUS)
613 menu_status_line (buf, sizeof (buf), menu, NONULL (Status));
615 move (option (OPTSTATUSONTOP) ? 0 : LINES-2, 0);
616 SETCOLOR (MT_COLOR_STATUS);
617 + set_buffystats(Context);
618 mutt_paddstr (COLS, buf);
620 menu->redraw &= ~REDRAW_STATUS;
623 menu->oldcurrent = -1;
625 if (option (OPTARROWCURSOR))
626 ! move (menu->current - menu->top + menu->offset, 2);
627 else if (option (OPTBRAILLEFRIENDLY))
628 move (menu->current - menu->top + menu->offset, 0);
631 menu->oldcurrent = -1;
633 if (option (OPTARROWCURSOR))
634 ! move (menu->current - menu->top + menu->offset, SidebarWidth + 2);
635 else if (option (OPTBRAILLEFRIENDLY))
636 move (menu->current - menu->top + menu->offset, 0);
647 int oldvcount = Context->vcount;
651 menu->redraw = REDRAW_FULL;
654 + case OP_SIDEBAR_OPEN:
655 case OP_MAIN_CHANGE_FOLDER:
656 case OP_MAIN_NEXT_UNREAD_MAILBOX:
661 mutt_buffy (buf, sizeof (buf));
663 ! if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
665 if (menu->menu == MENU_PAGER)
669 mutt_buffy (buf, sizeof (buf));
671 ! if ( op == OP_SIDEBAR_OPEN ) {
674 ! strncpy( buf, CurBuffy->path, sizeof(buf) );
675 ! } else if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1)
677 if (menu->menu == MENU_PAGER)
684 mutt_expand_path (buf, sizeof (buf));
686 if (mx_get_magic (buf) <= 0)
688 mutt_error (_("%s is not a mailbox."), buf);
695 + case OP_SIDEBAR_SCROLL_UP:
696 + case OP_SIDEBAR_SCROLL_DOWN:
697 + case OP_SIDEBAR_NEXT:
698 + case OP_SIDEBAR_PREV:
699 + scroll_sidebar(op, menu->menu);
702 if (menu->menu == MENU_MAIN)
703 km_error_key (MENU_MAIN);
704 *** mutt-1.5.23-orig/flags.c 2014-03-12 11:03:45.000000000 -0500
705 --- mutt-1.5.23/flags.c 2014-04-11 10:14:01.000000000 -0500
711 #include "mutt_curses.h"
712 + #include "mutt_menu.h"
715 + #include "sidebar.h"
717 void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx)
723 if (h->searched && (changed != h->changed || deleted != ctx->deleted || tagged != ctx->tagged || flagged != ctx->flagged))
728 void mutt_tag_set_flag (int flag, int bf)
729 *** mutt-1.5.23-orig/functions.h 2014-03-12 11:03:45.000000000 -0500
730 --- mutt-1.5.23/functions.h 2014-04-11 10:14:01.000000000 -0500
734 { "decrypt-save", OP_DECRYPT_SAVE, NULL },
737 + { "sidebar-scroll-up", OP_SIDEBAR_SCROLL_UP, NULL },
738 + { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL },
739 + { "sidebar-next", OP_SIDEBAR_NEXT, NULL },
740 + { "sidebar-prev", OP_SIDEBAR_PREV, NULL },
741 + { "sidebar-open", OP_SIDEBAR_OPEN, NULL },
749 { "what-key", OP_WHAT_KEY, NULL },
751 + { "sidebar-scroll-up", OP_SIDEBAR_SCROLL_UP, NULL },
752 + { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL },
753 + { "sidebar-next", OP_SIDEBAR_NEXT, NULL },
754 + { "sidebar-prev", OP_SIDEBAR_PREV, NULL },
755 + { "sidebar-open", OP_SIDEBAR_OPEN, NULL },
759 *** mutt-1.5.23-orig/globals.h 2014-03-12 11:06:17.000000000 -0500
760 --- mutt-1.5.23/globals.h 2014-04-11 10:14:01.000000000 -0500
764 WHERE char *SendCharset;
765 WHERE char *Sendmail;
767 + WHERE char *SidebarDelim;
768 + WHERE char *SidebarFormat;
769 + WHERE char *SidebarIndentStr;
770 WHERE char *Signature;
771 WHERE char *SimpleSearch;
776 WHERE short ScoreThresholdRead;
777 WHERE short ScoreThresholdFlag;
779 + WHERE struct buffy_t *CurBuffy INITVAL(0);
780 + WHERE short DrawFullLine INITVAL(0);
781 + WHERE short SidebarWidth;
783 WHERE short ImapKeepalive;
784 WHERE short ImapPipelineDepth;
785 *** mutt-1.5.23-orig/handler.c 2014-03-12 11:03:45.000000000 -0500
786 --- mutt-1.5.23/handler.c 2014-04-11 10:14:01.000000000 -0500
790 size_t tmplength = 0;
793 + #ifdef HAVE_FMEMOPEN
798 int oflags = s->flags;
800 /* first determine which handler to use to process this part */
805 /* decode to a tempfile, saving the original destination */
807 + #ifdef HAVE_FMEMOPEN
808 + if ((s->fpout = open_memstream(&temp, &tempsize)) == NULL)
810 + mutt_error _("Unable to open memory stream!");
811 + dprint (1, (debugfile, "Can't open memory stream.\n"));
815 mutt_mktemp (tempfile, sizeof (tempfile));
816 if ((s->fpout = safe_fopen (tempfile, "w")) == NULL)
821 dprint (1, (debugfile, "Can't open %s.\n", tempfile));
825 /* decoding the attachment changes the size and offset, so save a copy
826 * of the "real" values now, and restore them after processing
831 /* restore final destination and substitute the tempfile for input */
834 + #ifdef HAVE_FMEMOPEN
836 + s->fpin = fmemopen(temp, tempsize, "r");
837 + else /* fmemopen cannot handle zero-length buffers */
838 + s->fpin = safe_fopen ("/dev/null", "r");
839 + if(s->fpin == NULL) {
840 + mutt_perror("failed to re-open memstream!");
844 s->fpin = fopen (tempfile, "r");
848 /* restore the prefix */
849 s->prefix = savePrefix;
854 /* restore the original source stream */
855 safe_fclose (&s->fpin);
856 + #ifdef HAVE_FMEMOPEN
863 *** mutt-1.5.23-orig/init.h 2014-03-12 11:06:17.000000000 -0500
864 --- mutt-1.5.23/init.h 2014-04-11 10:14:01.000000000 -0500
871 + {"sidebar_delim", DT_STR, R_BOTH, UL &SidebarDelim, UL "|"},
874 + ** This specifies the delimiter between the sidebar (if visible) and
877 + {"sidebar_indentstr", DT_STR, R_BOTH, UL &SidebarIndentStr, UL " "},
880 + ** This specifies the string that is used to indent items
881 + ** with sidebar_folderindent= yes
883 + { "sidebar_visible", DT_BOOL, R_BOTH, OPTSIDEBAR, 0 },
886 + ** This specifies whether or not to show sidebar (left-side list of folders).
888 + { "sidebar_sort", DT_BOOL, R_BOTH, OPTSIDEBARSORT, 0 },
891 + ** This specifies whether or not to sort the sidebar alphabetically.
893 + { "sidebar_width", DT_NUM, R_BOTH, UL &SidebarWidth, 0 },
896 + ** The width of the sidebar.
898 + { "sidebar_shortpath", DT_BOOL, R_BOTH, OPTSIDEBARSHORTPATH, 0 },
901 + ** Should the sidebar shorten the path showed.
903 + {"sidebar_format", DT_STR, R_NONE, UL &SidebarFormat, UL "%B%?F? [%F]?%* %?N?%N/?%4S"},
906 + ** Format string for the sidebar. The sequences `%N', `%F' and `%S'
907 + ** will be replaced by the number of new or flagged messages or the total
908 + ** size of them mailbox. `%B' will be replaced with the name of the mailbox.
909 + ** The `%!' sequence will be expanded to `!' if there is one flagged message;
910 + ** to `!!' if there are two flagged messages; and to `n!' for n flagged
913 + { "sidebar_folderindent", DT_BOOL, R_BOTH, OPTSIDEBARFOLDERINDENT, 0 },
916 + ** Should folders be indented in the sidebar.
919 { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0},
922 *** mutt-1.5.23-orig/mailbox.h 2014-03-12 11:03:45.000000000 -0500
923 --- mutt-1.5.23/mailbox.h 2014-04-11 10:14:01.000000000 -0500
927 #define M_NEWFOLDER (1<<4) /* create a new folder - same as M_APPEND, but uses
928 * safe_fopen() for mbox-style folders.
930 + #define M_PEEK (1<<5) /* revert atime back after taking a look (if applicable) */
932 /* mx_open_new_message() */
933 #define M_ADD_FROM 1 /* add a From_ line */
934 *** mutt-1.5.23-orig/main.c 2014-03-12 11:06:17.000000000 -0500
935 --- mutt-1.5.23/main.c 2014-04-11 10:14:01.000000000 -0500
941 #include <sys/stat.h>
942 + #include <limits.h>
943 #include <sys/utsname.h>
949 int main (int argc, char **argv)
951 ! char folder[_POSIX_PATH_MAX] = "";
952 char *subject = NULL;
953 char *includeFile = NULL;
954 char *draftFile = NULL;
957 int main (int argc, char **argv)
959 ! char folder[PATH_MAX] = "";
960 char *subject = NULL;
961 char *includeFile = NULL;
962 char *draftFile = NULL;
966 strfcpy (folder, NONULL(Spoolfile), sizeof (folder));
967 mutt_expand_path (folder, sizeof (folder));
970 + char tmpfolder[PATH_MAX];
971 + strfcpy (tmpfolder, folder, sizeof (tmpfolder));
972 + if(!realpath(tmpfolder, folder))
973 + strfcpy (folder, tmpfolder, sizeof (tmpfolder));
976 mutt_str_replace (&CurrentFolder, folder);
977 mutt_str_replace (&LastFolder, folder);
982 if((Context = mx_open_mailbox (folder, ((flags & M_RO) || option (OPTREADONLY)) ? M_READONLY : 0, NULL))
985 + set_curbuffy(folder);
989 *** mutt-1.5.23-orig/Makefile.am 2014-03-12 11:03:44.000000000 -0500
990 --- mutt-1.5.23/Makefile.am 2014-04-11 10:14:01.000000000 -0500
994 rfc822.c rfc1524.c rfc2047.c rfc2231.c rfc3676.c \
995 score.c send.c sendlib.c signal.c sort.c \
996 status.c system.c thread.c charset.c history.c lib.c \
998 muttlib.c editmsg.c mbyte.c \
999 url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
1001 *** mutt-1.5.23-orig/Makefile.in 2014-03-12 11:26:44.000000000 -0500
1002 --- mutt-1.5.23/Makefile.in 2014-04-12 12:12:38.000000000 -0500
1005 system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
1006 history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
1007 editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \
1008 ! ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT)
1010 am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \
1013 system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \
1014 history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \
1015 editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \
1016 ! ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT) \
1019 am__objects_2 = patchlist.$(OBJEXT) conststrings.$(OBJEXT) \
1023 score.c send.c sendlib.c signal.c sort.c \
1024 status.c system.c thread.c charset.c history.c lib.c \
1025 muttlib.c editmsg.c mbyte.c \
1026 ! url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c
1028 nodist_mutt_SOURCES = $(BUILT_SOURCES)
1029 mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
1031 score.c send.c sendlib.c signal.c sort.c \
1032 status.c system.c thread.c charset.c history.c lib.c \
1033 muttlib.c editmsg.c mbyte.c \
1034 ! url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c \
1037 nodist_mutt_SOURCES = $(BUILT_SOURCES)
1038 mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \
1041 README.SSL smime.h group.h \
1042 muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
1043 ChangeLog mkchangelog.sh mutt_idna.h \
1044 ! snprintf.c regex.c crypt-gpgme.h hcachever.sh.in \
1045 txt2c.c txt2c.sh version.sh check_sec.sh
1047 EXTRA_SCRIPTS = smime_keys
1049 README.SSL smime.h group.h \
1050 muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \
1051 ChangeLog mkchangelog.sh mutt_idna.h \
1052 ! snprintf.c regex.c crypt-gpgme.h sidebar.h hcachever.sh.in \
1053 txt2c.c txt2c.sh version.sh check_sec.sh
1055 EXTRA_SCRIPTS = smime_keys
1056 *** mutt-1.5.23-orig/mbox.c 2014-03-12 11:03:45.000000000 -0500
1057 --- mutt-1.5.23/mbox.c 2014-04-11 10:14:01.000000000 -0500
1061 mutt_perror (ctx->path);
1064 + ctx->atime = sb.st_atime;
1065 ctx->mtime = sb.st_mtime;
1066 ctx->size = sb.st_size;
1072 ctx->size = sb.st_size;
1073 ctx->mtime = sb.st_mtime;
1074 + ctx->atime = sb.st_atime;
1076 #ifdef NFS_ATTRIBUTE_HACK
1077 if (sb.st_mtime > sb.st_atime)
1078 *** mutt-1.5.23-orig/menu.c 2014-03-12 11:03:45.000000000 -0500
1079 --- mutt-1.5.23/menu.c 2014-04-12 21:31:16.000000000 -0500
1083 #include "mutt_curses.h"
1084 #include "mutt_menu.h"
1086 + #include "sidebar.h"
1088 extern size_t UngetCount;
1093 char *scratch = safe_strdup (s);
1094 int shift = option (OPTARROWCURSOR) ? 3 : 0;
1095 ! int cols = COLS - shift;
1097 mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1);
1101 char *scratch = safe_strdup (s);
1102 int shift = option (OPTARROWCURSOR) ? 3 : 0;
1103 ! int cols = COLS - shift - SidebarWidth;
1105 mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1);
1114 for (i = menu->top; i < menu->top + menu->pagelen; i++)
1119 menu_pad_string (buf, sizeof (buf));
1122 ! move(i - menu->top + menu->offset, 0);
1125 if (i == menu->current)
1127 menu_pad_string (buf, sizeof (buf));
1130 ! move(i - menu->top + menu->offset, SidebarWidth);
1133 if (i == menu->current)
1139 ! CLEARLINE(i - menu->top + menu->offset);
1147 ! CLEARLINE_WIN (i - menu->top + menu->offset);
1156 ! move (menu->oldcurrent + menu->offset - menu->top, 0);
1157 ATTRSET(menu->color (menu->oldcurrent));
1159 if (option (OPTARROWCURSOR))
1164 ! move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth);
1165 ATTRSET(menu->color (menu->oldcurrent));
1167 if (option (OPTARROWCURSOR))
1171 menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
1172 menu_pad_string (buf, sizeof (buf));
1173 ! move (menu->oldcurrent + menu->offset - menu->top, 3);
1174 print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
1177 /* now draw it in the new location */
1178 SETCOLOR(MT_COLOR_INDICATOR);
1179 ! mvaddstr(menu->current + menu->offset - menu->top, 0, "->");
1185 menu_make_entry (buf, sizeof (buf), menu, menu->oldcurrent);
1186 menu_pad_string (buf, sizeof (buf));
1187 ! move (menu->oldcurrent + menu->offset - menu->top, SidebarWidth + 3);
1188 print_enriched_string (menu->color(menu->oldcurrent), (unsigned char *) buf, 1);
1191 /* now draw it in the new location */
1192 SETCOLOR(MT_COLOR_INDICATOR);
1193 ! mvaddstr(menu->current + menu->offset - menu->top, SidebarWidth, "->");
1199 menu_make_entry (buf, sizeof (buf), menu, menu->current);
1200 menu_pad_string (buf, sizeof (buf));
1201 SETCOLOR(MT_COLOR_INDICATOR);
1202 ! move(menu->current - menu->top + menu->offset, 0);
1203 print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
1205 menu->redraw &= REDRAW_STATUS;
1207 menu_make_entry (buf, sizeof (buf), menu, menu->current);
1208 menu_pad_string (buf, sizeof (buf));
1209 SETCOLOR(MT_COLOR_INDICATOR);
1210 ! move(menu->current - menu->top + menu->offset, SidebarWidth);
1211 print_enriched_string (menu->color(menu->current), (unsigned char *) buf, 0);
1213 menu->redraw &= REDRAW_STATUS;
1216 char buf[LONG_STRING];
1217 int attr = menu->color (menu->current);
1219 ! move (menu->current + menu->offset - menu->top, 0);
1220 menu_make_entry (buf, sizeof (buf), menu, menu->current);
1221 menu_pad_string (buf, sizeof (buf));
1224 char buf[LONG_STRING];
1225 int attr = menu->color (menu->current);
1227 ! move (menu->current + menu->offset - menu->top, SidebarWidth);
1228 menu_make_entry (buf, sizeof (buf), menu, menu->current);
1229 menu_pad_string (buf, sizeof (buf));
1235 if (option (OPTARROWCURSOR))
1236 ! move (menu->current - menu->top + menu->offset, 2);
1237 else if (option (OPTBRAILLEFRIENDLY))
1238 move (menu->current - menu->top + menu->offset, 0);
1243 if (option (OPTARROWCURSOR))
1244 ! move (menu->current - menu->top + menu->offset, SidebarWidth + 2);
1245 else if (option (OPTBRAILLEFRIENDLY))
1246 move (menu->current - menu->top + menu->offset, 0);
1248 *** mutt-1.5.23-orig/mh.c 2014-03-12 11:03:45.000000000 -0500
1249 --- mutt-1.5.23/mh.c 2014-04-11 11:04:59.000000000 -0500
1253 mhs_free_sequences (&mhs);
1256 + void mh_buffy_update (const char *path, int *msgcount, int *msg_unread, int *msg_flagged, time_t *sb_last_checked)
1259 + struct mh_sequences mhs;
1260 + memset (&mhs, 0, sizeof (mhs));
1262 + if(!option(OPTSIDEBAR))
1265 + if (mh_read_sequences (&mhs, path) < 0)
1271 + for (i = 0; i <= mhs.max; i++)
1273 + if (mhs_check (&mhs, i) & MH_SEQ_UNSEEN) {
1276 + if (mhs_check (&mhs, i) & MH_SEQ_FLAGGED)
1278 + mhs_free_sequences (&mhs);
1279 + *sb_last_checked = time(NULL);
1282 static int mh_mkstemp (CONTEXT * dest, FILE ** fp, char **tgt)
1285 *** mutt-1.5.23-orig/mutt_curses.h 2014-03-12 11:03:45.000000000 -0500
1286 --- mutt-1.5.23/mutt_curses.h 2014-04-11 10:14:01.000000000 -0500
1293 + #define CLEARLINE_WIN(x) move(x,SidebarWidth), clrtoeol()
1294 #define CLEARLINE(x) move(x,0), clrtoeol()
1295 #define CENTERLINE(x,y) move(y, (COLS-strlen(x))/2), addstr(x)
1296 #define BEEP() do { if (option (OPTBEEP)) beep(); } while (0)
1308 *** mutt-1.5.23-orig/mutt_menu.h 2014-03-12 11:06:17.000000000 -0500
1309 --- mutt-1.5.23/mutt_menu.h 2014-04-11 10:14:01.000000000 -0500
1313 #define REDRAW_FULL (1<<5)
1314 #define REDRAW_BODY (1<<6)
1315 #define REDRAW_SIGWINCH (1<<7)
1316 + #define REDRAW_SIDEBAR (1<<8)
1318 #define M_MODEFMT "-- Mutt: %s"
1320 *** mutt-1.5.23-orig/mutt.h 2014-03-12 11:06:17.000000000 -0500
1321 --- mutt-1.5.23/mutt.h 2014-04-11 10:14:01.000000000 -0500
1329 + OPTSIDEBARSHORTPATH,
1331 + OPTSIDEBARFOLDERINDENT,
1348 unsigned int quiet : 1; /* inhibit status messages? */
1349 unsigned int collapsed : 1; /* are all threads collapsed? */
1350 unsigned int closing : 1; /* mailbox is being closed */
1351 + unsigned int peekonly : 1; /* just taking a glance, revert atime */
1354 void *data; /* driver specific data */
1355 *** mutt-1.5.23-orig/muttlib.c 2014-03-12 11:03:45.000000000 -0500
1356 --- mutt-1.5.23/muttlib.c 2014-04-11 10:14:01.000000000 -0500
1362 /* see if there's room to add content, else ignore */
1363 + if ( DrawFullLine )
1365 if ((col < COLS && wlen < destlen) || soft)
1377 + if ((col < COLS-SidebarWidth && wlen < destlen) || soft)
1381 + /* get contents after padding */
1382 + mutt_FormatString (buf, sizeof (buf), 0, src + pl, callback, data, flags);
1383 + len = mutt_strlen (buf);
1384 + wid = mutt_strwidth (buf);
1386 + /* try to consume as many columns as we can, if we don't have
1387 + * memory for that, use as much memory as possible */
1388 + pad = (COLS - SidebarWidth - col - wid) / pw;
1389 + if (pad > 0 && wlen + (pad * pl) + len > destlen)
1390 + pad = ((signed)(destlen - wlen - len)) / pl;
1395 + memcpy (wptr, src, pl);
1401 + else if (soft && pad < 0)
1403 + /* \0-terminate dest for length computation in mutt_wstr_trunc() */
1405 + /* make sure right part is at most as wide as display */
1406 + len = mutt_wstr_trunc (buf, destlen, COLS, &wid);
1407 + /* truncate left so that right part fits completely in */
1408 + wlen = mutt_wstr_trunc (dest, destlen - len, col + pad, &col);
1409 + wptr = dest + wlen;
1411 + if (len + wlen > destlen)
1412 + len = mutt_wstr_trunc (buf, destlen - wlen, COLS - SidebarWidth - col, NULL);
1413 + memcpy (wptr, buf, len);
1420 break; /* skip rest of input */
1423 *** mutt-1.5.23-orig/mx.c 2014-03-12 11:03:45.000000000 -0500
1424 --- mutt-1.5.23/mx.c 2014-04-11 10:14:01.000000000 -0500
1428 * M_APPEND open mailbox for appending
1429 * M_READONLY open mailbox in read-only mode
1430 * M_QUIET only print error messages
1431 + * M_PEEK revert atime where applicable
1432 * ctx if non-null, context struct to use
1434 CONTEXT *mx_open_mailbox (const char *path, int flags, CONTEXT *pctx)
1439 if (flags & M_READONLY)
1441 + if (flags & M_PEEK)
1442 + ctx->peekonly = 1;
1444 if (flags & (M_APPEND|M_NEWFOLDER))
1448 void mx_fastclose_mailbox (CONTEXT *ctx)
1455 /* never announce that a mailbox we've just left has new mail. #3290
1456 * XXX: really belongs in mx_close_mailbox, but this is a nice hook point */
1457 ! mutt_buffy_setnotified(ctx->path);
1460 ctx->mx_close (ctx);
1462 void mx_fastclose_mailbox (CONTEXT *ctx)
1465 + #ifndef BUFFY_SIZE
1466 + struct utimbuf ut;
1471 + #ifndef BUFFY_SIZE
1472 + /* fix up the times so buffy won't get confused */
1473 + if (ctx->peekonly && ctx->path && ctx->mtime > ctx->atime)
1475 + ut.actime = ctx->atime;
1476 + ut.modtime = ctx->mtime;
1477 + utime (ctx->path, &ut);
1481 /* never announce that a mailbox we've just left has new mail. #3290
1482 * XXX: really belongs in mx_close_mailbox, but this is a nice hook point */
1483 ! if(!ctx->peekonly)
1484 ! mutt_buffy_setnotified(ctx->path);
1487 ctx->mx_close (ctx);
1491 mutt_clear_threads (ctx);
1492 for (i = 0; i < ctx->msgcount; i++)
1493 mutt_free_header (&ctx->hdrs[i]);
1494 + ctx->msgcount -= ctx->deleted;
1495 + set_buffystats(ctx);
1502 if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->read
1503 && !(ctx->hdrs[i]->flagged && option (OPTKEEPFLAGGED)))
1505 + if (ctx->hdrs[i]->deleted && !ctx->hdrs[i]->read)
1507 + if (ctx->hdrs[i]->deleted && ctx->hdrs[i]->flagged)
1511 if (read_msgs && quadoption (OPT_MOVE) != M_NO)
1512 *** mutt-1.5.23-orig/mx.h 2014-03-12 11:03:45.000000000 -0500
1513 --- mutt-1.5.23/mx.h 2014-04-11 11:11:47.000000000 -0500
1517 int mh_read_dir (CONTEXT *, const char *);
1518 int mh_sync_mailbox (CONTEXT *, int *);
1519 int mh_check_mailbox (CONTEXT *, int *);
1520 + void mh_buffy_update (const char *, int *, int *, int *, time_t *);
1521 int mh_check_empty (const char *);
1523 int maildir_read_dir (CONTEXT *);
1524 *** mutt-1.5.23-orig/OPS 2014-03-12 11:03:44.000000000 -0500
1525 --- mutt-1.5.23/OPS 2014-04-11 10:14:01.000000000 -0500
1529 OP_MAIN_SHOW_LIMIT "show currently active limit pattern"
1530 OP_MAIN_COLLAPSE_THREAD "collapse/uncollapse current thread"
1531 OP_MAIN_COLLAPSE_ALL "collapse/uncollapse all threads"
1532 + OP_SIDEBAR_SCROLL_UP "scroll the mailbox pane up 1 page"
1533 + OP_SIDEBAR_SCROLL_DOWN "scroll the mailbox pane down 1 page"
1534 + OP_SIDEBAR_NEXT "go down to next mailbox"
1535 + OP_SIDEBAR_PREV "go to previous mailbox"
1536 + OP_SIDEBAR_OPEN "open hilighted mailbox"
1537 *** mutt-1.5.23-orig/pager.c 2014-03-12 11:06:17.000000000 -0500
1538 --- mutt-1.5.23/pager.c 2014-04-12 21:53:15.000000000 -0500
1545 + #include "sidebar.h"
1547 #include "mutt_crypt.h"
1554 int wrap_cols = mutt_term_width ((flags & M_PAGER_NOWRAP) ? 0 : Wrap);
1555 + wrap_cols -= SidebarWidth;
1557 if (check_attachment_marker ((char *)buf) == 0)
1563 int bodyoffset = 1; /* offset of first line of real text */
1564 int statusoffset = 0; /* offset for the status bar */
1566 int helpoffset = LINES - 2; /* offset for the help bar. */
1567 int bodylen = LINES - 2 - bodyoffset; /* length of displayable area */
1571 if ((redraw & REDRAW_BODY) || topline != oldtopline)
1574 ! move (bodyoffset, 0);
1575 curline = oldtopline = topline;
1579 if ((redraw & REDRAW_BODY) || topline != oldtopline)
1582 ! move (bodyoffset, SidebarWidth);
1583 curline = oldtopline = topline;
1589 &QuoteList, &q_level, &force_redraw, &SearchRE) > 0)
1592 + move(lines + bodyoffset, SidebarWidth);
1594 last_offset = lineInfo[curline].offset;
1595 } while (force_redraw);
1602 + move(lines + bodyoffset, SidebarWidth);
1609 hfi.pager_progress = pager_progress_str;
1611 if (last_pos < sb.st_size - 1)
1612 snprintf(pager_progress_str, sizeof(pager_progress_str), OFF_T_FMT "%%", (100 * last_offset / sb.st_size));
1614 strfcpy(pager_progress_str, (topline == 0) ? "all" : "end", sizeof(pager_progress_str));
1616 /* print out the pager status bar */
1617 ! move (statusoffset, 0);
1618 SETCOLOR (MT_COLOR_STATUS);
1620 if (IsHeader (extra) || IsMsgAttach (extra))
1622 ! size_t l1 = COLS * MB_LEN_MAX;
1623 size_t l2 = sizeof (buffer);
1624 hfi.hdr = (IsHeader (extra)) ? extra->hdr : extra->bdy->hdr;
1625 mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), &hfi, M_FORMAT_MAKEPRINT);
1626 ! mutt_paddstr (COLS, buffer);
1631 snprintf (bn, sizeof (bn), "%s (%s)", banner, pager_progress_str);
1632 ! mutt_paddstr (COLS, bn);
1639 hfi.pager_progress = pager_progress_str;
1641 + statuswidth = COLS - (option(OPTSTATUSONTOP) && PagerIndexLines > 0 ? SidebarWidth : 0);
1643 if (last_pos < sb.st_size - 1)
1644 snprintf(pager_progress_str, sizeof(pager_progress_str), OFF_T_FMT "%%", (100 * last_offset / sb.st_size));
1646 strfcpy(pager_progress_str, (topline == 0) ? "all" : "end", sizeof(pager_progress_str));
1648 /* print out the pager status bar */
1649 ! move (statusoffset, SidebarWidth);
1650 SETCOLOR (MT_COLOR_STATUS);
1651 + if(option(OPTSTATUSONTOP) && PagerIndexLines > 0) {
1652 + CLEARLINE_WIN (statusoffset);
1654 + CLEARLINE (statusoffset);
1655 + DrawFullLine = 1; /* for mutt_make_string_info */
1658 if (IsHeader (extra) || IsMsgAttach (extra))
1660 ! size_t l1 = statuswidth * MB_LEN_MAX;
1661 size_t l2 = sizeof (buffer);
1662 hfi.hdr = (IsHeader (extra)) ? extra->hdr : extra->bdy->hdr;
1663 mutt_make_string_info (buffer, l1 < l2 ? l1 : l2, NONULL (PagerFmt), &hfi, M_FORMAT_MAKEPRINT);
1664 ! mutt_paddstr (statuswidth, buffer);
1669 snprintf (bn, sizeof (bn), "%s (%s)", banner, pager_progress_str);
1670 ! mutt_paddstr (statuswidth, bn);
1672 + if(!option(OPTSTATUSONTOP) || PagerIndexLines == 0)
1673 + DrawFullLine = 0; /* reset */
1679 /* redraw the pager_index indicator, because the
1680 * flags for this message might have changed. */
1681 menu_redraw_current (index);
1683 /* print out the index status bar */
1684 menu_status_line (buffer, sizeof (buffer), index, NONULL(Status));
1686 ! move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)), 0);
1687 SETCOLOR (MT_COLOR_STATUS);
1688 ! mutt_paddstr (COLS, buffer);
1694 if (option(OPTBRAILLEFRIENDLY)) {
1696 /* redraw the pager_index indicator, because the
1697 * flags for this message might have changed. */
1698 menu_redraw_current (index);
1699 + draw_sidebar(MENU_PAGER);
1701 /* print out the index status bar */
1702 menu_status_line (buffer, sizeof (buffer), index, NONULL(Status));
1704 ! move (indexoffset + (option (OPTSTATUSONTOP) ? 0 : (indexlen - 1)),
1705 ! (option(OPTSTATUSONTOP) ? 0: SidebarWidth));
1706 SETCOLOR (MT_COLOR_STATUS);
1707 ! mutt_paddstr (COLS - (option(OPTSTATUSONTOP) ? 0 : SidebarWidth), buffer);
1711 + /* if we're not using the index, update every time */
1713 + draw_sidebar(MENU_PAGER);
1717 if (option(OPTBRAILLEFRIENDLY)) {
1724 + case OP_SIDEBAR_SCROLL_UP:
1725 + case OP_SIDEBAR_SCROLL_DOWN:
1726 + case OP_SIDEBAR_NEXT:
1727 + case OP_SIDEBAR_PREV:
1728 + scroll_sidebar(ch, MENU_PAGER);
1734 *** mutt-1.5.23-orig/pattern.c 2014-03-12 11:03:45.000000000 -0500
1735 --- mutt-1.5.23/pattern.c 2014-04-11 10:14:01.000000000 -0500
1739 HEADER *h = ctx->hdrs[msgno];
1742 + #ifdef HAVE_FMEMOPEN
1747 if ((msg = mx_open_message (ctx, msgno)) != NULL)
1752 memset (&s, 0, sizeof (s));
1754 s.flags = M_CHARCONV;
1755 + #ifdef HAVE_FMEMOPEN
1756 + if((s.fpout = open_memstream(&temp, &tempsize)) == NULL)
1758 + mutt_perror ("Error opening memstream");
1762 mutt_mktemp (tempfile, sizeof (tempfile));
1763 if ((s.fpout = safe_fopen (tempfile, "w+")) == NULL)
1765 mutt_perror (tempfile);
1770 if (pat->op != M_BODY)
1771 mutt_copy_header (msg->fp, h, s.fpout, CH_FROM | CH_DECODE, NULL);
1777 safe_fclose (&s.fpout);
1778 + #ifdef HAVE_FMEMOPEN
1789 mutt_body_handler (h->content, &s);
1792 + #ifdef HAVE_FMEMOPEN
1797 + if ((fp = fmemopen(temp, tempsize, "r")) == NULL) {
1798 + mutt_perror ("Error re-opening memstream");
1801 + } else { /* fmemopen cannot handle empty buffers */
1802 + if ((fp = safe_fopen ("/dev/null", "r")) == NULL) {
1803 + mutt_perror ("Error opening /dev/null");
1811 fstat (fileno (fp), &st);
1812 lng = (long) st.st_size;
1820 if (option (OPTTHOROUGHSRC))
1823 + #ifdef HAVE_FMEMOPEN
1832 *** mutt-1.5.23-orig/PATCHES 2014-03-12 11:03:44.000000000 -0500
1833 --- mutt-1.5.23/PATCHES 2014-04-12 12:36:35.000000000 -0500
1837 + patch-1.5.23.sidebar.20140412.txt
1838 *** mutt-1.5.23-orig/protos.h 2014-03-12 11:06:17.000000000 -0500
1839 --- mutt-1.5.23/protos.h 2014-04-11 10:14:01.000000000 -0500
1843 const char *pager_progress;
1846 + struct sidebar_entry {
1847 + char box[SHORT_STRING];
1848 + unsigned int size;
1850 + unsigned int flagged;
1853 void mutt_make_string_info (char *, size_t, const char *, struct hdr_format_info *, format_flag);
1855 int mutt_extract_token (BUFFER *, BUFFER *, int);
1856 *** mutt-1.5.23-orig/sidebar.c 1969-12-31 18:00:00.000000000 -0600
1857 --- mutt-1.5.23/sidebar.c 2014-04-11 10:14:01.000000000 -0500
1862 + * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu>
1863 + * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com>
1865 + * This program is free software; you can redistribute it and/or modify
1866 + * it under the terms of the GNU General Public License as published by
1867 + * the Free Software Foundation; either version 2 of the License, or
1868 + * (at your option) any later version.
1870 + * This program is distributed in the hope that it will be useful,
1871 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1872 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1873 + * GNU General Public License for more details.
1875 + * You should have received a copy of the GNU General Public License
1876 + * along with this program; if not, write to the Free Software
1877 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
1882 + # include "config.h"
1886 + #include "mutt_menu.h"
1887 + #include "mutt_curses.h"
1888 + #include "sidebar.h"
1889 + #include "buffy.h"
1890 + #include <libgen.h>
1891 + #include "keymap.h"
1892 + #include <stdbool.h>
1894 + /*BUFFY *CurBuffy = 0;*/
1895 + static BUFFY *TopBuffy = 0;
1896 + static BUFFY *BottomBuffy = 0;
1897 + static int known_lines = 0;
1899 + void calc_boundaries() {
1901 + BUFFY *tmp = Incoming;
1903 + int count = LINES - 2 - (option(OPTHELP) ? 1 : 0);
1905 + if ( known_lines != LINES ) {
1906 + TopBuffy = BottomBuffy = 0;
1907 + known_lines = LINES;
1909 + for ( ; tmp->next != 0; tmp = tmp->next )
1910 + tmp->next->prev = tmp;
1912 + if ( TopBuffy == 0 && BottomBuffy == 0 )
1913 + TopBuffy = Incoming;
1914 + if ( BottomBuffy == 0 ) {
1915 + BottomBuffy = TopBuffy;
1916 + while ( --count && BottomBuffy->next )
1917 + BottomBuffy = BottomBuffy->next;
1919 + else if ( TopBuffy == CurBuffy->next ) {
1920 + BottomBuffy = CurBuffy;
1921 + tmp = BottomBuffy;
1922 + while ( --count && tmp->prev)
1926 + else if ( BottomBuffy == CurBuffy->prev ) {
1927 + TopBuffy = CurBuffy;
1929 + while ( --count && tmp->next )
1931 + BottomBuffy = tmp;
1935 + static const char *
1936 + sidebar_format_str (char *dest,
1941 + const char *prefix,
1942 + const char *ifstring,
1943 + const char *elsestring,
1944 + unsigned long data,
1945 + format_flag flags)
1947 + /* casting from unsigned long - srsly?! */
1948 + struct sidebar_entry *sbe = (struct sidebar_entry *) data;
1949 + unsigned int optional;
1950 + char fmt[SHORT_STRING], buf[SHORT_STRING];
1952 + optional = flags & M_FORMAT_OPTIONAL;
1957 + snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1958 + snprintf (dest, destlen, fmt, sbe->flagged);
1959 + } else if(sbe->flagged == 0) {
1965 + if(sbe->flagged == 0)
1966 + mutt_format_s(dest, destlen, prefix, "");
1967 + if(sbe->flagged == 1)
1968 + mutt_format_s(dest, destlen, prefix, "!");
1969 + if(sbe->flagged == 2)
1970 + mutt_format_s(dest, destlen, prefix, "!!");
1971 + if(sbe->flagged > 2) {
1972 + snprintf (buf, sizeof (buf), "%d!", sbe->flagged);
1973 + mutt_format_s(dest, destlen, prefix, buf);
1978 + snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1979 + snprintf (dest, destlen, fmt, sbe->size);
1984 + snprintf (fmt, sizeof (fmt), "%%%sd", prefix);
1985 + snprintf (dest, destlen, fmt, sbe->new);
1986 + } else if(sbe->new == 0) {
1992 + mutt_format_s(dest, destlen, prefix, sbe->box);
1997 + mutt_FormatString (dest, destlen, col, ifstring, sidebar_format_str, (unsigned long) sbe, flags);
1998 + else if (flags & M_FORMAT_OPTIONAL)
1999 + mutt_FormatString (dest, destlen, col, elsestring, sidebar_format_str, (unsigned long) sbe, flags);
2004 + char *make_sidebar_entry(char *box, unsigned int size, unsigned int new, unsigned int flagged) {
2005 + static char *entry = 0;
2006 + struct sidebar_entry sbe;
2009 + SBvisual = SidebarWidth - strlen(SidebarDelim);
2014 + sbe.flagged = flagged;
2016 + strncpy(sbe.box, box, 31);
2018 + safe_realloc(&entry, SBvisual + 2);
2019 + entry[SBvisual + 1] = '\0';
2021 + mutt_FormatString (entry, SBvisual+1, 0, SidebarFormat, sidebar_format_str, (unsigned long) &sbe, 0);
2026 + void set_curbuffy(char buf[LONG_STRING])
2028 + BUFFY* tmp = CurBuffy = Incoming;
2034 + if(!strcmp(tmp->path, buf) || !strcmp(tmp->realpath, buf)) {
2046 + int draw_sidebar(int menu) {
2049 + #ifndef USE_SLANG_CURSES
2052 + short delim_len = strlen(SidebarDelim);
2055 + static bool initialized = false;
2056 + static int prev_show_value;
2057 + static short saveSidebarWidth;
2059 + int SidebarHeight;
2061 + if(option(OPTSTATUSONTOP) || option(OPTHELP))
2062 + lines++; /* either one will occupy the first line */
2064 + /* initialize first time */
2065 + if(!initialized) {
2066 + prev_show_value = option(OPTSIDEBAR);
2067 + saveSidebarWidth = SidebarWidth;
2068 + if(!option(OPTSIDEBAR)) SidebarWidth = 0;
2069 + initialized = true;
2072 + /* save or restore the value SidebarWidth */
2073 + if(prev_show_value != option(OPTSIDEBAR)) {
2074 + if(prev_show_value && !option(OPTSIDEBAR)) {
2075 + saveSidebarWidth = SidebarWidth;
2077 + } else if(!prev_show_value && option(OPTSIDEBAR)) {
2078 + mutt_buffy_check(1); /* we probably have bad or no numbers */
2079 + SidebarWidth = saveSidebarWidth;
2081 + prev_show_value = option(OPTSIDEBAR);
2085 + /* if ( SidebarWidth == 0 ) return 0; */
2086 + if (SidebarWidth > 0 && option (OPTSIDEBAR)
2087 + && delim_len >= SidebarWidth) {
2088 + unset_option (OPTSIDEBAR);
2089 + /* saveSidebarWidth = SidebarWidth; */
2090 + if (saveSidebarWidth > delim_len) {
2091 + SidebarWidth = saveSidebarWidth;
2092 + mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar."));
2096 + mutt_error (_("Value for sidebar_delim is too long. Disabling sidebar. Please set your sidebar_width to a sane value."));
2097 + sleep (4); /* the advise to set a sane value should be seen long enough */
2099 + saveSidebarWidth = 0;
2103 + if ( SidebarWidth == 0 || !option(OPTSIDEBAR)) {
2104 + if (SidebarWidth > 0) {
2105 + saveSidebarWidth = SidebarWidth;
2108 + unset_option(OPTSIDEBAR);
2112 + /* get attributes for divider */
2113 + SETCOLOR(MT_COLOR_STATUS);
2114 + #ifndef USE_SLANG_CURSES
2115 + attr_get(&attrs, &color_pair, 0);
2117 + color_pair = attr_get();
2119 + SETCOLOR(MT_COLOR_NORMAL);
2121 + /* draw the divider */
2123 + SidebarHeight = LINES - 1;
2124 + if(option(OPTHELP) || !option(OPTSTATUSONTOP))
2127 + for ( ; lines < SidebarHeight; lines++ ) {
2128 + move(lines, SidebarWidth - delim_len);
2129 + addstr(NONULL(SidebarDelim));
2130 + #ifndef USE_SLANG_CURSES
2131 + mvchgat(lines, SidebarWidth - delim_len, delim_len, 0, color_pair, NULL);
2135 + if ( Incoming == 0 ) return 0;
2137 + if(option(OPTSTATUSONTOP) || option(OPTHELP))
2138 + lines++; /* either one will occupy the first line */
2140 + if ( known_lines != LINES || TopBuffy == 0 || BottomBuffy == 0 )
2141 + calc_boundaries(menu);
2142 + if ( CurBuffy == 0 ) CurBuffy = Incoming;
2146 + SETCOLOR(MT_COLOR_NORMAL);
2148 + for ( ; tmp && lines < SidebarHeight; tmp = tmp->next ) {
2149 + if ( tmp == CurBuffy )
2150 + SETCOLOR(MT_COLOR_INDICATOR);
2151 + else if ( tmp->msg_unread > 0 )
2152 + SETCOLOR(MT_COLOR_NEW);
2153 + else if ( tmp->msg_flagged > 0 )
2154 + SETCOLOR(MT_COLOR_FLAGGED);
2156 + SETCOLOR(MT_COLOR_NORMAL);
2159 + if ( Context && (!strcmp(tmp->path, Context->path)||
2160 + !strcmp(tmp->realpath, Context->path)) ) {
2161 + tmp->msg_unread = Context->unread;
2162 + tmp->msgcount = Context->msgcount;
2163 + tmp->msg_flagged = Context->flagged;
2165 + /* check whether Maildir is a prefix of the current folder's path */
2166 + short maildir_is_prefix = 0;
2167 + if ( (strlen(tmp->path) > strlen(Maildir)) &&
2168 + (strncmp(Maildir, tmp->path, strlen(Maildir)) == 0) )
2169 + maildir_is_prefix = 1;
2170 + /* calculate depth of current folder and generate its display name with indented spaces */
2171 + int sidebar_folder_depth = 0;
2172 + char *sidebar_folder_name;
2173 + sidebar_folder_name = option(OPTSIDEBARSHORTPATH) ? mutt_basename(tmp->path) : tmp->path + maildir_is_prefix*(strlen(Maildir) + ((Maildir[strlen(Maildir) - 1] == '/' || Maildir[strlen(Maildir) - 1] == '}') ? 0 : 1));
2174 + if ( maildir_is_prefix && option(OPTSIDEBARFOLDERINDENT) ) {
2175 + char *tmp_folder_name;
2177 + tmp_folder_name = tmp->path + strlen(Maildir) + 1;
2178 + for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) {
2179 + if (tmp_folder_name[i] == '/' || tmp_folder_name[i] == '.') sidebar_folder_depth++;
2181 + if (sidebar_folder_depth > 0) {
2182 + if (option(OPTSIDEBARSHORTPATH)) {
2183 + tmp_folder_name = strrchr(tmp->path, '.');
2184 + if (tmp_folder_name == NULL)
2185 + tmp_folder_name = mutt_basename(tmp->path);
2187 + tmp_folder_name++;
2190 + tmp_folder_name = tmp->path + strlen(Maildir) + 1;
2191 + sidebar_folder_name = malloc(strlen(tmp_folder_name) + sidebar_folder_depth*strlen(NONULL(SidebarIndentStr)) + 1);
2192 + sidebar_folder_name[0]=0;
2193 + for (i=0; i < sidebar_folder_depth; i++)
2194 + strncat(sidebar_folder_name, NONULL(SidebarIndentStr), strlen(NONULL(SidebarIndentStr)));
2195 + strncat(sidebar_folder_name, tmp_folder_name, strlen(tmp_folder_name));
2198 + printw( "%.*s", SidebarWidth - delim_len + 1,
2199 + make_sidebar_entry(sidebar_folder_name, tmp->msgcount,
2200 + tmp->msg_unread, tmp->msg_flagged));
2201 + if (sidebar_folder_depth > 0)
2202 + free(sidebar_folder_name);
2205 + SETCOLOR(MT_COLOR_NORMAL);
2206 + for ( ; lines < SidebarHeight; lines++ ) {
2209 + for ( ; i < SidebarWidth - delim_len; i++ )
2216 + void set_buffystats(CONTEXT* Context)
2218 + BUFFY *tmp = Incoming;
2220 + if(Context && (!strcmp(tmp->path, Context->path) ||
2221 + !strcmp(tmp->realpath, Context->path))) {
2222 + tmp->msg_unread = Context->unread;
2223 + tmp->msgcount = Context->msgcount;
2224 + tmp->msg_flagged = Context->flagged;
2231 + void scroll_sidebar(int op, int menu)
2233 + if(!SidebarWidth) return;
2234 + if(!CurBuffy) return;
2237 + case OP_SIDEBAR_NEXT:
2238 + if ( CurBuffy->next == NULL ) return;
2239 + CurBuffy = CurBuffy->next;
2241 + case OP_SIDEBAR_PREV:
2242 + if ( CurBuffy->prev == NULL ) return;
2243 + CurBuffy = CurBuffy->prev;
2245 + case OP_SIDEBAR_SCROLL_UP:
2246 + CurBuffy = TopBuffy;
2247 + if ( CurBuffy != Incoming ) {
2248 + calc_boundaries(menu);
2249 + CurBuffy = CurBuffy->prev;
2252 + case OP_SIDEBAR_SCROLL_DOWN:
2253 + CurBuffy = BottomBuffy;
2254 + if ( CurBuffy->next ) {
2255 + calc_boundaries(menu);
2256 + CurBuffy = CurBuffy->next;
2262 + calc_boundaries(menu);
2263 + draw_sidebar(menu);
2266 *** mutt-1.5.23-orig/sidebar.h 1969-12-31 18:00:00.000000000 -0600
2267 --- mutt-1.5.23/sidebar.h 2014-04-11 10:14:01.000000000 -0500
2272 + * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu>
2273 + * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com>
2275 + * This program is free software; you can redistribute it and/or modify
2276 + * it under the terms of the GNU General Public License as published by
2277 + * the Free Software Foundation; either version 2 of the License, or
2278 + * (at your option) any later version.
2280 + * This program is distributed in the hope that it will be useful,
2281 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2282 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2283 + * GNU General Public License for more details.
2285 + * You should have received a copy of the GNU General Public License
2286 + * along with this program; if not, write to the Free Software
2287 + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
2293 + struct MBOX_LIST {
2299 + /* parameter is whether or not to go to the status line */
2300 + /* used for omitting the last | that covers up the status bar in the index */
2301 + int draw_sidebar(int);
2302 + void scroll_sidebar(int, int);
2303 + void set_curbuffy(char*);
2304 + void set_buffystats(CONTEXT*);
2306 + #endif /* SIDEBAR_H */
2307 *** mutt-1.5.23-orig/doc/Muttrc 2014-03-12 11:27:11.000000000 -0500
2308 --- mutt-1.5.23/doc/Muttrc 2014-04-11 10:14:01.000000000 -0500
2312 # $crypt_autosign, $crypt_replysign and $smime_is_default.
2315 + # set sidebar_visible=no
2317 + # Name: sidebar_visible
2322 + # This specifies whether or not to show sidebar (left-side list of folders).
2325 + # set sidebar_width=0
2327 + # Name: sidebar_width
2332 + # The width of the sidebar.
2335 # set crypt_autosign=no
2337 # Name: crypt_autosign
2338 *** mutt-1.5.23-orig/imap/imap.c 2014-03-12 11:03:45.000000000 -0500
2339 --- mutt-1.5.23/imap/imap.c 2014-04-11 10:14:01.000000000 -0500
2343 imap_munge_mbox_name (munged, sizeof (munged), name);
2344 snprintf (command, sizeof (command),
2345 ! "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT)", munged);
2347 if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0)
2351 imap_munge_mbox_name (munged, sizeof (munged), name);
2352 snprintf (command, sizeof (command),
2353 ! "STATUS %s (UIDNEXT UIDVALIDITY UNSEEN RECENT MESSAGES)", munged);
2355 if (imap_exec (idata, command, IMAP_CMD_QUEUE) < 0)
2357 *** mutt-1.5.23-orig/imap/command.c 2014-03-12 11:03:45.000000000 -0500
2358 --- mutt-1.5.23/imap/command.c 2014-04-11 10:14:01.000000000 -0500
2363 status->uidnext = oldun;
2365 + /* Added to make the sidebar show the correct numbers */
2366 + if (status->messages)
2368 + inc->msgcount = status->messages;
2369 + inc->msg_unread = status->unseen;