visible to them.
wprintf("\">");
wprintf("</td></tr>");
+ /**
+ * Show empty floors?
+ */
+
+ get_preference("emptyfloors", buf, sizeof buf);
+ if (buf[0] == 0) strcpy(buf, "no");
+ wprintf("<tr class=\"odd\"><td>");
+ wprintf(_("Show empty floors"));
+ wprintf("</td><td>");
+
+ wprintf("<input type=\"radio\" name=\"emptyfloors\" VALUE=\"yes\"");
+ if (!strcasecmp(buf, "yes")) wprintf(" checked");
+ wprintf(">");
+ wprintf(_("Yes"));
+ wprintf("</input> ");
+
+ wprintf("<input type=\"radio\" name=\"emptyfloors\" VALUE=\"no\"");
+ if (!strcasecmp(buf, "no")) wprintf(" checked");
+ wprintf(">");
+ wprintf(_("No"));
+ wprintf("</input>\n");
+
+ wprintf("</td></tr>\n");
+
/** end table */
wprintf("</table>\n");
set_preference("daystart", bstr("daystart"), 0);
set_preference("dayend", bstr("dayend"), 0);
set_preference("default_header_charset", bstr("default_header_charset"), 0);
+ set_preference("emptyfloors", bstr("emptyfloors"), 0);
euid_escapize(ebuf, bstr("signature"));
set_preference("signature", ebuf, 1);
int ra_flags = 0;
int flags = 0;
int num_floors = 1; /** add an extra one for private folders */
-
+ char buf2[SIZ];
+
/** If our cached folder list is very old, burn it. */
if (WC->cache_fold != NULL) {
if ((time(NULL) - WC->cache_timestamp) > 300) {
fold[max_folders].floor,
fold[max_folders].is_mailbox);
fold[max_folders].selectable = 1;
+ /* Increase the room count for the associtaed floor */
+ if (fold[max_folders].is_mailbox)
+ fold[0].num_rooms++;
+ else
+ fold[fold[max_folders].floor+1].num_rooms++;
++max_folders;
}
-
+
+ /*
+ * Remove any floors that don't have rooms
+ */
+ get_preference("emptyfloors", buf2, sizeof buf2);
+ if (buf2[0]==0 || (strcasecmp(buf2, "no") == 0))
+ {
+ for (i=0; i<num_floors; i++)
+ {
+ if (fold[i].num_rooms == 0) {
+ for (j=i; j<max_folders; j++) {
+ memcpy(&fold[j], &fold[j+1], sizeof(struct folder));
+ }
+ max_folders--;
+ num_floors--;
+ i--;
+ }
+ }
+ }
+
/** Bubble-sort the folder list */
for (i=0; i<max_folders; ++i) {
for (j=0; j<(max_folders-1)-i; ++j) {
int is_mailbox; /**< is it a mailbox? */
int selectable; /**< can we select it ??? */
int view; /**< whats its default view? inbox/calendar.... */
+ int num_rooms; /**< If this is a floor, how many rooms does it have */
};
/**