Changed how Message-ID RFC2822 field is generated
[citadel.git] / citadel / server / msgbase.c
index b3a8f7071c66a9a3ee651dcc2e9feba089886e68..8582fba301bed1b1f50209c45b5384ec34a04187 100644 (file)
@@ -2011,12 +2011,13 @@ int CtdlOutputPreLoadedMsg(
        }
 
        if (mode == MT_RFC822) {
-               // Construct a fun message id
-               cprintf("Message-ID: <%s", mid);
-               if (strchr(mid, '@')==NULL) {
-                       cprintf("@%s", snode);
-               }
-               cprintf(">%s", nl);
+               // Make the message ID RFC2822 compliant
+               cprintf("Message-ID: <%s%s%s>%s",               // put it in angle brackets
+                       mid,
+                       (strchr(mid, '@') ? "" : "@"),          // if there is no domain part,
+                       (strchr(mid, '@') ? "" : snode),        // tack on ours.
+                       nl
+               );
 
                if (!is_room_aide() && (TheMessage->cm_anon_type == MES_ANONONLY)) {
                        cprintf("From: \"----\" <x@x.org>%s", nl);
@@ -2320,7 +2321,7 @@ long CtdlSaveThisMessage(struct CtdlMessage *msg, long msgid) {
        }
 
        if (error_count > 0) {
-               syslog(LOG_ERR, "msgbase: encountered %d errors storing message %ld", error_count, msgid);
+               syslog(LOG_ERR, "msgbase: encountered %ld errors storing message %ld", error_count, msgid);
        }
 
        // Free the memory we used for the serialized message