]> code.citadel.org Git - citadel.git/commitdiff
* mini fix to imap
authorArt Cancro <ajc@citadel.org>
Sat, 7 Oct 2000 18:38:32 +0000 (18:38 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 7 Oct 2000 18:38:32 +0000 (18:38 +0000)
citadel/imap_tools.c
citadel/imap_tools.h
citadel/serv_imap.c

index 1f381526ed912a34ab2d5cfd50636d112407eabe..a52c8b50e308f20dfd1de14e52141304b123cfdd 100644 (file)
@@ -65,3 +65,21 @@ void imap_mailboxname(char *buf, int bufsize, struct quickroom *qrbuf) {
                if (!strcasecmp(buf, MAILROOM)) strcpy(buf, "INBOX");
        }
 }
+
+
+/*
+ * Parse a parenthesized list of items (as with the FETCH command)
+ */
+int imap_extract_data_items(char *items) {
+       int num_items = 0;
+       int i;
+
+       /* First, convert all whitespace to ordinary space characters */
+       for (i=0; i<strlen(items); ++i) {
+               if (isspace(items[i])) items[i] = ' ';
+       }
+
+       return num_items;
+}
+
+
index d363cd8c2ea2523e3a796c4e4dc7b0399b835ba3..1804448d1eab9d0ecbf30547a9efd634f4066f23 100644 (file)
@@ -5,3 +5,5 @@
 
 int imap_parameterize(char **args, char *buf);
 void imap_mailboxname(char *buf, int bufsize, struct quickroom *qrbuf);
+int imap_extract_data_items(char *);
+
index 15b9eec543468edfd643bfa31a52a58c8774ff6a..324b6c213ecbc84f47e5908268f4eae104993935 100644 (file)
@@ -171,10 +171,12 @@ void imap_select(int num_parms, char *parms[]) {
        strcpy(towhere, parms[2]);
 
        /* IMAP uses the reserved name "INBOX" for the user's default incoming
-        * mail folder.  Convert this to Citadel's reserved name "_MAIL_".
+        * mail folder.  Convert this to whatever Citadel is using for the
+        * default mail room name (usually "Mail>").
         */
-       if (!strcasecmp(towhere, "INBOX"))
+       if (!strcasecmp(towhere, "INBOX")) {
                strcpy(towhere, MAILROOM);
+       }
 
         /* First try a regular match */
         c = getroom(&QRscratch, towhere);
@@ -193,8 +195,9 @@ void imap_select(int num_parms, char *parms[]) {
                 ra = CtdlRoomAccess(&QRscratch, &CC->usersupp);
 
                 /* normal clients have to pass through security */
-                if (ra & UA_KNOWN)
+                if (ra & UA_KNOWN) {
                         ok = 1;
+               }
        }
 
        /* Fail here if no such room */
@@ -303,7 +306,6 @@ void imap_do_fetch(int lo, int hi, char *items) {
        cprintf("* lo=%d hi=%d items=<%s>\r\n", lo, hi, items);
 }
 
-
 /*
  * Mark Crispin is a fscking idiot.
  */
@@ -334,9 +336,8 @@ void imap_fetch(int num_parms, char *parms[]) {
                strcat(items, parms[i]);
                if (i < (num_parms-1)) strcat(items, " ");
        }
-       for (i=0; i<strlen(items); ++i) {
-               if (isspace(items[i])) items[i] = ' ';
-       }
+
+       imap_extract_data_items(items);
 
        imap_do_fetch(lo, hi, items);
        cprintf("%s OK FETCH completed\r\n", parms[0]);