int l_m = m_strlen(Maildir);
if (option(OPTSIDEBARNEWMAILONLY) && sbox && Context && Context->path
- && m_strcmp(Context->path, sbox) && Incoming.arr[idx]->new == 0)
+ && m_strcmp(Context->path, sbox) && Incoming.arr[idx]->new == 0
+ && idx != CurBuffy)
return 0;
m_strformat(no, sizeof(no), len, SidebarNumberFormat,
*/
const char *sidebar_get_current(void)
{
- if (!Incoming.len)
- return NULL;
- return Incoming.arr[CurBuffy]->path;
+ if (0 <= CurBuffy && CurBuffy < Incoming.len)
+ return Incoming.arr[CurBuffy]->path;
+ return NULL;
}
/* internally sets item to buf */
/* fix counters for a context
* FIXME since ctx must not be of our business, move it elsewhere
*/
-void sidebar_set_buffystats (CONTEXT* curContext) {
- int i = 0;
- BUFFY* tmp = NULL;
- if (!curContext || !Incoming.len || (i = buffy_lookup (curContext->path)) < 0)
- return;
- tmp = Incoming.arr[i];
- tmp->new = curContext->new;
- tmp->msg_unread = curContext->unread;
- tmp->msgcount = curContext->msgcount;
- tmp->msg_flagged = curContext->flagged;
+void sidebar_set_buffystats(CONTEXT *curContext)
+{
+ int i = 0;
+ BUFFY *tmp;
+
+ if (!curContext || (i = buffy_lookup(curContext->path)) < 0)
+ return;
+ tmp = Incoming.arr[i];
+ tmp->new = curContext->new;
+ tmp->msg_unread = curContext->unread;
+ tmp->msgcount = curContext->msgcount;
+ tmp->msg_flagged = curContext->flagged;
}
int sidebar_draw(void)