#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"
/* String handling helpers */
-/* This code uses some pretty narsty string manipulation. To make everything
+/* This code uses some pretty nasty string manipulation. To make everything
* manageable, we use this semi-high-level string manipulation API. Strings are
- * always \0-terminated, despite the fact that we keep track of the size. */
-
+ * always \0-terminated, despite the fact that we keep track of the size.
+ */
struct string {
char* buffer;
int maxsize;
loop:
if (r < 0x80)
{
- *ptr = p;
+ *ptr = (char*) p;
v = r;
break;
}
m<<=5;
} while (r & 0x40);
- *ptr = p;
+ *ptr = (char*)p;
v &= ~m;
break;
*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 (;;)
{
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);
}
*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++;
}
} while (c != '\0');
- /* lprintf(CTDL_DEBUG, " -> %s\r\n", destp); */
+ /* CtdlLogPrintf(CTDL_DEBUG, " -> %s\r\n", destp); */
return string_end(&dest);
}
{
int i;
int is_literal = 0;
- int len;
+ long len;
if (buf == NULL) { /* yeah, we handle this */
cprintf("NIL");
}
if (is_literal) {
- cprintf("{%ld}\r\n%s", (long)strlen(buf), buf);
+ cprintf("{%ld}\r\n%s", len, buf);
} else {
cprintf("\"%s\"", buf);
}
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);
}
if (buf == NULL)
return (0); /* stupidity checks */
- if (strlen(buf) == 0)
+ if (IsEmptyStr(buf))
return (0);
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] != ':')
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 */
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;
}
}