Construct the msgid for wiki entries by appending the page
[citadel.git] / citadel / modules / wiki / serv_wiki.c
index 7320a156e94a9e4acdf4e12ee15620561171a826..cc1f9ed2a0eaadcdf255b48b512b8a87587ed4a3 100644 (file)
@@ -90,6 +90,8 @@ int wiki_upload_beforesave(struct CtdlMessage *msg, recptypes *recp) {
        char *diffbuf = NULL;
        size_t diffbuf_len = 0;
        char *ptr = NULL;
+       long newmsgid;
+       StrBuf *msgidbuf;
 
        if (!CCC->logged_in) return(0); /* Only do this if logged in. */
 
@@ -105,6 +107,17 @@ int wiki_upload_beforesave(struct CtdlMessage *msg, recptypes *recp) {
        /* If there's no EUID we can't do this.  Reject the post. */
        if (CM_IsEmpty(msg, eExclusiveID)) return(1);
 
+       newmsgid = get_new_message_number();
+       msgidbuf = NewStrBuf();
+       StrBufPrintf(msgidbuf, "%08lX-%08lX@%s/%s",
+                    (long unsigned int) time(NULL),
+                    (long unsigned int) newmsgid,
+                    CtdlGetConfigStr("c_fqdn"),
+                    msg->cm_fields[eExclusiveID]
+               );
+
+       CM_SetAsFieldSB(msg, emessageId, &msgidbuf);
+
        history_page_len = snprintf(history_page, sizeof history_page,
                                    "%s_HISTORY_", msg->cm_fields[eExclusiveID]);