move old tokenizer over to the managesieve server; its only used there.
authorWilfried Goesgens <dothebart@citadel.org>
Wed, 3 Nov 2010 20:47:55 +0000 (21:47 +0100)
committerWilfried Goesgens <dothebart@citadel.org>
Wed, 3 Nov 2010 20:47:55 +0000 (21:47 +0100)
 - 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/imap_tools.h [deleted file]
citadel/modules/imap/imap_tools.c
citadel/modules/imap/imap_tools.h [new file with mode: 0644]
citadel/modules/managesieve/serv_managesieve.c

diff --git a/citadel/imap_tools.h b/citadel/imap_tools.h
deleted file mode 100644 (file)
index 8c64aba..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * FDELIM defines which character we want to use as a folder delimiter
- * in room names.  Originally we used a forward slash, but that caused
- * rooms with names like "Sent/Received Pages" to get delimited, so we
- * changed it to a backslash.  This is completely irrelevant to how Citadel
- * speaks to IMAP clients -- the delimiter used in the IMAP protocol is
- * a vertical bar, which is illegal in Citadel room names anyway.
- */
-#define FDELIM '\\'
-
-typedef struct __citimap_command {
-       StrBuf *CmdBuf;                 /* our current commandline; gets chopped into: */
-       ConstStr *Params;               /* Commandline tokens */
-       int num_parms;                  /* Number of Commandline tokens available */
-       int avail_parms;                /* Number of ConstStr args is big */
-} citimap_command;
-
-/* 
- * since we work with shifted pointers to ConstStrs in some places, 
- * we can't just say we want to cut the n'th of Cmd, we have to pass it in
- * and rely on that CutMe references Cmd->CmdBuf; else peek won't work out
- * and len will differ.
- */
-void TokenCutRight(citimap_command *Cmd, 
-                  ConstStr *CutMe,
-                  int n);
-/*
- * since we just move Key around here, Cmd is just here so the syntax is identical.
- */
-void TokenCutLeft(citimap_command *Cmd, 
-                 ConstStr *CutMe,
-                 int n);
-void MakeStringOf(StrBuf *Buf, int skip);
-
-int CmdAdjust(citimap_command *Cmd, 
-             int nArgs,
-             int Realloc);
-
-
-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);
-int imap_is_message_set(const char *);
-int imap_mailbox_matches_pattern(const char *pattern, char *mailboxname);
-int imap_datecmp(const char *datestr, time_t msgtime);
-
-/*
- * Flags that may be returned by imap_roomname()
- * (the lower eight bits will be the floor number)
- */
-#define IR_MAILBOX     0x0100          /* Mailbox                       */
-#define IR_EXISTS      0x0200          /* Room exists (not implemented) */
-#define IR_BABOON      0x0000          /* Just had to put this here :)  */
index 645478a4717716a9978225dc9dabbd89254b8d1c..d0f4c2cacdb5015b71db5af386c45413c6304345 100644 (file)
@@ -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/modules/imap/imap_tools.h b/citadel/modules/imap/imap_tools.h
new file mode 100644 (file)
index 0000000..d9b72cc
--- /dev/null
@@ -0,0 +1,56 @@
+/*
+ * FDELIM defines which character we want to use as a folder delimiter
+ * in room names.  Originally we used a forward slash, but that caused
+ * rooms with names like "Sent/Received Pages" to get delimited, so we
+ * changed it to a backslash.  This is completely irrelevant to how Citadel
+ * speaks to IMAP clients -- the delimiter used in the IMAP protocol is
+ * a vertical bar, which is illegal in Citadel room names anyway.
+ */
+#define FDELIM '\\'
+
+typedef struct __citimap_command {
+       StrBuf *CmdBuf;                 /* our current commandline; gets chopped into: */
+       ConstStr *Params;               /* Commandline tokens */
+       int num_parms;                  /* Number of Commandline tokens available */
+       int avail_parms;                /* Number of ConstStr args is big */
+} citimap_command;
+
+/* 
+ * since we work with shifted pointers to ConstStrs in some places, 
+ * we can't just say we want to cut the n'th of Cmd, we have to pass it in
+ * and rely on that CutMe references Cmd->CmdBuf; else peek won't work out
+ * and len will differ.
+ */
+void TokenCutRight(citimap_command *Cmd, 
+                  ConstStr *CutMe,
+                  int n);
+/*
+ * since we just move Key around here, Cmd is just here so the syntax is identical.
+ */
+void TokenCutLeft(citimap_command *Cmd, 
+                 ConstStr *CutMe,
+                 int n);
+void MakeStringOf(StrBuf *Buf, int skip);
+
+int CmdAdjust(citimap_command *Cmd, 
+             int nArgs,
+             int Realloc);
+
+
+void imap_strout(ConstStr *args);
+void plain_imap_strout(char *buf);
+int imap_parameterize(citimap_command *Cmd);
+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);
+int imap_is_message_set(const char *);
+int imap_mailbox_matches_pattern(const char *pattern, char *mailboxname);
+int imap_datecmp(const char *datestr, time_t msgtime);
+
+/*
+ * Flags that may be returned by imap_roomname()
+ * (the lower eight bits will be the floor number)
+ */
+#define IR_MAILBOX     0x0100          /* Mailbox                       */
+#define IR_EXISTS      0x0200          /* Room exists (not implemented) */
+#define IR_BABOON      0x0000          /* Just had to put this here :)  */
index 2f67d2f6f02b54061addb931861035aa13b0e79f..f1523d73bf793ab1ebdd9a73c49056ee78e41ea2 100644 (file)
@@ -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                                   */
 /*****************************************************************************/