- int shortened = 0, lencnt = 0;
- char no[SHORT_STRING], entry[SHORT_STRING];
- int l = m_strlen(ImapHomeNamespace);
- int l_m = m_strlen(Maildir);
-
- if (SidebarWidth > COLS)
- SidebarWidth = COLS;
-
- if (option (OPTSIDEBARNEWMAILONLY) && box && Context && Context->path &&
- m_strcmp(Context->path, box) && ((BUFFY*) Incoming->data[idx])->new == 0)
- /* if $sidebar_newmail_only is set, don't display the
- * box only if it's not the currently opened
- * (i.e. always display the currently opened) */
- return (0);
-
- mutt_FormatString (no, len, NONULL (SidebarNumberFormat),
- sidebar_number_format, idx, M_FORMAT_OPTIONAL);
- lencnt = m_strlen(no);
- memset(&entry, ' ', sizeof(entry));
-
- if (l > 0 && m_strncmp(box, ImapHomeNamespace, l) == 0 &&
- m_strlen(box) > l)
- box += l + 1; /* we're trimming the ImapHomeNamespace, the "+ 1" is for the separator */
- else
- if (l_m > 0 && m_strncmp(box, Maildir, l_m) == 0 &&
- m_strlen(box) > l_m) {
- box += l_m;
- if (Maildir[strlen(Maildir)-1]!='/') {
- box += 1;
+ int lencnt = 0;
+ char no[STRING], entry[STRING];
+ int l_m = m_strlen(Maildir);
+
+ if (option(OPTSIDEBARNEWMAILONLY) && sbox && Context && Context->path
+ && m_strcmp(Context->path, sbox) && Incoming.arr[idx]->new == 0
+ && idx != CurBuffy)
+ return 0;
+
+ m_strformat(no, sizeof(no), len, SidebarNumberFormat,
+ sidebar_number_format, idx, 0);
+ lencnt = m_strlen(no);
+
+ if (l_m > 0 && m_strncmp(sbox, Maildir, l_m) == 0 && m_strlen(sbox) > l_m)
+ {
+ sbox += l_m;
+ if (Maildir[strlen(Maildir) - 1] != '/') {
+ sbox += 1;
+ }
+ } else {
+ sbox = basename(sbox);