if (!longlist) {
color(BRIGHT_WHITE);
- pprintf(" User Name Room Idle From host\n");
+ pprintf(" User Name Room ");
+ if (screenwidth >= 50) pprintf(" Idle From host\n");
color(DIM_WHITE);
- pprintf(" ------------------------- -------------------- ---- ------------------------\n");
+ pprintf(" ------------------------- --------------------");
+ if (screenwidth >= 50) pprintf(" ---- ------------------------\n");
}
r = CtdlIPCOnlineUsers(ipc, &listing, &timenow, buf);
listing = SortOnlineUsers(listing);
idlesecs = (idletime - (idlehours * 3600) - (idlemins * 60));
if (idletime > rc_idle_threshold) {
- /*
- while (strlen(roomname) < 20) {
- strcat(roomname, " ");
- }
- strcpy(&roomname[14], "[idle]");
- */
- if (skipidle)
+ if (skipidle) {
isidle = 1;
+ }
}
if (longlist) {
pprintf("\n");
} else {
- if (isidle == 0) {
- if (extract_int(buf, 0) == last_session) {
- pprintf(" ");
- } else {
+ if (isidle == 0) {
+ if (extract_int(buf, 0) == last_session) {
+ pprintf(" ");
+ }
+ else {
+ color(BRIGHT_MAGENTA);
+ pprintf("%-3s", flags);
+ }
+ last_session = extract_int(buf, 0);
+ color(BRIGHT_CYAN);
+ pprintf("%-25s ", username);
color(BRIGHT_MAGENTA);
- pprintf("%-3s", flags);
- }
- last_session = extract_int(buf, 0);
- color(BRIGHT_CYAN);
- pprintf("%-25s ", username);
- color(BRIGHT_MAGENTA);
- roomname[20] = 0;
- pprintf("%-20s ", roomname);
- if (idletime > rc_idle_threshold) {
- /* over 1000d, must be gone fishing */
- if (idlehours > 23999) {
- pprintf("fish");
- /* over 10 days */
- } else if (idlehours > 239) {
- pprintf("%3ldd",
- idlehours / 24);
- /* over 10 hours */
- } else if (idlehours > 9) {
- pprintf("%1ldd%02ld",
- idlehours / 24,
- idlehours % 24);
- /* less than 10 hours */
- } else {
- pprintf("%1ld:%02ld",
- idlehours, idlemins);
+ roomname[20] = 0;
+ pprintf("%-20s", roomname);
+
+ if (screenwidth >= 50) {
+ pprintf(" ");
+ if (idletime > rc_idle_threshold) {
+ /* over 1000d, must be gone fishing */
+ if (idlehours > 23999) {
+ pprintf("fish");
+ /* over 10 days */
+ } else if (idlehours > 239) {
+ pprintf("%3ldd", idlehours / 24);
+ /* over 10 hours */
+ } else if (idlehours > 9) {
+ pprintf("%1ldd%02ld",
+ idlehours / 24,
+ idlehours % 24);
+ /* less than 10 hours */
+ }
+ else {
+ pprintf("%1ld:%02ld", idlehours, idlemins);
+ }
+ }
+ else {
+ pprintf(" ");
+ }
+ pprintf(" ");
+ color(BRIGHT_CYAN);
+ fromhost[24] = '\0';
+ pprintf("%-24s", fromhost);
}
- }
- else {
- pprintf(" ");
- }
- pprintf(" ");
- color(BRIGHT_CYAN);
- fromhost[24] = '\0';
- pprintf("%-24s\n", fromhost);
- color(DIM_WHITE);
- }
+ pprintf("\n");
+ color(DIM_WHITE);
+ }
}
}
}
/*
- * $Id:$
+ * $Id$
*
* Implements the LIST and LSUB commands.
*
}
}
if (match) {
- cprintf("* %s (\\NoSelect) \"/\" ", verb);
+ cprintf("* %s (\\NoSelect \\HasChildren) \"/\" ", verb);
imap_strout(fl->f_name);
cprintf("\r\n");
}
int num_patterns;
char **patterns;
int return_subscribed;
+ int return_children;
int i = 0;
int match = 0;
num_patterns = (int) data_for_callback[2];
patterns = (char **) data_for_callback[3];
return_subscribed = (int) data_for_callback[4];
+ return_children = (int) data_for_callback[5];
/* Only list rooms to which the user has access!! */
yes_output_this_room = 0;
}
}
+ /* Warning: ugly hack.
+ * We don't have any way to determine the presence of child mailboxes
+ * without refactoring this entire module. So we're just going to return
+ * the \HasChildren attribute for every room.
+ * We'll fix this later when we have time.
+ */
+ if (return_children) {
+ if (strlen(return_options) > 0) {
+ strcat(return_options, " ");
+ }
+ strcat(return_options, "\\HasChildren");
+ }
+
if (subscribed_rooms_only) {
if (ra & UA_KNOWN) {
yes_output_this_room = 1;
int subscribed_rooms_only = 0;
char verb[16];
int i, j, paren_nest;
- char *data_for_callback[5];
+ char *data_for_callback[6];
int num_patterns = 1;
char *patterns[MAX_PATTERNS];
int selection_left = (-1);
int patterns_right = 3;
int extended_list_in_use = 0;
int return_subscribed = 0;
+ int return_children = 0;
if (num_parms < 4) {
cprintf("%s BAD arguments invalid\r\n", parms[0]);
/*
* In order to implement draft-ietf-imapext-list-extensions-18
* ("LIST Command Extensions") we need to:
- * 1. Extract "selection options" (DONE, but we don't do anything with it yet. We
- * need to implement SUBSCRIBED, and RECURSIVEMATCH,
- * and silently ignore REMOTE)
- * 2. Extract "return options" (DONE, but so far we only implement the SUBSCRIBED
- * option; we also need to implement the CHILDREN
- * return option.)
- * 3. Determine whether there is more than one match pattern (DONE)
+ *
+ * 1. Extract "selection options"
+ * (Extraction: done
+ * SUBSCRIBED option: done
+ * RECURSIVEMATCH option: not done yet
+ * REMOTE: safe to silently ignore)
+ *
+ * 2. Extract "return options"
+ * (Extraction: done
+ * SUBSCRIBED option: done
+ * CHILDREN option: done, but needs a non-ugly rewrite)
+ *
+ * 3. Determine whether there is more than one match pattern (done)
*/
/*
}
}
+ /* If selection options were found, do something with them.
+ */
+ if ((selection_left > 0) && (selection_right >= selection_left)) {
+
+ /* Strip off the outer parentheses */
+ if (parms[selection_left][0] == '(') {
+ strcpy(parms[selection_left], &parms[selection_left][1]);
+ }
+ if (parms[selection_right][strlen(parms[selection_right])-1] == ')') {
+ parms[selection_right][strlen(parms[selection_right])-1] = 0;
+ }
+
+ for (i=selection_left; i<=selection_right; ++i) {
+
+ if (!strcasecmp(parms[i], "SUBSCRIBED")) {
+ subscribed_rooms_only = 1;
+ }
+
+ if (!strcasecmp(parms[i], "RECURSIVEMATCH")) {
+ /* FIXME - do this! */
+ }
+
+ }
+
+ }
+
/* The folder root appears immediately after the selection options,
* or in position 2 if no selection options were specified.
*/
if (!strcasecmp(parms[i], "SUBSCRIBED")) {
return_subscribed = 1;
}
+ if (!strcasecmp(parms[i], "CHILDREN")) {
+ return_children = 1;
+ }
if (paren_nest == 0) {
return_right = i; /* found end of patterns */
data_for_callback[2] = (char *) num_patterns;
data_for_callback[3] = (char *) patterns;
data_for_callback[4] = (char *) return_subscribed;
+ data_for_callback[5] = (char *) return_children;
/* The non-extended LIST command is required to treat an empty
* ("" string) mailbox name argument as a special request to return the