]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/imap/imap_misc.c
Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel
[citadel.git] / citadel / modules / imap / imap_misc.c
index e7b3d69fe73a204bea2a2695410261c87c9fa40d..f4d501c9d3853dd56c8895e804ac0c5d943755ea 100644 (file)
@@ -52,6 +52,7 @@
 #include "user_ops.h"
 #include "database.h"
 #include "msgbase.h"
+#include "room_ops.h"
 #include "internet_addressing.h"
 #include "serv_imap.h"
 #include "imap_tools.h"
@@ -305,7 +306,7 @@ void imap_append(int num_parms, ConstStr *Params) {
                return;
        }
 
-       strcpy(new_message_flags, "");
+       *new_message_flags = '\0';
        if (num_parms >= 5) {
                for (i=3; i<num_parms; ++i) {
                        strcat(new_message_flags, Params[i].Key);
@@ -371,9 +372,9 @@ 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);
+       CtdlUserGoto(roomname, 0, 0, &msgs, &new, NULL, NULL);
 
        /* If the user is locally authenticated, FORCE the From: header to
         * show up as the real sender.  FIXME do we really want to do this?
@@ -382,14 +383,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, CFG_KEY(c_nodename));
+               CM_SetField(msg, eHumanNode, CFG_KEY(c_humannode));
            }
        }
 
@@ -425,13 +424,13 @@ void imap_append(int num_parms, ConstStr *Params) {
         * our happy day without violent explosions.
         */
        if (Imap->selected) {
-               CtdlUserGoto(savedroom, 0, 0, &msgs, &new);
+               CtdlUserGoto(savedroom, 0, 0, &msgs, &new, NULL, NULL);
        }
 
        /* We don't need this buffer anymore */
-       CtdlFreeMessage(msg);
+       CM_Free(msg);
 
-       if (new_message_flags != NULL) {
+       if (IsEmptyStr(new_message_flags)) {
                imap_do_append_flags(new_msgnum, new_message_flags);
        }
 }