X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fimap%2Fimap_list.c;fp=citadel%2Fmodules%2Fimap%2Fimap_list.c;h=235acfdf48b3f76e50a56c30158e280018ee3136;hb=2b6008f54e8b56b79e24617f47308e469fcaca0e;hp=e6f6c19d46760ad5696284d4a1bc9b3d216fd36a;hpb=6ef495f61980e6126bd9c945399337ea75bdb39a;p=citadel.git diff --git a/citadel/modules/imap/imap_list.c b/citadel/modules/imap/imap_list.c index e6f6c19d4..235acfdf4 100644 --- a/citadel/modules/imap/imap_list.c +++ b/citadel/modules/imap/imap_list.c @@ -57,8 +57,8 @@ #include "database.h" #include "msgbase.h" #include "internet_addressing.h" -#include "serv_imap.h" #include "imap_tools.h" +#include "serv_imap.h" #include "imap_fetch.h" #include "imap_search.h" #include "imap_store.h" @@ -89,7 +89,7 @@ void imap_list_floors(char *verb, int num_patterns, char **patterns) } if (match) { cprintf("* %s (\\NoSelect \\HasChildren) \"/\" ", verb); - imap_strout(fl->f_name); + plain_imap_strout(fl->f_name); cprintf("\r\n"); } } @@ -176,7 +176,7 @@ void imap_listroom(struct ctdlroom *qrbuf, void *data) } if (match) { cprintf("* %s (%s) \"/\" ", verb, return_options); - imap_strout(buf); + plain_imap_strout(buf); cprintf("\r\n"); } } @@ -186,7 +186,7 @@ void imap_listroom(struct ctdlroom *qrbuf, void *data) /* * Implements the LIST and LSUB commands */ -void imap_list(int num_parms, char *parms[]) +void imap_list(int num_parms, ConstStr *Params) { int subscribed_rooms_only = 0; char verb[16]; @@ -206,15 +206,15 @@ void imap_list(int num_parms, char *parms[]) int return_children = 0; if (num_parms < 4) { - cprintf("%s BAD arguments invalid\r\n", parms[0]); + cprintf("%s BAD arguments invalid\r\n", Params[0].Key); 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); + safestrncpy(verb, Params[1].Key, sizeof verb); + j = Params[1].len; for (i=0; i 0) && (selection_right >= selection_left)) { /* Strip off the outer parentheses */ - if (parms[selection_left][0] == '(') { - strcpy(parms[selection_left], &parms[selection_left][1]); + if (Params[selection_left].Key[0] == '(') { + TokenCutLeft(&IMAP->Cmd, + &Params[selection_left], + 1); } - if (parms[selection_right][strlen(parms[selection_right])-1] == ')') { - parms[selection_right][strlen(parms[selection_right])-1] = 0; + if (Params[selection_right].Key[Params[selection_right].len-1] == ')') { + TokenCutRight(&IMAP->Cmd, + &Params[selection_right], + 1); } for (i=selection_left; i<=selection_right; ++i) { - if (!strcasecmp(parms[i], "SUBSCRIBED")) { + if (!strcasecmp(Params[i].Key, "SUBSCRIBED")) { subscribed_rooms_only = 1; } - else if (!strcasecmp(parms[i], "RECURSIVEMATCH")) { + else if (!strcasecmp(Params[i].Key, "RECURSIVEMATCH")) { /* FIXME - do this! */ } @@ -293,13 +297,13 @@ void imap_list(int num_parms, char *parms[]) patterns_left = root_pos + 1; patterns_right = root_pos + 1; - if (parms[patterns_left][0] == '(') { + if (Params[patterns_left].Key[0] == '(') { extended_list_in_use = 1; paren_nest = 0; for (i=patterns_left; i 2) if (!strcasecmp(parms[patterns_right+1], "RETURN")) { + if (num_parms - patterns_right > 2) if (!strcasecmp(Params[patterns_right+1].Key, "RETURN")) { return_left = patterns_right + 2; extended_list_in_use = 1; paren_nest = 0; for (i=return_left; i\n", parms[i]); - - if (!strcasecmp(parms[i], "SUBSCRIBED")) { + if (Params[i].Key[0] == '(') + TokenCutLeft(&IMAP->Cmd, + &Params[i], + 1); + if (Params[i].Key[Params[i].len-1] == ')') + TokenCutRight(&IMAP->Cmd, + &Params[i], + 1); + + CtdlLogPrintf(9, "evaluating <%s>\n", Params[i].Key); + + if (!strcasecmp(Params[i].Key, "SUBSCRIBED")) { return_subscribed = 1; } - else if (!strcasecmp(parms[i], "CHILDREN")) { + else if (!strcasecmp(Params[i].Key, "CHILDREN")) { return_children = 1; } @@ -392,5 +405,5 @@ void imap_list(int num_parms, char *parms[]) free(patterns[i]); } - cprintf("%s OK %s completed\r\n", parms[0], verb); + cprintf("%s OK %s completed\r\n", Params[0].Key, verb); }