- c = realloc(entry, SidebarWidth + 1);
- if ( c ) entry = c;
- entry[SidebarWidth] = 0;
- for (; i < SidebarWidth; entry[i++] = ' ' );
-#if USE_IMAP
- if (ImapHomeNamespace && strlen(ImapHomeNamespace)>0) {
- if (strncmp(box,ImapHomeNamespace,strlen(ImapHomeNamespace))==0 && strcmp(box,ImapHomeNamespace)!=0) {
- box+=strlen(ImapHomeNamespace)+1;
- }
- }
-#endif
- if (option(OPTSHORTENHIERARCHY)) {
- box = shortened_hierarchy(box);
+ switch (op) {
+ /* deleted */
+ case 'd':
+ if (!opt) {
+ snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
+ snprintf (dest, destlen, tmp, c ? Context->deleted : 0);
+ } else if ((c && Context->deleted == 0) || !c)
+ opt = 0;
+ break;
+ /* flagged */
+ case 'F':
+ case 'f': /* for compatibility */
+ if (!opt) {
+ snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
+ snprintf (dest, destlen, tmp, c ? Context->flagged : b->msg_flagged);
+ } else if ((c && Context->flagged == 0) || (!c && b->msg_flagged == 0))
+ opt = 0;
+ break;
+ /* total */
+ case 'c': /* for compatibility */
+ case 'm':
+ if (!opt) {
+ snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
+ snprintf (dest, destlen, tmp, c ? Context->msgcount : b->msgcount);
+ } else if ((c && Context->msgcount == 0) || (!c && b->msgcount == 0))
+ opt = 0;
+ break;
+ /* total shown, i.e. not hidden by limit */
+ case 'M':
+ if (!opt) {
+ snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
+ snprintf (dest, destlen, tmp, c ? Context->vcount : 0);
+ } else if ((c && Context->vcount == 0) || !c)
+ opt = 0;
+ break;
+ /* new */
+ case 'n':
+ if (!opt) {
+ snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
+ snprintf (dest, destlen, tmp, c ? Context->new : b->new);
+ } else if ((c && Context->new == 0) || (!c && b->new == 0))
+ opt = 0;
+ break;
+ /* unread */
+ case 'u':
+ if (!opt) {
+ snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
+ snprintf (dest, destlen, tmp, c ? Context->unread : b->msg_unread);
+ } else if ((c && Context->unread == 0) || (!c && b->msg_unread == 0))
+ opt = 0;
+ break;
+ /* tagged */
+ case 't':
+ if (!opt) {
+ snprintf (tmp, sizeof (tmp), "%%%sd", fmt);
+ snprintf (dest, destlen, tmp, c ? Context->tagged : 0);
+ } else if ((c && Context->tagged == 0) || !c)
+ opt = 0;
+ break;