]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/imap/imap_list.c
* Added some comments next to portions of the code which are obsoleted by the final...
[citadel.git] / citadel / modules / imap / imap_list.c
index e7b52710eee88ae5aaec167fb41e18c265d456c3..2ced210aecdac1ffe1876a4e65f4074e7251a318 100644 (file)
@@ -33,6 +33,7 @@
 #include <ctype.h>
 #include <string.h>
 #include <limits.h>
+#include <libcitadel.h>
 #include "citadel.h"
 #include "server.h"
 #include "sysdep_decls.h"
@@ -44,7 +45,6 @@
 #include "policy.h"
 #include "database.h"
 #include "msgbase.h"
-#include "tools.h"
 #include "internet_addressing.h"
 #include "serv_imap.h"
 #include "imap_tools.h"
@@ -54,6 +54,7 @@
 #include "imap_acl.h"
 #include "imap_misc.h"
 #include "imap_list.h"
+#include "ctdl_module.h"
 
 
 /*
@@ -105,9 +106,9 @@ void imap_listroom(struct ctdlroom *qrbuf, void *data)
        int subscribed_rooms_only;
        int num_patterns;
        char **patterns;
-       int return_subscribed;
-       int return_children;
-       int return_metadata;
+       int return_subscribed = 0;
+       int return_children = 0;
+       int return_metadata = 0;                /* FIXME obsolete remove this */
        int i = 0;
        int match = 0;
 
@@ -119,7 +120,7 @@ void imap_listroom(struct ctdlroom *qrbuf, void *data)
        patterns = (char **) data_for_callback[3];
        return_subscribed = (int) data_for_callback[4];
        return_children = (int) data_for_callback[5];
-       return_metadata = (int) data_for_callback[6];
+       return_metadata = (int) data_for_callback[6];           /* FIXME obsolete remove this */
 
        /* Only list rooms to which the user has access!! */
        yes_output_this_room = 0;
@@ -169,7 +170,7 @@ void imap_listroom(struct ctdlroom *qrbuf, void *data)
                        imap_strout(buf);
 
                        if (return_metadata) {
-                               cprintf(" (METADATA ())");      /* FIXME */
+                               cprintf(" (METADATA ())");      /* FIXME obsolete remove this */
                        }
 
                        cprintf("\r\n");
@@ -199,10 +200,10 @@ void imap_list(int num_parms, char *parms[])
        int extended_list_in_use = 0;
        int return_subscribed = 0;
        int return_children = 0;
-       int return_metadata = 0;
-       int select_metadata_left = (-1);
-       int select_metadata_right = (-1);
-       int select_metadata_nest = 0;
+       int return_metadata = 0;                /* FIXME obsolete remove this */
+       int select_metadata_left = (-1);        /* FIXME obsolete remove this */
+       int select_metadata_right = (-1);       /* FIXME obsolete remove this */
+       int select_metadata_nest = 0;           /* FIXME obsolete remove this */
 
        if (num_parms < 4) {
                cprintf("%s BAD arguments invalid\r\n", parms[0]);
@@ -250,7 +251,7 @@ void imap_list(int num_parms, char *parms[])
                selection_left = 2;
                paren_nest = 0;
                for (i=2; i<num_parms; ++i) {
-                       for (j=0; j<strlen(parms[i]); ++j) {
+                       for (j=0; parms[i][j]; ++j) {
                                if (parms[i][j] == '(') ++paren_nest;
                                if (parms[i][j] == ')') --paren_nest;
                        }
@@ -301,7 +302,7 @@ void imap_list(int num_parms, char *parms[])
 
        }
 
-       lprintf(CTDL_DEBUG, "select metadata: %d to %d\n", select_metadata_left, select_metadata_right);
+       CtdlLogPrintf(CTDL_DEBUG, "select metadata: %d to %d\n", select_metadata_left, select_metadata_right);
        /* FIXME blah, we have to do something with this */
 
        /* The folder root appears immediately after the selection options,
@@ -314,7 +315,7 @@ void imap_list(int num_parms, char *parms[])
                extended_list_in_use = 1;
                paren_nest = 0;
                for (i=patterns_left; i<num_parms; ++i) {
-                       for (j=0; j<strlen(parms[i]); ++j) {
+                       for (j=0; &parms[i][j]; ++j) {
                                if (parms[i][j] == '(') ++paren_nest;
                                if (parms[i][j] == ')') --paren_nest;
                        }
@@ -351,7 +352,7 @@ void imap_list(int num_parms, char *parms[])
                extended_list_in_use = 1;
                paren_nest = 0;
                for (i=return_left; i<num_parms; ++i) {
-                       for (j=0; j<strlen(parms[i]); ++j) {
+                       for (j=0; parms[i][j]; ++j) {
                                if (parms[i][j] == '(') ++paren_nest;
                                if (parms[i][j] == ')') --paren_nest;
                        }
@@ -359,7 +360,7 @@ void imap_list(int num_parms, char *parms[])
                        /* Might as well look for these while we're in here... */
                        if (parms[i][0] == '(') strcpy(parms[i], &parms[i][1]);
                        if (parms[i][strlen(parms[i])-1] == ')') parms[i][strlen(parms[i])-1] = 0;
-                       lprintf(9, "evaluating <%s>\n", parms[i]);
+                       CtdlLogPrintf(9, "evaluating <%s>\n", parms[i]);
 
                        if (!strcasecmp(parms[i], "SUBSCRIBED")) {
                                return_subscribed = 1;
@@ -388,7 +389,7 @@ void imap_list(int num_parms, char *parms[])
        data_for_callback[3] = (char *) patterns;
        data_for_callback[4] = (char *) return_subscribed;
        data_for_callback[5] = (char *) return_children;
-       data_for_callback[6] = (char *) return_metadata;
+       data_for_callback[6] = (char *) return_metadata;        /* FIXME obsolete remove this */
 
        /* The non-extended LIST command is required to treat an empty
         * ("" string) mailbox name argument as a special request to return the