X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fimap%2Fimap_list.c;h=6dbbe6ebb9d25f5936f8d72008b43ff8738b1607;hb=e26a8dee20d1726b4995821f717f867f50fc5659;hp=2c342e94cdfec514fc0b455bf1bab598f156a333;hpb=0eea6dcc234e0f524bbf2a1d909455d41ed02314;p=citadel.git diff --git a/citadel/modules/imap/imap_list.c b/citadel/modules/imap/imap_list.c index 2c342e94c..6dbbe6ebb 100644 --- a/citadel/modules/imap/imap_list.c +++ b/citadel/modules/imap/imap_list.c @@ -1,11 +1,9 @@ /* - * $Id$ - * * Implements the LIST and LSUB commands. * * Copyright (c) 2000-2009 by Art Cancro and others. * - * This program is free software; you can redistribute it and/or modify + * This program is open source software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. @@ -56,8 +54,8 @@ #include "database.h" #include "msgbase.h" #include "internet_addressing.h" -#include "imap_tools.h" #include "serv_imap.h" +#include "imap_tools.h" #include "imap_fetch.h" #include "imap_search.h" #include "imap_store.h" @@ -98,9 +96,9 @@ void imap_list_floors(char *verb, int num_patterns, StrBuf **patterns) } } if (match) { - cprintf("* %s (\\NoSelect \\HasChildren) \"/\" ", verb); + IAPrintf("* %s (\\NoSelect \\HasChildren) \"/\" ", verb); plain_imap_strout(fl->f_name); - cprintf("\r\n"); + IAPuts("\r\n"); } } } @@ -178,9 +176,9 @@ void imap_listroom(struct ctdlroom *qrbuf, void *data) } } if (match) { - cprintf("* %s (%s) \"/\" ", ImapFilter->verb, return_options); + IAPrintf("* %s (%s) \"/\" ", ImapFilter->verb, return_options); plain_imap_strout(MailboxName); - cprintf("\r\n"); + IAPuts("\r\n"); } } } @@ -191,19 +189,19 @@ void imap_listroom(struct ctdlroom *qrbuf, void *data) */ void imap_list(int num_parms, ConstStr *Params) { + citimap *Imap = IMAP; int i, j, paren_nest; ImapRoomListFilter ImapFilter; int selection_left = (-1); int selection_right = (-1); int return_left = (-1); - int return_right = (-1); int root_pos = 2; int patterns_left = 3; int patterns_right = 3; int extended_list_in_use = 0; if (num_parms < 4) { - cprintf("%s BAD arguments invalid\r\n", Params[0].Key); + IReply("BAD arguments invalid"); return; } @@ -270,12 +268,12 @@ void imap_list(int num_parms, ConstStr *Params) /* Strip off the outer parentheses */ if (Params[selection_left].Key[0] == '(') { - TokenCutLeft(&IMAP->Cmd, + TokenCutLeft(&Imap->Cmd, &Params[selection_left], 1); } if (Params[selection_right].Key[Params[selection_right].len-1] == ')') { - TokenCutRight(&IMAP->Cmd, + TokenCutRight(&Imap->Cmd, &Params[selection_right], 1); } @@ -370,15 +368,15 @@ void imap_list(int num_parms, ConstStr *Params) /* Might as well look for these while we're in here... */ if (Params[i].Key[0] == '(') - TokenCutLeft(&IMAP->Cmd, + TokenCutLeft(&Imap->Cmd, &Params[i], 1); if (Params[i].Key[Params[i].len-1] == ')') - TokenCutRight(&IMAP->Cmd, + TokenCutRight(&Imap->Cmd, &Params[i], 1); - CtdlLogPrintf(9, "evaluating <%s>\n", Params[i].Key); + syslog(LOG_DEBUG, "evaluating <%s>", Params[i].Key); if (!strcasecmp(Params[i].Key, "SUBSCRIBED")) { ImapFilter.return_subscribed = 1; @@ -389,7 +387,6 @@ void imap_list(int num_parms, ConstStr *Params) } if (paren_nest == 0) { - return_right = i; /* found end of patterns */ i = num_parms + 1; /* break out of the loop */ } } @@ -404,7 +401,7 @@ void imap_list(int num_parms, ConstStr *Params) * reference parameter. */ if ( (StrLength(ImapFilter.patterns[0]) == 0) && (extended_list_in_use == 0) ) { - cprintf("* %s (\\Noselect) \"/\" \"\"\r\n", ImapFilter.verb); + IAPrintf("* %s (\\Noselect) \"/\" \"\"\r\n", ImapFilter.verb); } /* Non-empty mailbox names, and any form of the extended LIST command, @@ -426,5 +423,5 @@ void imap_list(int num_parms, ConstStr *Params) } - cprintf("%s OK %s completed\r\n", Params[0].Key, ImapFilter.verb); + IReplyPrintf("OK %s completed", ImapFilter.verb); }