* Patch source:
- http://www.lunar-linux.org/index.php?page=mutt-sidebar
- - http://lunar-linux.org/~tchan/mutt/patch-1.5.18.sidebar.20080517.txt
+ - http://lunar-linux.org/~tchan/mutt/patch-1.5.18.sidebar.20080611.txt
* Changes made:
- - Fixed conflict with maildir-mtime patch [myon]
+ - 2008-08-02 myon: Refreshed patch using quilt push -f to remove hunks we do
+ not need (Makefile.in).
== END PATCH
--- a/buffy.c
#ifdef USE_IMAP
if (tmp->magic != M_IMAP)
#endif
-@@ -353,30 +355,51 @@ int mutt_buffy_check (int force)
+@@ -353,48 +355,112 @@ int mutt_buffy_check (int force)
case M_MBOX:
case M_MMDF:
while ((de = readdir (dirp)) != NULL)
{
char *p;
-@@ -385,12 +408,36 @@ int mutt_buffy_check (int force)
+ if (*de->d_name != '.' &&
+ (!(p = strstr (de->d_name, ":2,")) || !strchr (p + 3, 'T')))
{
- if (!tmp->new)
- {
-- /* one new and undeleted message is enough */
-- BuffyCount++;
-- tmp->new = 1;
--
-- if (! option (OPTMAILDIRMTIME)) /* prevent stat calls */
-- break;
+- /* one new and undeleted message is enough */
+- BuffyCount++;
+- tmp->new = 1;
+- break;
+ tmp->has_new = tmp->new = 1;
+ tmp->msgcount++;
+ tmp->msg_unread++;
+ if (p && strchr(p + 3, 'F')) {
+ tmp->msg_flagged++;
+ }
- }
- snprintf (path, sizeof (path), "%s/new/%s", tmp->path, de->d_name);
- if (!stat (path, &smd) && smd.st_mtime > tmp->mtime)
-@@ -403,8 +450,25 @@ int mutt_buffy_check (int force)
+ }
+ }
+ closedir (dirp);
break;
case M_MH:
}
--- a/buffy.h
+++ b/buffy.h
-@@ -25,8 +25,13 @@ typedef struct buffy_t
+@@ -25,7 +25,12 @@ typedef struct buffy_t
char *path;
long size;
struct buffy_t *next;
+ struct buffy_t *prev;
- time_t mtime; /* for maildirs...time of newest entry */
short new; /* mailbox has new mail */
+ short has_new; /* set it new if new and not read */
+ int msgcount; /* total number of messages */
#include "attach.h"
#include "mbyte.h"
+#include "sidebar.h"
- void set_xterm_title_bar(char *title);
- void set_xterm_icon_name(char *name);
-@@ -1069,6 +1070,8 @@ static int format_line (struct line_t **
+ #include "mx.h"
+
+@@ -1067,6 +1068,8 @@ static int format_line (struct line_t **
mbstate_t mbstate;
int wrap_cols = mutt_term_width ((flags & M_PAGER_NOWRAP) ? 0 : Wrap);
/* FIXME: this should come from lineInfo */
memset(&mbstate, 0, sizeof(mbstate));
-@@ -1702,7 +1705,7 @@ mutt_pager (const char *banner, const ch
+@@ -1700,7 +1703,7 @@ mutt_pager (const char *banner, const ch
if ((redraw & REDRAW_BODY) || topline != oldtopline)
{
do {
curline = oldtopline = topline;
lines = 0;
force_redraw = 0;
-@@ -1715,6 +1718,7 @@ mutt_pager (const char *banner, const ch
+@@ -1713,6 +1716,7 @@ mutt_pager (const char *banner, const ch
&QuoteList, &q_level, &force_redraw, &SearchRE) > 0)
lines++;
curline++;
}
last_offset = lineInfo[curline].offset;
} while (force_redraw);
-@@ -1728,6 +1732,7 @@ mutt_pager (const char *banner, const ch
+@@ -1726,6 +1730,7 @@ mutt_pager (const char *banner, const ch
addch ('~');
addch ('\n');
lines++;
}
/* We are going to update the pager status bar, so it isn't
* necessary to reset to normal color now. */
-@@ -1751,22 +1756,22 @@ mutt_pager (const char *banner, const ch
+@@ -1749,22 +1754,22 @@ mutt_pager (const char *banner, const ch
/* print out the pager status bar */
SETCOLOR (MT_COLOR_STATUS);
BKGDSET (MT_COLOR_STATUS);
BKGDSET (MT_COLOR_NORMAL);
SETCOLOR (MT_COLOR_NORMAL);
if (option(OPTXTERMSETTITLES))
-@@ -1783,18 +1788,23 @@ mutt_pager (const char *banner, const ch
+@@ -1781,18 +1786,23 @@ mutt_pager (const char *banner, const ch
/* redraw the pager_index indicator, because the
* flags for this message might have changed. */
menu_redraw_current (index);
redraw = 0;
if (option(OPTBRAILLEFRIENDLY)) {
-@@ -2673,6 +2683,13 @@ search_next:
+@@ -2671,6 +2681,13 @@ search_next:
redraw = REDRAW_FULL;
break;
break;
--- /dev/null
+++ b/sidebar.c
-@@ -0,0 +1,328 @@
+@@ -0,0 +1,333 @@
+/*
+ * Copyright (C) ????-2004 Justin Hibbits <jrh29@po.cwru.edu>
+ * Copyright (C) 2004 Thomer M. Gil <mutt@thomer.com>
+int draw_sidebar(int menu) {
+
+ int lines = option(OPTHELP) ? 1 : 0;
-+ int sidebar_folder_depth;
-+ char *sidebar_folder_name;
+ BUFFY *tmp;
+#ifndef USE_SLANG_CURSES
+ attr_t attrs;
+ tmp->msgcount = Context->msgcount;
+ tmp->msg_flagged = Context->flagged;
+ }
-+ sidebar_folder_depth = 0;
-+ sidebar_folder_name = "<null>"; // ... just in case
-+ if ( strlen(tmp->path) > strlen(Maildir) ) {
-+ int i;
-+ char *tmp_folder_name;
-+ tmp_folder_name = tmp->path + strlen(Maildir);
-+ for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) {
-+ if (tmp_folder_name[i] == '/') sidebar_folder_depth++;
-+ }
-+ if (sidebar_folder_depth > 0) {
-+ sidebar_folder_name = malloc(strlen(basename(tmp->path)) + sidebar_folder_depth + 1);
-+ for (i=0; i < sidebar_folder_depth; i++)
-+ sidebar_folder_name[i]=' ';
-+ sidebar_folder_name[i]=0;
-+ strncat(sidebar_folder_name, basename(tmp->path), strlen(basename(tmp->path)) + sidebar_folder_depth);
++ // check whether Maildir is a prefix of the current folder's path
++ short maildir_is_prefix = 0;
++ if ( (strlen(tmp->path) > strlen(Maildir)) &&
++ (strncmp(Maildir, tmp->path, strlen(Maildir)) == 0) )
++ maildir_is_prefix = 1;
++ // calculate depth of current folder and generate its display name with indented spaces
++ int sidebar_folder_depth = 0;
++ char *sidebar_folder_name;
++ sidebar_folder_name = basename(tmp->path);
++ if ( maildir_is_prefix ) {
++ char *tmp_folder_name;
++ int i;
++ tmp_folder_name = tmp->path + strlen(Maildir);
++ for (i = 0; i < strlen(tmp->path) - strlen(Maildir); i++) {
++ if (tmp_folder_name[i] == '/') sidebar_folder_depth++;
++ }
++ if (sidebar_folder_depth > 0) {
++ sidebar_folder_name = malloc(strlen(basename(tmp->path)) + sidebar_folder_depth + 1);
++ for (i=0; i < sidebar_folder_depth; i++)
++ sidebar_folder_name[i]=' ';
++ sidebar_folder_name[i]=0;
++ strncat(sidebar_folder_name, basename(tmp->path), strlen(basename(tmp->path)) + sidebar_folder_depth);
++ }
+ }
-+ } else sidebar_folder_name = "INBOX";
-+ printw( "%.*s", SidebarWidth - delim_len + 1,
-+ make_sidebar_entry(sidebar_folder_name, tmp->msgcount,
-+ tmp->msg_unread, tmp->msg_flagged));
-+ if (sidebar_folder_depth > 0)
-+ free(sidebar_folder_name);
++ printw( "%.*s", SidebarWidth - delim_len + 1,
++ make_sidebar_entry(sidebar_folder_name, tmp->msgcount,
++ tmp->msg_unread, tmp->msg_flagged));
++ if (sidebar_folder_depth > 0)
++ free(sidebar_folder_name);
+ lines++;
+ }
+ SETCOLOR(MT_COLOR_NORMAL);
+#endif /* SIDEBAR_H */
--- a/doc/Muttrc
+++ b/doc/Muttrc
-@@ -2085,6 +2085,26 @@ attachments -I message/external-body
+@@ -2090,6 +2090,26 @@ attachments -I message/external-body
# function.
#
#
--- a/PATCHES
+++ b/PATCHES
@@ -0,0 +1 @@
-+patch-1.5.18.sidebar.20080517.txt
++patch-1.5.18.sidebar.20080611.txt