]> code.citadel.org Git - citadel.git/blobdiff - citadel/serv_imap.c
* The scheduler can now "wake up" a session to deliver async messages.
[citadel.git] / citadel / serv_imap.c
index 1646b1fa634deacc628a58a0202941b8398c42bd..426484263e27c46805041a060a81e0975ba0db5c 100644 (file)
@@ -81,12 +81,12 @@ struct irlparms {
 void imap_free_msgids(void)
 {
        if (IMAP->msgids != NULL) {
-               phree(IMAP->msgids);
+               free(IMAP->msgids);
                IMAP->msgids = NULL;
                IMAP->num_msgs = 0;
        }
        if (IMAP->flags != NULL) {
-               phree(IMAP->flags);
+               free(IMAP->flags);
                IMAP->flags = NULL;
        }
 }
@@ -98,7 +98,7 @@ void imap_free_msgids(void)
 void imap_free_transmitted_message(void)
 {
        if (IMAP->transmitted_message != NULL) {
-               phree(IMAP->transmitted_message);
+               free(IMAP->transmitted_message);
                IMAP->transmitted_message = NULL;
                IMAP->transmitted_length = 0;
        }
@@ -142,18 +142,18 @@ void imap_add_single_msgid(long msgnum, void *userdata)
 
        IMAP->num_msgs = IMAP->num_msgs + 1;
        if (IMAP->msgids == NULL) {
-               IMAP->msgids = mallok(IMAP->num_msgs * sizeof(long)
+               IMAP->msgids = malloc(IMAP->num_msgs * sizeof(long)
                                      * REALLOC_INCREMENT);
        } else if (IMAP->num_msgs % REALLOC_INCREMENT == 0) {
-               IMAP->msgids = reallok(IMAP->msgids,
+               IMAP->msgids = realloc(IMAP->msgids,
                                       (IMAP->num_msgs +
                                        REALLOC_INCREMENT) * sizeof(long));
        }
        if (IMAP->flags == NULL) {
-               IMAP->flags = mallok(IMAP->num_msgs * sizeof(long)
+               IMAP->flags = malloc(IMAP->num_msgs * sizeof(long)
                                     * REALLOC_INCREMENT);
        } else if (IMAP->num_msgs % REALLOC_INCREMENT == 0) {
-               IMAP->flags = reallok(IMAP->flags,
+               IMAP->flags = realloc(IMAP->flags,
                                      (IMAP->num_msgs +
                                       REALLOC_INCREMENT) * sizeof(long));
        }
@@ -212,7 +212,7 @@ void imap_rescan_msgids(void)
         */
        cdbfr = cdb_fetch(CDB_MSGLISTS, &CC->room.QRnumber, sizeof(long));
        if (cdbfr != NULL) {
-               msglist = mallok(cdbfr->len);
+               msglist = malloc(cdbfr->len);
                memcpy(msglist, cdbfr->ptr, cdbfr->len);
                num_msgs = cdbfr->len / sizeof(long);
                cdb_free(cdbfr);
@@ -285,7 +285,7 @@ void imap_rescan_msgids(void)
        }
 
        if (num_msgs != 0)
-               phree(msglist);
+               free(msglist);
 }
 
 
@@ -630,7 +630,7 @@ void imap_namespace(int num_parms, char *parms[])
        cprintf("* NAMESPACE ");
 
        /* All personal folders are subordinate to INBOX. */
-       cprintf("((\"INBOX|\" \"|\")) ");
+       cprintf("((\"INBOX/\" \"/\")) ");
 
        /* Other users' folders ... coming soon! FIXME */
        cprintf("NIL ");
@@ -642,9 +642,9 @@ void imap_namespace(int num_parms, char *parms[])
                if (fl->f_flags & F_INUSE) {
                        if (floors > 0) cprintf(" ");
                        cprintf("(");
-                       sprintf(buf, "%s|", fl->f_name);
+                       sprintf(buf, "%s/", fl->f_name);
                        imap_strout(buf);
-                       cprintf(" \"|\")");
+                       cprintf(" \"/\")");
                        ++floors;
                }
        }
@@ -670,7 +670,7 @@ void imap_list_floors(char *cmd, char *pattern)
                if (fl->f_flags & F_INUSE) {
                        if (imap_mailbox_matches_pattern
                            (pattern, fl->f_name)) {
-                               cprintf("* %s (\\NoSelect) \"|\" ", cmd);
+                               cprintf("* %s (\\NoSelect) \"/\" ", cmd);
                                imap_strout(fl->f_name);
                                cprintf("\r\n");
                        }
@@ -699,7 +699,7 @@ void imap_lsub_listroom(struct ctdlroom *qrbuf, void *data)
        if (ra & UA_KNOWN) {
                imap_mailboxname(buf, sizeof buf, qrbuf);
                if (imap_mailbox_matches_pattern(pattern, buf)) {
-                       cprintf("* LSUB () \"|\" ");
+                       cprintf("* LSUB () \"/\" ");
                        imap_strout(buf);
                        cprintf("\r\n");
                }
@@ -720,7 +720,7 @@ void imap_lsub(int num_parms, char *parms[])
        snprintf(pattern, sizeof pattern, "%s%s", parms[2], parms[3]);
 
        if (strlen(parms[3]) == 0) {
-               cprintf("* LIST (\\Noselect) \"|\" \"\"\r\n");
+               cprintf("* LIST (\\Noselect) \"/\" \"\"\r\n");
        }
 
        else {
@@ -750,7 +750,7 @@ void imap_list_listroom(struct ctdlroom *qrbuf, void *data)
            || ((ra & UA_GOTOALLOWED) && (ra & UA_ZAPPED))) {
                imap_mailboxname(buf, sizeof buf, qrbuf);
                if (imap_mailbox_matches_pattern(pattern, buf)) {
-                       cprintf("* LIST () \"|\" ");
+                       cprintf("* LIST () \"/\" ");
                        imap_strout(buf);
                        cprintf("\r\n");
                }
@@ -771,7 +771,7 @@ void imap_list(int num_parms, char *parms[])
        snprintf(pattern, sizeof pattern, "%s%s", parms[2], parms[3]);
 
        if (strlen(parms[3]) == 0) {
-               cprintf("* LIST (\\Noselect) \"|\" \"\"\r\n");
+               cprintf("* LIST (\\Noselect) \"/\" \"\"\r\n");
        }
 
        else {
@@ -799,7 +799,7 @@ void imap_create(int num_parms, char *parms[])
        if (strchr(parms[2], '\\') != NULL) {
                cprintf("%s NO Invalid character in folder name\r\n",
                        parms[0]);
-               lprintf(9, "invalid character in folder name\n");
+               lprintf(CTDL_DEBUG, "invalid character in folder name\n");
                return;
        }
 
@@ -807,16 +807,16 @@ void imap_create(int num_parms, char *parms[])
        if (ret < 0) {
                cprintf("%s NO Invalid mailbox name or location\r\n",
                        parms[0]);
-               lprintf(9, "invalid mailbox name or location\n");
+               lprintf(CTDL_DEBUG, "invalid mailbox name or location\n");
                return;
        }
        floornum = (ret & 0x00ff);      /* lower 8 bits = floor number */
        flags = (ret & 0xff00); /* upper 8 bits = flags        */
 
        if (flags & IR_MAILBOX) {
-               if (strncasecmp(parms[2], "INBOX|", 6)) {
+               if (strncasecmp(parms[2], "INBOX/", 6)) {
                        cprintf("%s NO Personal folders must be created under INBOX\r\n", parms[0]);
-                       lprintf(9, "not subordinate to inbox\n");
+                       lprintf(CTDL_DEBUG, "not subordinate to inbox\n");
                        return;
                }
        }
@@ -838,7 +838,7 @@ void imap_create(int num_parms, char *parms[])
        } else {
                cprintf("%s OK CREATE completed\r\n", parms[0]);
        }
-       lprintf(9, "imap_create() completed\n");
+       lprintf(CTDL_DEBUG, "imap_create() completed\n");
 }
 
 
@@ -1110,9 +1110,9 @@ void imap_rename_backend(struct ctdlroom *qrbuf, void *data)
        /* Rename subfolders */
        if ((!strncasecmp(foldername, irlparms->oldname,
                          strlen(irlparms->oldname))
-            && (foldername[strlen(irlparms->oldname)] == '|'))) {
+            && (foldername[strlen(irlparms->oldname)] == '/'))) {
 
-               sprintf(newfoldername, "%s|%s",
+               sprintf(newfoldername, "%s/%s",
                        irlparms->newname,
                        &foldername[strlen(irlparms->oldname) + 1]
                    );
@@ -1121,7 +1121,7 @@ void imap_rename_backend(struct ctdlroom *qrbuf, void *data)
                                         sizeof newroomname,
                                         newfoldername) & 0xFF;
 
-               irlp = (struct irl *) mallok(sizeof(struct irl));
+               irlp = (struct irl *) malloc(sizeof(struct irl));
                strcpy(irlp->irl_newroom, newroomname);
                strcpy(irlp->irl_oldroom, qrbuf->QRname);
                irlp->irl_newfloor = newfloor;
@@ -1214,7 +1214,7 @@ void imap_rename(int num_parms, char *parms[])
                        }
                        irlp = irl;
                        irl = irl->next;
-                       phree(irlp);
+                       free(irlp);
                }
        }
 
@@ -1267,7 +1267,7 @@ void imap_command_loop(void)
        /* Ok, at this point we're in normal command mode.  The first thing
         * we do is print any incoming pages (yeah! we really do!)
         */
-       imap_print_express_messages();
+       imap_print_instant_messages();
 
        /*
         * Before processing the command that was just entered... if we happen
@@ -1444,7 +1444,7 @@ void imap_command_loop(void)
 char *serv_imap_init(void)
 {
        CtdlRegisterServiceHook(config.c_imap_port,
-                               NULL, imap_greeting, imap_command_loop);
+                               NULL, imap_greeting, imap_command_loop, NULL);
        CtdlRegisterSessionHook(imap_cleanup_function, EVT_STOP);
        return "$Id$";
 }