Did away with lprintf all together now its called CtdlLogPrintf()
[citadel.git] / citadel / modules / imap / imap_tools.c
index 080f9db7c0da74855888c081c1a321708207d763..77d091c6d655cd46b36927351fe6417b683b0ab4 100644 (file)
 #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"
-
+#include "ctdl_module.h"
 
 #ifndef HAVE_SNPRINTF
 #include "snprintf.h"
@@ -211,7 +211,7 @@ static char* toimap(char* destp, char* destend, char* src)
 
        *destp = 0;
        string_init(&dest, destp, destend-destp);
-       /* lprintf(CTDL_DEBUG, "toimap %s\r\n", src); */
+       /* CtdlLogPrintf(CTDL_DEBUG, "toimap %s\r\n", src); */
 
        for (;;)
        {
@@ -277,7 +277,7 @@ static char* toimap(char* destp, char* destend, char* src)
 
        if (state == 1)
                utf7_closeb64(&dest, v, i);
-       /* lprintf(CTDL_DEBUG, "    -> %s\r\n", destp); */
+       /* CtdlLogPrintf(CTDL_DEBUG, "    -> %s\r\n", destp); */
        return string_end(&dest);
 }
 
@@ -295,7 +295,7 @@ static char* fromimap(char* destp, char* destend, char* src)
 
        *destp = 0;
        string_init(&dest, destp, destend-destp);
-       /* lprintf(CTDL_DEBUG, "fromimap %s\r\n", src); */
+       /* CtdlLogPrintf(CTDL_DEBUG, "fromimap %s\r\n", src); */
 
        do {
                c = *p++;
@@ -353,7 +353,7 @@ static char* fromimap(char* destp, char* destend, char* src)
                        }
        } while (c != '\0');
 
-       /* lprintf(CTDL_DEBUG, "      -> %s\r\n", destp); */
+       /* CtdlLogPrintf(CTDL_DEBUG, "      -> %s\r\n", destp); */
        return string_end(&dest);
 }
 
@@ -582,7 +582,7 @@ int imap_roomname(char *rbuf, int bufsize, char *foldername)
        ret = (0 | IR_MAILBOX);
 
 exit:
-       lprintf(CTDL_DEBUG, "(That translates to \"%s\")\n", rbuf);
+       CtdlLogPrintf(CTDL_DEBUG, "(That translates to \"%s\")\n", rbuf);
        return(ret);
 }
 
@@ -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;
                }
        }