From owner-svn-ports-all@FreeBSD.ORG Sun Oct 27 21:34:58 2013 Return-Path: Delivered-To: svn-ports-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 97079F8C; Sun, 27 Oct 2013 21:34:58 +0000 (UTC) (envelope-from ak@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 83CD12E45; Sun, 27 Oct 2013 21:34:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9RLYwNw042172; Sun, 27 Oct 2013 21:34:58 GMT (envelope-from ak@svn.freebsd.org) Received: (from ak@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9RLYw2f042170; Sun, 27 Oct 2013 21:34:58 GMT (envelope-from ak@svn.freebsd.org) Message-Id: <201310272134.r9RLYw2f042170@svn.freebsd.org> From: Alex Kozlov Date: Sun, 27 Oct 2013 21:34:58 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r331805 - head/mail/mutt/files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 27 Oct 2013 21:34:58 -0000 Author: ak Date: Sun Oct 27 21:34:58 2013 New Revision: 331805 URL: http://svnweb.freebsd.org/changeset/ports/331805 Log: - Fix sidebar patch for mutt 1.5.22 [1] Reported by: kaltheat [2], Glen Barber [3], ganthore [4], Michael E Beasley [5] PR: ports/183229 [2] PR: ports/183251 [3] PR: ports/183301 [4] PR: ports/183351 [5] Submitted by: "Schweigert, Udo" [1] Obtained from: OpenBSD, Gentoo (based on) Modified: head/mail/mutt/files/extra-patch-sidebar (contents, props changed) head/mail/mutt/files/extra-patch-sidebar-nntp (contents, props changed) Modified: head/mail/mutt/files/extra-patch-sidebar ============================================================================== --- head/mail/mutt/files/extra-patch-sidebar Sun Oct 27 20:39:56 2013 (r331804) +++ head/mail/mutt/files/extra-patch-sidebar Sun Oct 27 21:34:58 2013 (r331805) @@ -1,6 +1,29 @@ ---- orig/buffy.c.orig 2010-09-18 14:12:40.000000000 +0200 -+++ new/buffy.c 2010-09-18 14:17:36.000000000 +0200 -@@ -161,6 +161,49 @@ +Based on Gentoo's updated version of the Mutt Sidebar patch, +rebased to apply to pristine Mutt sources. + +http://prefix.gentooexperimental.org:8000/mutt-patches/file/8117acc3edc0/sidebar.patch + +diff -uNp -r mutt-1.5.22.orig/OPS mutt-1.5.22/OPS +--- mutt-1.5.22.orig/OPS Tue Feb 23 06:57:28 2010 ++++ mutt-1.5.22/OPS Fri Oct 18 10:18:45 2013 +@@ -179,3 +179,8 @@ OP_WHAT_KEY "display the keycode for a key press" + OP_MAIN_SHOW_LIMIT "show currently active limit pattern" + OP_MAIN_COLLAPSE_THREAD "collapse/uncollapse current thread" + OP_MAIN_COLLAPSE_ALL "collapse/uncollapse all threads" ++OP_SIDEBAR_SCROLL_UP "scroll the mailbox pane up 1 page" ++OP_SIDEBAR_SCROLL_DOWN "scroll the mailbox pane down 1 page" ++OP_SIDEBAR_NEXT "go down to next mailbox" ++OP_SIDEBAR_PREV "go to previous mailbox" ++OP_SIDEBAR_OPEN "open hilighted mailbox" +diff -uNp -r mutt-1.5.22.orig/PATCHES mutt-1.5.22/PATCHES +--- mutt-1.5.22.orig/PATCHES Sun Feb 21 05:51:26 2010 ++++ mutt-1.5.22/PATCHES Fri Oct 18 10:19:14 2013 +@@ -0,0 +1 @@ ++patch-1.5.22.sidebar.gentoo-openbsd +diff -uNp -r mutt-1.5.22.orig/buffy.c mutt-1.5.22/buffy.c +--- mutt-1.5.22.orig/buffy.c Mon Apr 22 07:14:53 2013 ++++ mutt-1.5.22/buffy.c Fri Oct 18 10:18:45 2013 +@@ -161,6 +161,49 @@ void mutt_buffy_cleanup (const char *buf, struct stat } } @@ -50,7 +73,7 @@ BUFFY *mutt_find_mailbox (const char *path) { BUFFY *tmp = NULL; -@@ -282,6 +325,7 @@ +@@ -282,6 +325,7 @@ int mutt_parse_mailboxes (BUFFER *path, BUFFER *s, uns else (*tmp)->size = 0; } @@ -58,884 +81,817 @@ return 0; } -@@ -371,12 +415,17 @@ +@@ -340,6 +384,68 @@ static int buffy_maildir_hasnew (BUFFY* mailbox) return rc; } -+#define STAT_CHECK_SIZE (sb.st_size > tmp->size) -+#define STAT_CHECK_TIME (sb.st_mtime > sb.st_atime || (tmp->newly_created && sb.st_ctime == sb.st_mtime && sb.st_ctime == sb.st_atime)) -+#define STAT_CHECK (option(OPTCHECKMBOXSIZE) ? STAT_CHECK_SIZE : STAT_CHECK_TIME) ++/* update message counts for the sidebar */ ++void buffy_maildir_update (BUFFY* mailbox) ++{ ++ char path[_POSIX_PATH_MAX]; ++ DIR *dirp; ++ struct dirent *de; ++ char *p; ++ ++ mailbox->msgcount = 0; ++ mailbox->msg_unread = 0; ++ mailbox->msg_flagged = 0; ++ ++ snprintf (path, sizeof (path), "%s/new", mailbox->path); ++ ++ if ((dirp = opendir (path)) == NULL) ++ { ++ mailbox->magic = 0; ++ return; ++ } ++ ++ while ((de = readdir (dirp)) != NULL) ++ { ++ if (*de->d_name == '.') ++ continue; ++ ++ if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) { ++ mailbox->new = 1; ++ mailbox->msgcount++; ++ mailbox->msg_unread++; ++ } ++ } ++ ++ closedir (dirp); ++ snprintf (path, sizeof (path), "%s/cur", mailbox->path); ++ ++ if ((dirp = opendir (path)) == NULL) ++ { ++ mailbox->magic = 0; ++ return; ++ } ++ ++ while ((de = readdir (dirp)) != NULL) ++ { ++ if (*de->d_name == '.') ++ continue; ++ ++ if (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')) { ++ mailbox->msgcount++; ++ if ((p = strstr (de->d_name, ":2,"))) { ++ if (!strchr (p + 3, 'T')) { ++ if (!strchr (p + 3, 'S')) ++ mailbox->msg_unread++; ++ if (strchr(p + 3, 'F')) ++ mailbox->msg_flagged++; ++ } ++ } ++ } ++ } ++ ++ closedir (dirp); ++} ++ + /* returns 1 if mailbox has new mail */ + static int buffy_mbox_hasnew (BUFFY* mailbox, struct stat *sb) + { +@@ -371,6 +477,20 @@ static int buffy_mbox_hasnew (BUFFY* mailbox, struct s + return rc; + } + ++/* update message counts for the sidebar */ ++void buffy_mbox_update (BUFFY* mailbox) ++{ ++ CONTEXT *ctx = NULL; ++ ++ ctx = mx_open_mailbox(mailbox->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL); ++ if(ctx) ++ { ++ mailbox->msgcount = ctx->msgcount; ++ mailbox->msg_unread = ctx->unread; ++ mx_close_mailbox(ctx, 0); ++ } ++} + int mutt_buffy_check (int force) { BUFFY *tmp; - struct stat sb; - struct stat contex_sb; - time_t t; -+ CONTEXT *ctx; - - sb.st_size=0; - contex_sb.st_dev=0; -@@ -416,6 +465,8 @@ - - for (tmp = Incoming; tmp; tmp = tmp->next) - { -+ if ( tmp->new == 1 ) -+ tmp->has_new = 1; - if (tmp->magic != M_IMAP) - { - tmp->new = 0; -@@ -455,18 +506,122 @@ +@@ -444,16 +564,19 @@ int mutt_buffy_check (int force) { case M_MBOX: case M_MMDF: -- if (buffy_mbox_hasnew (tmp, &sb) > 0) -- BuffyCount++; -- break; -+ { -+ if (STAT_CHECK || tmp->msgcount == 0) -+ { -+ BUFFY b = *tmp; -+ int msgcount = 0; -+ int msg_unread = 0; -+ /* parse the mailbox, to see how much mail there is */ -+ ctx = mx_open_mailbox( tmp->path, M_READONLY | M_QUIET | M_NOSORT | M_PEEK, NULL); -+ if(ctx) -+ { -+ msgcount = ctx->msgcount; -+ msg_unread = ctx->unread; -+ mx_close_mailbox(ctx, 0); -+ } -+ *tmp = b; -+ tmp->msgcount = msgcount; -+ tmp->msg_unread = msg_unread; -+ if(STAT_CHECK) { -+ tmp->has_new = tmp->new = 1; -+ BuffyCount++; -+ } -+ } -+ else if (option(OPTCHECKMBOXSIZE)) -+ { -+ /* some other program has deleted mail from the folder */ -+ tmp->size = (off_t) sb.st_size; -+ } -+ if (tmp->newly_created && -+ (sb.st_ctime != sb.st_mtime || sb.st_ctime != sb.st_atime)) -+ tmp->newly_created = 0; -+ } -+ break; -+ ++ buffy_mbox_update (tmp); + if (buffy_mbox_hasnew (tmp, &sb) > 0) + BuffyCount++; + break; case M_MAILDIR: -- if (buffy_maildir_hasnew (tmp) > 0) -- BuffyCount++; -+ { -+ char path[_POSIX_PATH_MAX]; -+ DIR *dirp; -+ struct dirent *de; -+ /* count new message */ -+ snprintf (path, sizeof (path), "%s/new", tmp->path); -+ if ((dirp = opendir (path)) == NULL) -+ { -+ tmp->magic = 0; -+ break; -+ } -+ tmp->msgcount = 0; -+ tmp->msg_unread = 0; -+ tmp->msg_flagged = 0; -+ while ((de = readdir (dirp)) != NULL) -+ { -+ char *p; -+ if (*de->d_name != '.' && -+ (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T'))) -+ { -+ tmp->has_new = tmp->new = 1; -+ tmp->msgcount++; -+ tmp->msg_unread++; -+ } -+ } -+ if(tmp->msg_unread) -+ BuffyCount++; -+ -+ closedir (dirp); -+ -+ /* -+ * count read messages (for folderlist (sidebar) we also need to count -+ * messages in cur so that we the total number of messages -+ */ -+ snprintf (path, sizeof (path), "%s/cur", tmp->path); -+ if ((dirp = opendir (path)) == NULL) -+ { -+ tmp->magic = 0; -+ break; -+ } -+ while ((de = readdir (dirp)) != NULL) -+ { -+ char *p; -+ if (*de->d_name != '.') { -+ if ((p = strstr (de->d_name, ":2,"))) { -+ if (!strchr (p + 3, 'T')) { -+ tmp->msgcount++; -+ if ( !strchr (p + 3, 'S')) -+ tmp->msg_unread++; -+ if (strchr(p + 3, 'F')) -+ tmp->msg_flagged++; -+ } -+ } else -+ tmp->msgcount++; -+ } -+ } -+ closedir (dirp); -+ } ++ buffy_maildir_update (tmp); + if (buffy_maildir_hasnew (tmp) > 0) + BuffyCount++; break; case M_MH: -- if ((tmp->new = mh_buffy (tmp->path)) > 0) -- BuffyCount++; -+ { -+ DIR *dp; -+ char path[_POSIX_PATH_MAX]; -+ struct dirent *de; -+ if ((tmp->new = mh_buffy (tmp->path)) > 0) -+ BuffyCount++; -+ -+ if ((dp = opendir (path)) == NULL) -+ break; -+ tmp->msgcount = 0; -+ while ((de = readdir (dp))) -+ { -+ if (mh_valid_message (de->d_name)) -+ { -+ tmp->msgcount++; -+ tmp->has_new = tmp->new = 1; -+ } -+ } -+ closedir (dp); -+ } - break; - } ++ mh_buffy_update (tmp->path, &tmp->msgcount, &tmp->msg_unread, &tmp->msg_flagged); + mh_buffy(tmp); + if (tmp->new) + BuffyCount++; +diff -uNp -r mutt-1.5.22.orig/buffy.h mutt-1.5.22/buffy.h +--- mutt-1.5.22.orig/buffy.h Mon Apr 22 07:14:53 2013 ++++ mutt-1.5.22/buffy.h Fri Oct 18 10:18:45 2013 +@@ -25,7 +25,11 @@ typedef struct buffy_t + char path[_POSIX_PATH_MAX]; + off_t size; + struct buffy_t *next; ++ struct buffy_t *prev; + short new; /* mailbox has new mail */ ++ int msgcount; /* total number of messages */ ++ int msg_unread; /* number of unread messages */ ++ int msg_flagged; /* number of flagged messages */ + short notified; /* user has been notified */ + short magic; /* mailbox type */ + short newly_created; /* mbox or mmdf just popped into existence */ +diff -uNp -r mutt-1.5.22.orig/color.c mutt-1.5.22/color.c +--- mutt-1.5.22.orig/color.c Tue Jan 15 07:37:15 2013 ++++ mutt-1.5.22/color.c Fri Oct 18 10:19:53 2013 +@@ -93,6 +93,8 @@ static const struct mapping_t Fields[] = + { "bold", MT_COLOR_BOLD }, + { "underline", MT_COLOR_UNDERLINE }, + { "index", MT_COLOR_INDEX }, ++ { "sidebar_new", MT_COLOR_NEW }, ++ { "sidebar_flagged", MT_COLOR_FLAGGED }, + { NULL, 0 } + }; + +diff -uNp -r mutt-1.5.22.orig/compose.c mutt-1.5.22/compose.c +--- mutt-1.5.22.orig/compose.c Fri Oct 18 05:48:24 2013 ++++ mutt-1.5.22/compose.c Fri Oct 18 10:22:12 2013 +@@ -72,7 +72,7 @@ enum + + #define HDR_XOFFSET 10 + #define TITLE_FMT "%10s" /* Used for Prompts, which are ASCII */ +-#define W (COLS - HDR_XOFFSET) ++#define W (COLS - HDR_XOFFSET - SidebarWidth) + + static const char * const Prompts[] = + { +@@ -110,7 +110,7 @@ static void snd_entry (char *b, size_t blen, MUTTMENU + + static void redraw_crypt_lines (HEADER *msg) + { +- mvaddstr (HDR_CRYPT, 0, "Security: "); ++ mvaddstr (HDR_CRYPT, SidebarWidth, "Security: "); + + if ((WithCrypto & (APPLICATION_PGP | APPLICATION_SMIME)) == 0) + { +@@ -142,7 +142,7 @@ static void redraw_crypt_lines (HEADER *msg) + } + + clrtoeol (); +- move (HDR_CRYPTINFO, 0); ++ move (HDR_CRYPTINFO, SidebarWidth); + clrtoeol (); + + if ((WithCrypto & APPLICATION_PGP) +@@ -159,7 +159,7 @@ static void redraw_crypt_lines (HEADER *msg) + && (msg->security & ENCRYPT) + && SmimeCryptAlg + && *SmimeCryptAlg) { +- mvprintw (HDR_CRYPTINFO, 40, "%s%s", _("Encrypt with: "), ++ mvprintw (HDR_CRYPTINFO, SidebarWidth + 40, "%s%s", _("Encrypt with: "), + NONULL(SmimeCryptAlg)); + } + } +@@ -172,7 +172,7 @@ static void redraw_mix_line (LIST *chain) + int c; + char *t; + +- mvaddstr (HDR_MIX, 0, " Mix: "); ++ mvaddstr (HDR_MIX, SidebarWidth, " Mix: "); + + if (!chain) + { +@@ -187,7 +187,7 @@ static void redraw_mix_line (LIST *chain) + if (t && t[0] == '0' && t[1] == '\0') + t = ""; + +- if (c + mutt_strlen (t) + 2 >= COLS) ++ if (c + mutt_strlen (t) + 2 >= COLS - SidebarWidth) + break; + + addstr (NONULL(t)); +@@ -239,7 +239,7 @@ static void draw_envelope_addr (int line, ADDRESS *add + + buf[0] = 0; + rfc822_write_address (buf, sizeof (buf), addr, 1); +- mvprintw (line, 0, TITLE_FMT, Prompts[line - 1]); ++ mvprintw (line, SidebarWidth, TITLE_FMT, Prompts[line - 1]); + mutt_paddstr (W, buf); + } + +@@ -249,10 +249,10 @@ static void draw_envelope (HEADER *msg, char *fcc) + draw_envelope_addr (HDR_TO, msg->env->to); + draw_envelope_addr (HDR_CC, msg->env->cc); + draw_envelope_addr (HDR_BCC, msg->env->bcc); +- mvprintw (HDR_SUBJECT, 0, TITLE_FMT, Prompts[HDR_SUBJECT - 1]); ++ mvprintw (HDR_SUBJECT, SidebarWidth, TITLE_FMT, Prompts[HDR_SUBJECT - 1]); + mutt_paddstr (W, NONULL (msg->env->subject)); + draw_envelope_addr (HDR_REPLYTO, msg->env->reply_to); +- mvprintw (HDR_FCC, 0, TITLE_FMT, Prompts[HDR_FCC - 1]); ++ mvprintw (HDR_FCC, SidebarWidth, TITLE_FMT, Prompts[HDR_FCC - 1]); + mutt_paddstr (W, fcc); + + if (WithCrypto) +@@ -263,7 +263,7 @@ static void draw_envelope (HEADER *msg, char *fcc) + #endif + + SETCOLOR (MT_COLOR_STATUS); +- mvaddstr (HDR_ATTACH - 1, 0, _("-- Attachments")); ++ mvaddstr (HDR_ATTACH - 1, SidebarWidth, _("-- Attachments")); + clrtoeol (); + + NORMAL_COLOR; +@@ -299,7 +299,7 @@ static int edit_address_list (int line, ADDRESS **addr + /* redraw the expanded list so the user can see the result */ + buf[0] = 0; + rfc822_write_address (buf, sizeof (buf), *addr, 1); +- move (line, HDR_XOFFSET); ++ move (line, HDR_XOFFSET+SidebarWidth); + mutt_paddstr (W, buf); + + return 0; +@@ -544,7 +544,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for + if (mutt_get_field ("Subject: ", buf, sizeof (buf), 0) == 0) + { + mutt_str_replace (&msg->env->subject, buf); +- move (HDR_SUBJECT, HDR_XOFFSET); ++ move (HDR_SUBJECT, HDR_XOFFSET + SidebarWidth); + if (msg->env->subject) + mutt_paddstr (W, msg->env->subject); + else +@@ -562,7 +562,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for + { + strfcpy (fcc, buf, fcclen); + mutt_pretty_mailbox (fcc, fcclen); +- move (HDR_FCC, HDR_XOFFSET); ++ move (HDR_FCC, HDR_XOFFSET + SidebarWidth); + mutt_paddstr (W, fcc); + fccSet = 1; + } +diff -uNp -r mutt-1.5.22.orig/curs_main.c mutt-1.5.22/curs_main.c +--- mutt-1.5.22.orig/curs_main.c Tue Jan 15 07:37:15 2013 ++++ mutt-1.5.22/curs_main.c Fri Oct 18 10:18:45 2013 +@@ -26,7 +26,9 @@ + #include "mailbox.h" + #include "mapping.h" + #include "sort.h" ++#include "buffy.h" + #include "mx.h" ++#include "sidebar.h" + + #ifdef USE_POP + #include "pop.h" +@@ -519,8 +521,12 @@ int mutt_index_menu (void) + menu->redraw |= REDRAW_STATUS; + if (do_buffy_notify) + { +- if (mutt_buffy_notify () && option (OPTBEEPNEW)) +- beep (); ++ if (mutt_buffy_notify ()) ++ { ++ menu->redraw |= REDRAW_FULL; ++ if (option (OPTBEEPNEW)) ++ beep (); ++ } + } + else + do_buffy_notify = 1; +@@ -532,6 +538,7 @@ int mutt_index_menu (void) + if (menu->redraw & REDRAW_FULL) + { + menu_redraw_full (menu); ++ draw_sidebar(menu->menu); + mutt_show_error (); } -*** mutt-1.5.20-orig/buffy.h 2009-04-30 00:36:16.000000000 -0500 ---- mutt-1.5.20-patched/buffy.h 2009-06-19 22:07:04.000000000 -0500 -*************** -*** 25,31 **** ---- 25,36 ---- - char path[_POSIX_PATH_MAX]; - off_t size; - struct buffy_t *next; -+ struct buffy_t *prev; - short new; /* mailbox has new mail */ -+ short has_new; /* set it new if new and not read */ -+ int msgcount; /* total number of messages */ -+ int msg_unread; /* number of unread messages */ -+ int msg_flagged; /* number of flagged messages */ - short notified; /* user has been notified */ - short magic; /* mailbox type */ - short newly_created; /* mbox or mmdf just popped into existence */ -*** mutt-1.5.20-orig/color.c 2009-05-18 19:11:35.000000000 -0500 ---- mutt-1.5.20-patched/color.c 2009-06-19 22:07:04.000000000 -0500 -*************** -*** 93,98 **** ---- 93,100 ---- - { "bold", MT_COLOR_BOLD }, - { "underline", MT_COLOR_UNDERLINE }, - { "index", MT_COLOR_INDEX }, -+ { "sidebar_new", MT_COLOR_NEW }, -+ { "sidebar_flagged", MT_COLOR_FLAGGED }, - { NULL, 0 } - }; - -*** mutt-1.5.20-orig/curs_main.c 2009-06-13 21:48:36.000000000 -0500 ---- mutt-1.5.20-patched/curs_main.c 2009-06-19 22:07:04.000000000 -0500 -*************** -*** 26,32 **** ---- 26,34 ---- - #include "mailbox.h" - #include "mapping.h" - #include "sort.h" -+ #include "buffy.h" - #include "mx.h" -+ #include "sidebar.h" - - #ifdef USE_POP - #include "pop.h" -*************** -*** 523,530 **** - menu->redraw |= REDRAW_STATUS; - if (do_buffy_notify) - { -! if (mutt_buffy_notify () && option (OPTBEEPNEW)) -! beep (); - } - else - do_buffy_notify = 1; ---- 525,536 ---- - menu->redraw |= REDRAW_STATUS; - if (do_buffy_notify) + +@@ -554,9 +561,12 @@ int mutt_index_menu (void) + + if (menu->redraw & REDRAW_STATUS) { -! if (mutt_buffy_notify ()) -! { -! menu->redraw |= REDRAW_FULL; -! if (option (OPTBEEPNEW)) -! beep (); -! } - } ++ DrawFullLine = 1; + menu_status_line (buf, sizeof (buf), menu, NONULL (Status)); ++ DrawFullLine = 0; + move (option (OPTSTATUSONTOP) ? 0 : LINES-2, 0); + SETCOLOR (MT_COLOR_STATUS); ++ set_buffystats(Context); + mutt_paddstr (COLS, buf); + NORMAL_COLOR; + menu->redraw &= ~REDRAW_STATUS; +@@ -569,7 +579,7 @@ int mutt_index_menu (void) + menu->oldcurrent = -1; + + if (option (OPTARROWCURSOR)) +- move (menu->current - menu->top + menu->offset, 2); ++ move (menu->current - menu->top + menu->offset, SidebarWidth + 2); + else if (option (OPTBRAILLEFRIENDLY)) + move (menu->current - menu->top + menu->offset, 0); else - do_buffy_notify = 1; -*************** -*** 536,541 **** ---- 542,548 ---- - if (menu->redraw & REDRAW_FULL) - { - menu_redraw_full (menu); -+ draw_sidebar(menu->menu); - mutt_show_error (); - } - -*************** -*** 558,567 **** ---- 565,577 ---- - - if (menu->redraw & REDRAW_STATUS) - { -+ DrawFullLine = 1; - menu_status_line (buf, sizeof (buf), menu, NONULL (Status)); -+ DrawFullLine = 0; - CLEARLINE (option (OPTSTATUSONTOP) ? 0 : LINES-2); - SETCOLOR (MT_COLOR_STATUS); - BKGDSET (MT_COLOR_STATUS); -+ set_buffystats(Context); - mutt_paddstr (COLS, buf); - SETCOLOR (MT_COLOR_NORMAL); - BKGDSET (MT_COLOR_NORMAL); -*************** -*** 575,581 **** - menu->oldcurrent = -1; - - if (option (OPTARROWCURSOR)) -! move (menu->current - menu->top + menu->offset, 2); - else if (option (OPTBRAILLEFRIENDLY)) - move (menu->current - menu->top + menu->offset, 0); - else ---- 585,591 ---- - menu->oldcurrent = -1; - - if (option (OPTARROWCURSOR)) -! move (menu->current - menu->top + menu->offset, SidebarWidth + 2); - else if (option (OPTBRAILLEFRIENDLY)) - move (menu->current - menu->top + menu->offset, 0); - else -*************** -*** 1055,1060 **** ---- 1065,1071 ---- - menu->redraw = REDRAW_FULL; - break; - -+ case OP_SIDEBAR_OPEN: - case OP_MAIN_CHANGE_FOLDER: - case OP_MAIN_NEXT_UNREAD_MAILBOX: - -*************** -*** 1086,1092 **** - { - mutt_buffy (buf, sizeof (buf)); - -! if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1) - { - if (menu->menu == MENU_PAGER) - { ---- 1097,1107 ---- - { - mutt_buffy (buf, sizeof (buf)); - -! if ( op == OP_SIDEBAR_OPEN ) { -! if(!CurBuffy) -! break; -! strncpy( buf, CurBuffy->path, sizeof(buf) ); -! } else if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1) - { - if (menu->menu == MENU_PAGER) - { -*************** -*** 1104,1109 **** ---- 1119,1125 ---- - } - - mutt_expand_path (buf, sizeof (buf)); -+ set_curbuffy(buf); - if (mx_get_magic (buf) <= 0) - { - mutt_error (_("%s is not a mailbox."), buf); -*************** -*** 2183,2188 **** ---- 2199,2210 ---- - mutt_what_key(); - break; - -+ case OP_SIDEBAR_SCROLL_UP: -+ case OP_SIDEBAR_SCROLL_DOWN: -+ case OP_SIDEBAR_NEXT: -+ case OP_SIDEBAR_PREV: -+ scroll_sidebar(op, menu->menu); -+ break; - default: - if (menu->menu == MENU_MAIN) - km_error_key (MENU_MAIN); -*** mutt-1.5.20-orig/flags.c 2008-12-16 21:50:09.000000000 -0600 ---- mutt-1.5.20-patched/flags.c 2009-06-19 22:07:04.000000000 -0500 -*************** -*** 22,29 **** ---- 22,31 ---- - - #include "mutt.h" - #include "mutt_curses.h" -+ #include "mutt_menu.h" - #include "sort.h" - #include "mx.h" -+ #include "sidebar.h" - - void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx) - { -*************** -*** 263,268 **** ---- 265,271 ---- - */ - if (h->searched && (changed != h->changed || deleted != ctx->deleted || tagged != ctx->tagged || flagged != ctx->flagged)) - h->searched = 0; -+ draw_sidebar(0); - } - - void mutt_tag_set_flag (int flag, int bf) -*** mutt-1.5.20-orig/functions.h 2009-04-30 00:36:17.000000000 -0500 ---- mutt-1.5.20-patched/functions.h 2009-06-19 22:07:04.000000000 -0500 -*************** -*** 168,173 **** ---- 168,178 ---- - { "decrypt-save", OP_DECRYPT_SAVE, NULL }, - - -+ { "sidebar-scroll-up", OP_SIDEBAR_SCROLL_UP, NULL }, -+ { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL }, -+ { "sidebar-next", OP_SIDEBAR_NEXT, NULL }, -+ { "sidebar-prev", OP_SIDEBAR_PREV, NULL }, -+ { "sidebar-open", OP_SIDEBAR_OPEN, NULL }, - { NULL, 0, NULL } - }; - -*************** -*** 268,273 **** ---- 273,283 ---- - - { "what-key", OP_WHAT_KEY, NULL }, - -+ { "sidebar-scroll-up", OP_SIDEBAR_SCROLL_UP, NULL }, -+ { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL }, -+ { "sidebar-next", OP_SIDEBAR_NEXT, NULL }, -+ { "sidebar-prev", OP_SIDEBAR_PREV, NULL }, -+ { "sidebar-open", OP_SIDEBAR_OPEN, NULL }, - { NULL, 0, NULL } - }; - -*** mutt-1.5.20-orig/globals.h 2009-06-03 15:48:31.000000000 -0500 ---- mutt-1.5.20-patched/globals.h 2009-06-19 22:07:04.000000000 -0500 -*************** -*** 117,122 **** ---- 117,123 ---- - WHERE char *SendCharset; - WHERE char *Sendmail; - WHERE char *Shell; -+ WHERE char *SidebarDelim; - WHERE char *Signature; - WHERE char *SimpleSearch; - #if USE_SMTP -*************** -*** 206,211 **** ---- 207,215 ---- - WHERE short ScoreThresholdRead; - WHERE short ScoreThresholdFlag; - -+ WHERE struct buffy_t *CurBuffy INITVAL(0); -+ WHERE short DrawFullLine INITVAL(0); -+ WHERE short SidebarWidth; - #ifdef USE_IMAP - WHERE short ImapKeepalive; - WHERE short ImapPipelineDepth; -*** mutt-1.5.20-orig/init.h 2009-06-13 16:35:21.000000000 -0500 ---- mutt-1.5.20-patched/init.h 2009-06-19 22:07:04.000000000 -0500 -*************** -*** 1941,1946 **** ---- 1941,1967 ---- - ** not used. - ** (PGP only) +@@ -1070,6 +1080,7 @@ int mutt_index_menu (void) + menu->redraw = REDRAW_FULL; + break; + ++ case OP_SIDEBAR_OPEN: + case OP_MAIN_CHANGE_FOLDER: + case OP_MAIN_NEXT_UNREAD_MAILBOX: + +@@ -1101,7 +1112,11 @@ int mutt_index_menu (void) + { + mutt_buffy (buf, sizeof (buf)); + +- if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1) ++ if ( op == OP_SIDEBAR_OPEN ) { ++ if(!CurBuffy) ++ break; ++ strncpy( buf, CurBuffy->path, sizeof(buf) ); ++ } else if (mutt_enter_fname (cp, buf, sizeof (buf), &menu->redraw, 1) == -1) + { + if (menu->menu == MENU_PAGER) + { +@@ -1119,6 +1134,7 @@ int mutt_index_menu (void) + } + + mutt_expand_path (buf, sizeof (buf)); ++ set_curbuffy(buf); + if (mx_get_magic (buf) <= 0) + { + mutt_error (_("%s is not a mailbox."), buf); +@@ -2209,6 +2225,12 @@ int mutt_index_menu (void) + mutt_what_key(); + break; + ++ case OP_SIDEBAR_SCROLL_UP: ++ case OP_SIDEBAR_SCROLL_DOWN: ++ case OP_SIDEBAR_NEXT: ++ case OP_SIDEBAR_PREV: ++ scroll_sidebar(op, menu->menu); ++ break; + default: + if (menu->menu == MENU_MAIN) + km_error_key (MENU_MAIN); +diff -uNp -r mutt-1.5.22.orig/flags.c mutt-1.5.22/flags.c +--- mutt-1.5.22.orig/flags.c Sun Feb 21 22:10:41 2010 ++++ mutt-1.5.22/flags.c Fri Oct 18 10:18:45 2013 +@@ -22,8 +22,10 @@ + + #include "mutt.h" + #include "mutt_curses.h" ++#include "mutt_menu.h" + #include "sort.h" + #include "mx.h" ++#include "sidebar.h" + + void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx) + { +@@ -263,6 +265,7 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag */ -+ {"sidebar_delim", DT_STR, R_BOTH, UL &SidebarDelim, "|"}, -+ /* -+ ** .pp -+ ** This specifies the delimiter between the sidebar (if visible) and -+ ** other screens. -+ */ -+ { "sidebar_visible", DT_BOOL, R_BOTH, OPTSIDEBAR, 0 }, -+ /* -+ ** .pp -+ ** This specifies whether or not to show sidebar (left-side list of folders). -+ */ -+ { "sidebar_sort", DT_BOOL, R_BOTH, OPTSIDEBARSORT, 0 }, -+ /* -+ ** .pp -+ ** This specifies whether or not to sort the sidebar alphabetically. -+ */ -+ { "sidebar_width", DT_NUM, R_BOTH, UL &SidebarWidth, 0 }, -+ /* -+ ** .pp -+ ** The width of the sidebar. -+ */ - { "pgp_use_gpg_agent", DT_BOOL, R_NONE, OPTUSEGPGAGENT, 0}, - /* - ** .pp -*** mutt-1.5.20-orig/mailbox.h 2009-04-30 00:36:17.000000000 -0500 ---- mutt-1.5.20-patched/mailbox.h 2009-06-19 22:07:04.000000000 -0500 -*************** -*** 27,32 **** ---- 27,33 ---- - #define M_NEWFOLDER (1<<4) /* create a new folder - same as M_APPEND, but uses - * safe_fopen() for mbox-style folders. - */ -+ #define M_PEEK (1<<5) /* revert atime back after taking a look (if applicable) */ - - /* mx_open_new_message() */ - #define M_ADD_FROM 1 /* add a From_ line */ ---- orig/Makefile.am.orig 2010-09-18 13:23:19.000000000 +0200 -+++ new/Makefile.am 2010-09-18 13:25:19.000000000 +0200 -@@ -34,7 +34,7 @@ - score.c send.c sendlib.c signal.c sort.c \ - status.c system.c thread.c charset.c history.c lib.c \ - muttlib.c editmsg.c mbyte.c \ -- url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c -+ url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c sidebar.c + if (h->searched && (changed != h->changed || deleted != ctx->deleted || tagged != ctx->tagged || flagged != ctx->flagged)) + h->searched = 0; ++ draw_sidebar(0); + } - nodist_mutt_SOURCES = $(BUILT_SOURCES) + void mutt_tag_set_flag (int flag, int bf) +diff -uNp -r mutt-1.5.22.orig/functions.h mutt-1.5.22/functions.h +--- mutt-1.5.22.orig/functions.h Sat Dec 3 19:10:04 2011 ++++ mutt-1.5.22/functions.h Fri Oct 18 10:18:45 2013 +@@ -169,6 +169,11 @@ const struct binding_t OpMain[] = { /* map: index */ + { "decrypt-save", OP_DECRYPT_SAVE, NULL }, + + ++ { "sidebar-scroll-up", OP_SIDEBAR_SCROLL_UP, NULL }, ++ { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL }, ++ { "sidebar-next", OP_SIDEBAR_NEXT, NULL }, ++ { "sidebar-prev", OP_SIDEBAR_PREV, NULL }, ++ { "sidebar-open", OP_SIDEBAR_OPEN, NULL }, + { NULL, 0, NULL } + }; ---- orig/Makefile.in.orig 2010-09-18 13:23:19.000000000 +0200 -+++ new/Makefile.in 2010-09-18 13:27:19.000000000 +0200 -@@ -89,7 +89,7 @@ - system.$(OBJEXT) thread.$(OBJEXT) charset.$(OBJEXT) \ - history.$(OBJEXT) lib.$(OBJEXT) muttlib.$(OBJEXT) \ - editmsg.$(OBJEXT) mbyte.$(OBJEXT) url.$(OBJEXT) \ -- ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT) -+ ascii.$(OBJEXT) crypt-mod.$(OBJEXT) safe_asprintf.$(OBJEXT) sidebar.$(OBJEXT) - am__objects_1 = - am__objects_2 = patchlist.$(OBJEXT) $(am__objects_1) - nodist_mutt_OBJECTS = $(am__objects_2) -@@ -363,7 +363,7 @@ - score.c send.c sendlib.c signal.c sort.c \ - status.c system.c thread.c charset.c history.c lib.c \ - muttlib.c editmsg.c mbyte.c \ -- url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c -+ url.c ascii.c crypt-mod.c crypt-mod.h safe_asprintf.c sidebar.c +@@ -272,6 +277,11 @@ const struct binding_t OpPager[] = { /* map: pager */ - nodist_mutt_SOURCES = $(BUILT_SOURCES) - mutt_LDADD = @MUTT_LIB_OBJECTS@ @LIBOBJS@ $(LIBIMAP) $(MUTTLIBS) \ -@@ -397,7 +397,7 @@ - README.SSL smime.h group.h \ - muttbug pgppacket.h depcomp ascii.h BEWARE PATCHES patchlist.sh \ - ChangeLog mkchangelog.sh mutt_idna.h \ -- snprintf.c regex.c crypt-gpgme.h hcachever.sh.in -+ snprintf.c regex.c crypt-gpgme.h sidebar.h hcachever.sh.in + { "what-key", OP_WHAT_KEY, NULL }, - EXTRA_SCRIPTS = smime_keys - mutt_dotlock_SOURCES = mutt_dotlock.c -*** mutt-1.5.20-orig/mbox.c 2009-06-10 23:29:41.000000000 -0500 ---- mutt-1.5.20-patched/mbox.c 2009-06-19 22:07:04.000000000 -0500 -*************** -*** 100,105 **** ---- 100,106 ---- - mutt_perror (ctx->path); - return (-1); - } -+ ctx->atime = sb.st_atime; - ctx->mtime = sb.st_mtime; - ctx->size = sb.st_size; - -*************** -*** 255,260 **** ---- 256,262 ---- - - ctx->size = sb.st_size; - ctx->mtime = sb.st_mtime; -+ ctx->atime = sb.st_atime; - - #ifdef NFS_ATTRIBUTE_HACK - if (sb.st_mtime > sb.st_atime) -*** mutt-1.5.20-orig/menu.c 2009-06-01 11:29:32.000000000 -0500 ---- mutt-1.5.20-patched/menu.c 2009-06-19 22:07:04.000000000 -0500 -*************** -*** 24,29 **** ---- 24,30 ---- - #include "mutt_curses.h" - #include "mutt_menu.h" - #include "mbyte.h" -+ #include "sidebar.h" - - #include - #include -*************** -*** 156,162 **** - { - char *scratch = safe_strdup (s); - int shift = option (OPTARROWCURSOR) ? 3 : 0; -! int cols = COLS - shift; - - mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1); - s[n - 1] = 0; ---- 157,163 ---- - { - char *scratch = safe_strdup (s); - int shift = option (OPTARROWCURSOR) ? 3 : 0; -! int cols = COLS - shift - SidebarWidth; - - mutt_format_string (s, n, cols, cols, FMT_LEFT, ' ', scratch, mutt_strlen (scratch), 1); - s[n - 1] = 0; -*************** -*** 207,212 **** ---- 208,214 ---- - char buf[LONG_STRING]; - int i; - -+ draw_sidebar(1); - for (i = menu->top; i < menu->top + menu->pagelen; i++) - { - if (i < menu->max) -*************** -*** 217,223 **** - if (option (OPTARROWCURSOR)) - { - attrset (menu->color (i)); -! CLEARLINE (i - menu->top + menu->offset); - - if (i == menu->current) - { ---- 219,225 ---- - if (option (OPTARROWCURSOR)) - { - attrset (menu->color (i)); -! CLEARLINE_WIN (i - menu->top + menu->offset); - - if (i == menu->current) - { -*************** -*** 246,259 **** - BKGDSET (MT_COLOR_INDICATOR); - } - -! CLEARLINE (i - menu->top + menu->offset); - print_enriched_string (menu->color(i), (unsigned char *) buf, i != menu->current); - SETCOLOR (MT_COLOR_NORMAL); - BKGDSET (MT_COLOR_NORMAL); - } - } - else -! CLEARLINE (i - menu->top + menu->offset); - } - menu->redraw = 0; - } ---- 248,261 ---- - BKGDSET (MT_COLOR_INDICATOR); *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***