]> code.citadel.org Git - citadel.git/blobdiff - citadel/msgbase.c
* Wrote enough of the SMTP sender to get Patriot drooling over it, but not
[citadel.git] / citadel / msgbase.c
index 755743d19313e7a25af36fb95cce813317281754..867ff964a8b57089e965ffb2a66b42aca2b054f3 100644 (file)
@@ -1533,7 +1533,6 @@ long CtdlSaveMsg(struct CtdlMessage *msg, /* message to save */
        static int seqnum = 1;
        struct CtdlMessage *imsg;
        char *instr;
-       long imsgid;
 
        lprintf(9, "CtdlSaveMsg() called\n");
        if (is_valid_message(msg) == 0) return(-1);     /* self check */
@@ -1627,8 +1626,16 @@ long CtdlSaveMsg(struct CtdlMessage *msg,        /* message to save */
        }
 
        lprintf(9, "Possibly relocating\n");
-       if (strcasecmp(actual_rm, CC->quickroom.QRname))
+       if (strcasecmp(actual_rm, CC->quickroom.QRname)) {
                getroom(&CC->quickroom, actual_rm);
+       }
+
+       /*
+        * If this message has no O (room) field, generate one.
+        */
+       if (msg->cm_fields['O'] == NULL) {
+               msg->cm_fields['O'] = strdoop(CC->quickroom.QRname);
+       }
 
        /* Perform "before save" hooks (aborting if any return nonzero) */
        lprintf(9, "Performing before-save hooks\n");
@@ -1728,13 +1735,9 @@ long CtdlSaveMsg(struct CtdlMessage *msg,        /* message to save */
                imsg->cm_magic = CTDLMESSAGE_MAGIC;
                imsg->cm_anon_type = MES_NORMAL;
                imsg->cm_format_type = FMT_RFC822;
+               imsg->cm_fields['A'] = strdoop("Citadel");
                imsg->cm_fields['M'] = instr;
-               imsgid = send_message(imsg, 1, NULL);
-               if (imsgid >= 0L) {
-                       CtdlSaveMsgPointerInRoom(SMTP_SPOOLOUT_ROOM,
-                                               imsgid,
-                                               SM_DONT_BUMP_REF);
-               }
+               CtdlSaveMsg(imsg, "", SMTP_SPOOLOUT_ROOM, MES_LOCAL, 1);
                CtdlFreeMessage(imsg);
        }