From e93696a6d0489d71042133bff6e7e1570f3d6ee6 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Thu, 26 Apr 2007 15:33:40 +0000 Subject: [PATCH] Began merging the code for IMAP LIST and LSUB commands into a single code path, in anticipation of implementing the LIST-EXTENDED extension. --- citadel/serv_imap.c | 59 +++++++++++++++++++++------------------------ 1 file changed, 27 insertions(+), 32 deletions(-) diff --git a/citadel/serv_imap.c b/citadel/serv_imap.c index 5b95ae63e..616538ddc 100644 --- a/citadel/serv_imap.c +++ b/citadel/serv_imap.c @@ -864,32 +864,6 @@ void imap_lsub_listroom(struct ctdlroom *qrbuf, void *data) } -/* - * Implements the LSUB command - */ -void imap_lsub(int num_parms, char *parms[]) -{ - char pattern[SIZ]; - if (num_parms < 4) { - cprintf("%s BAD arguments invalid\r\n", parms[0]); - return; - } - snprintf(pattern, sizeof pattern, "%s%s", parms[2], parms[3]); - - if (strlen(parms[3]) == 0) { - cprintf("* LIST (\\Noselect) \"/\" \"\"\r\n"); - } - - else { - imap_list_floors("LSUB", pattern); - ForEachRoom(imap_lsub_listroom, pattern); - } - - cprintf("%s OK LSUB completed\r\n", parms[0]); -} - - - /* * Back end for imap_list() */ @@ -916,27 +890,48 @@ void imap_list_listroom(struct ctdlroom *qrbuf, void *data) /* - * Implements the LIST command + * Implements the LIST and LSUB commands */ void imap_list(int num_parms, char *parms[]) { char pattern[SIZ]; + int subscribed_rooms_only = 0; + char verb[16]; + int i, j; + if (num_parms < 4) { cprintf("%s BAD arguments invalid\r\n", parms[0]); return; } + + /* parms[1] is the IMAP verb being used (e.g. LIST or LSUB) + * This tells us how to behave, and what verb to return back to the caller + */ + safestrncpy(verb, parms[1], sizeof verb); + j = strlen(verb); + for (i=0; i