1 patches written by Steve Kemp, it adds two new functionalities to the sidebar,
2 so only the mailbox with new messages will be shown (and/or) selected
3 See Debian bug http://bugs.debian.org/532510
8 OP_SIDEBAR_NEXT "go down to next mailbox"
9 OP_SIDEBAR_PREV "go to previous mailbox"
10 OP_SIDEBAR_OPEN "open hilighted mailbox"
11 +OP_SIDEBAR_NEXT_NEW "go down to next mailbox with new mail"
12 +OP_SIDEBAR_PREV_NEW "go to previous mailbox with new mail"
16 case OP_SIDEBAR_SCROLL_DOWN:
19 + case OP_SIDEBAR_NEXT_NEW:
20 + case OP_SIDEBAR_PREV_NEW:
21 scroll_sidebar(op, menu->menu);
27 { "sidebar-scroll-down", OP_SIDEBAR_SCROLL_DOWN, NULL },
28 { "sidebar-next", OP_SIDEBAR_NEXT, NULL },
29 { "sidebar-prev", OP_SIDEBAR_PREV, NULL },
30 + { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL},
31 + { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL},
32 + { "sidebar-next-new", OP_SIDEBAR_NEXT_NEW, NULL},
33 + { "sidebar-prev-new", OP_SIDEBAR_PREV_NEW, NULL},
34 { "sidebar-open", OP_SIDEBAR_OPEN, NULL },
39 @@ -1956,6 +1956,11 @@
40 {"sidebar_delim", DT_STR, R_BOTH, UL &SidebarDelim, "|"},
43 + ** Show only new mail in the sidebar.
45 + {"sidebar_newmail_only", DT_BOOL, R_BOTH, OPTSIDEBARNEWMAILONLY, "no" },
48 ** This specifies the delimiter between the sidebar (if visible) and
54 OPTDONTHANDLEPGPKEYS, /* (pseudo) used to extract PGP keys */
55 OPTUNBUFFEREDINPUT, /* (pseudo) don't use key buffer */
57 + OPTSIDEBARNEWMAILONLY,
65 case OP_SIDEBAR_SCROLL_DOWN:
68 + case OP_SIDEBAR_NEXT_NEW:
69 + case OP_SIDEBAR_PREV_NEW:
70 scroll_sidebar(ch, MENU_PAGER);
76 SETCOLOR(MT_COLOR_NEW);
77 else if ( tmp->msg_flagged > 0 )
78 SETCOLOR(MT_COLOR_FLAGGED);
80 - SETCOLOR(MT_COLOR_NORMAL);
82 + /* make sure the path is either:
83 + 1. Containing new mail.
87 + if ((option (OPTSIDEBARNEWMAILONLY)) &&
88 + ( (tmp->msg_unread <= 0) &&
89 + ( tmp != Incoming ) &&
90 + ( strcmp( tmp->path, Context->path ) != 0 ) ) )
93 + SETCOLOR(MT_COLOR_NORMAL);
97 if ( Context && !strcmp( tmp->path, Context->path ) ) {
102 +BUFFY * exist_next_new()
104 + BUFFY *tmp = CurBuffy;
105 + if(tmp == NULL) return NULL;
106 + while (tmp->next != NULL)
109 + if(tmp->msg_unread) return tmp;
114 +BUFFY * exist_prev_new()
116 + BUFFY *tmp = CurBuffy;
117 + if(tmp == NULL) return NULL;
118 + while (tmp->prev != NULL)
121 + if(tmp->msg_unread) return tmp;
126 void set_buffystats(CONTEXT* Context)
128 @@ -336,18 +371,33 @@
130 void scroll_sidebar(int op, int menu)
133 if(!SidebarWidth) return;
134 if(!CurBuffy) return;
137 case OP_SIDEBAR_NEXT:
138 + if (!option (OPTSIDEBARNEWMAILONLY)) {
139 if ( CurBuffy->next == NULL ) return;
140 CurBuffy = CurBuffy->next;
143 + case OP_SIDEBAR_NEXT_NEW:
144 + if ( (tmp = exist_next_new()) == NULL)
146 + else CurBuffy = tmp;
148 case OP_SIDEBAR_PREV:
149 + if (!option (OPTSIDEBARNEWMAILONLY)) {
150 if ( CurBuffy->prev == NULL ) return;
151 CurBuffy = CurBuffy->prev;
154 + case OP_SIDEBAR_PREV_NEW:
155 + if ( (tmp = exist_prev_new()) == NULL)
157 + else CurBuffy = tmp;
159 case OP_SIDEBAR_SCROLL_UP:
161 if ( CurBuffy != Incoming ) {