From ec4814cf844f6f070da547fe585ce2f96e806731 Mon Sep 17 00:00:00 2001 From: Wilfried Goesgens Date: Wed, 3 Nov 2010 21:47:55 +0100 Subject: [PATCH] move old tokenizer over to the managesieve server; its only used there. - remove old_imap_tokenizer from imap_tools.h - move old_imap_tokenizer to modules/managesieve/serv_managesieve.c - move imap_tools.h to modules/imap; since its not needed globaly anymore. --- citadel/modules/imap/imap_tools.c | 59 ------------------ citadel/{ => modules/imap}/imap_tools.h | 1 - .../modules/managesieve/serv_managesieve.c | 61 ++++++++++++++++++- 3 files changed, 60 insertions(+), 61 deletions(-) rename citadel/{ => modules/imap}/imap_tools.h (97%) diff --git a/citadel/modules/imap/imap_tools.c b/citadel/modules/imap/imap_tools.c index 645478a47..d0f4c2cac 100644 --- a/citadel/modules/imap/imap_tools.c +++ b/citadel/modules/imap/imap_tools.c @@ -604,65 +604,6 @@ int imap_parameterize(citimap_command *Cmd) return Cmd->num_parms; } -int old_imap_parameterize(char** args, char *in) -{ - char* out = in; - int num = 0; - - for (;;) - { - /* Skip whitespace. */ - - while (isspace(*in)) - in++; - if (*in == 0) - break; - - /* Found the start of a token. */ - - args[num++] = out; - - /* Read in the token. */ - - for (;;) - { - int c = *in++; - if (isspace(c)) - break; - - if (c == '\"') - { - /* Found a quoted section. */ - - for (;;) - { - c = *in++; - if (c == '\"') - break; - else if (c == '\\') - c = *in++; - - *out++ = c; - if (c == 0) - return num; - } - } - else if (c == '\\') - { - c = *in++; - *out++ = c; - } - else - *out++ = c; - - if (c == 0) - return num; - } - *out++ = '\0'; - } - - return num; -} /* Convert a struct ctdlroom to an IMAP-compatible mailbox name. */ diff --git a/citadel/imap_tools.h b/citadel/modules/imap/imap_tools.h similarity index 97% rename from citadel/imap_tools.h rename to citadel/modules/imap/imap_tools.h index 8c64aba24..d9b72cc51 100644 --- a/citadel/imap_tools.h +++ b/citadel/modules/imap/imap_tools.h @@ -40,7 +40,6 @@ int CmdAdjust(citimap_command *Cmd, void imap_strout(ConstStr *args); void plain_imap_strout(char *buf); int imap_parameterize(citimap_command *Cmd); -int old_imap_parameterize(char** args, char *n); void imap_mailboxname(char *buf, int bufsize, struct ctdlroom *qrbuf); void imap_ial_out(struct internet_address_list *ialist); int imap_roomname(char *buf, int bufsize, const char *foldername); diff --git a/citadel/modules/managesieve/serv_managesieve.c b/citadel/modules/managesieve/serv_managesieve.c index 2f67d2f6f..f1523d73b 100644 --- a/citadel/modules/managesieve/serv_managesieve.c +++ b/citadel/modules/managesieve/serv_managesieve.c @@ -63,7 +63,6 @@ #include "database.h" #include "msgbase.h" #include "internet_addressing.h" -#include "imap_tools.h" /* Needed for imap_parameterize */ #include "genstamp.h" #include "domain.h" #include "clientsocket.h" @@ -104,6 +103,66 @@ enum { /** Command states for login authentication */ #define MGSVE ((struct citmgsve *)CC->session_specific_data) +int old_imap_parameterize(char** args, char *in) +{ + char* out = in; + int num = 0; + + for (;;) + { + /* Skip whitespace. */ + + while (isspace(*in)) + in++; + if (*in == 0) + break; + + /* Found the start of a token. */ + + args[num++] = out; + + /* Read in the token. */ + + for (;;) + { + int c = *in++; + if (isspace(c)) + break; + + if (c == '\"') + { + /* Found a quoted section. */ + + for (;;) + { + c = *in++; + if (c == '\"') + break; + else if (c == '\\') + c = *in++; + + *out++ = c; + if (c == 0) + return num; + } + } + else if (c == '\\') + { + c = *in++; + *out++ = c; + } + else + *out++ = c; + + if (c == 0) + return num; + } + *out++ = '\0'; + } + + return num; +} + /*****************************************************************************/ /* MANAGESIEVE Server */ /*****************************************************************************/ -- 2.30.2