]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/imap/imap_misc.c
refactor naming of core message manipulation funcions
[citadel.git] / citadel / modules / imap / imap_misc.c
index 3ccd463671ac8b20d26d7a055ef60196301bdeb6..14d2396c7e54480329f006906ca78abb620f0fa2 100644 (file)
@@ -280,6 +280,7 @@ void imap_do_append_flags(long new_msgnum, char *new_message_flags) {
  * This function is called by the main command loop.
  */
 void imap_append(int num_parms, ConstStr *Params) {
+       struct CitContext *CCC = CC;
        long literal_length;
        struct CtdlMessage *msg = NULL;
        long new_msgnum = (-1L);
@@ -353,10 +354,10 @@ void imap_append(int num_parms, ConstStr *Params) {
        client_getln(dummy, sizeof dummy);
 
        /* Convert RFC822 newlines (CRLF) to Unix newlines (LF) */
-       syslog(LOG_DEBUG, "Converting CRLF to LF");
+       IMAPM_syslog(LOG_DEBUG, "Converting CRLF to LF");
        StrBufToUnixLF(Imap->TransmittedMessage);
 
-       syslog(LOG_DEBUG, "Converting message format");
+       IMAPM_syslog(LOG_DEBUG, "Converting message format");
        msg = convert_internet_message_buf(&Imap->TransmittedMessage);
 
        ret = imap_grabroom(roomname, Params[2].Key, 1);
@@ -370,7 +371,7 @@ void imap_append(int num_parms, ConstStr *Params) {
         * folder is selected, save its name so we can return there!!!!!)
         */
        if (Imap->selected) {
-               strcpy(savedroom, CC->room.QRname);
+               strcpy(savedroom, CCC->room.QRname);
        }
        CtdlUserGoto(roomname, 0, 0, &msgs, &new);
 
@@ -381,14 +382,12 @@ void imap_append(int num_parms, ConstStr *Params) {
         * For now, we allow "forgeries" if the room is one of the user's
         * private mailboxes.
         */
-       if (CC->logged_in) {
-          if ( ((CC->room.QRflags & QR_MAILBOX) == 0) && (config.c_imap_keep_from == 0)) {
-               if (msg->cm_fields['A'] != NULL) free(msg->cm_fields['A']);
-               if (msg->cm_fields['N'] != NULL) free(msg->cm_fields['N']);
-               if (msg->cm_fields['H'] != NULL) free(msg->cm_fields['H']);
-               msg->cm_fields['A'] = strdup(CC->user.fullname);
-               msg->cm_fields['N'] = strdup(config.c_nodename);
-               msg->cm_fields['H'] = strdup(config.c_humannode);
+       if (CCC->logged_in) {
+          if ( ((CCC->room.QRflags & QR_MAILBOX) == 0) && (config.c_imap_keep_from == 0)) {
+
+               CM_SetField(msg, eAuthor, CCC->user.fullname, strlen(CCC->user.fullname));
+               CM_SetField(msg, eNodeName, config.c_nodename, strlen(config.c_nodename));
+               CM_SetField(msg, eHumanNode, config.c_humannode, strlen(config.c_humannode));
            }
        }
 
@@ -428,7 +427,7 @@ void imap_append(int num_parms, ConstStr *Params) {
        }
 
        /* We don't need this buffer anymore */
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
        if (new_message_flags != NULL) {
                imap_do_append_flags(new_msgnum, new_message_flags);