]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/imap/imap_tools.c
ooops... ascmonths[] was in use in imap_tools.c ... fixed
[citadel.git] / citadel / modules / imap / imap_tools.c
index 4298610f1b19353e06fb86ecd3f99707ab8accff..f0eeef926fc1d497b307379fa1edf2bbe937c573 100644 (file)
@@ -12,9 +12,9 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <string.h>
+#include <libcitadel.h>
 #include "citadel.h"
 #include "sysdep_decls.h"
-#include "tools.h"
 #include "room_ops.h"
 #include "internet_addressing.h"
 #include "imap_tools.h"
@@ -125,7 +125,7 @@ int utf8_getc(char** ptr)
        loop:
                if (r < 0x80)
                {
-                       *ptr = p;
+                       *ptr = (char*) p;
                        v = r;
                        break;
                }
@@ -146,7 +146,7 @@ int utf8_getc(char** ptr)
                                m<<=5;
                        } while (r & 0x40);
                        
-                       *ptr = p;
+                       *ptr = (char*)p;
 
                        v &= ~m;
                        break;
@@ -376,7 +376,7 @@ void imap_strout(char *buf)
 {
        int i;
        int is_literal = 0;
-       int len;
+       long len;
 
        if (buf == NULL) {      /* yeah, we handle this */
                cprintf("NIL");
@@ -390,7 +390,7 @@ void imap_strout(char *buf)
        }
 
        if (is_literal) {
-               cprintf("{%ld}\r\n%s", (long)strlen(buf), buf);
+               cprintf("{%ld}\r\n%s", len, buf);
        } else {
                cprintf("\"%s\"", buf);
        }
@@ -632,7 +632,7 @@ int imap_is_message_set(char *buf)
        if (!strcasecmp(buf, "ALL"))
                return (1);     /* macro?  why?  */
 
-       for (i = 0; i < strlen(buf); ++i) {     /* now start the scan */
+       for (i = 0; buf[i]; ++i) {      /* now start the scan */
                if (
                           (!isdigit(buf[i]))
                           && (buf[i] != ':')
@@ -772,6 +772,10 @@ int imap_datecmp(char *datestr, time_t msgtime) {
        int msgday, msgmonth, msgyear;
        struct tm msgtm;
 
+       char *imap_datecmp_ascmonths[12] = {
+               "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
+       };
+
        if (datestr == NULL) return(0);
 
        /* Expecting a date in the form dd-Mmm-yyyy */
@@ -783,7 +787,7 @@ int imap_datecmp(char *datestr, time_t msgtime) {
        year = atoi(yearstr);
        month = 0;
        for (i=0; i<12; ++i) {
-               if (!strcasecmp(monthstr, ascmonths[i])) {
+               if (!strcasecmp(monthstr, imap_datecmp_ascmonths[i])) {
                        month = i;
                }
        }