]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/wiki/serv_wiki.c
More use of %m instead of strerror(errno)
[citadel.git] / citadel / modules / wiki / serv_wiki.c
index 7320a156e94a9e4acdf4e12ee15620561171a826..c415dd97551dbb268c17316aeb621c4a477f7e68 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Server-side module for Wiki rooms.  This handles things like version control. 
  * 
- * Copyright (c) 2009-2015 by the citadel.org team
+ * Copyright (c) 2009-2017 by the citadel.org team
  *
  * This program is open source software.  You can redistribute it and/or
  * modify it under the terms of the GNU General Public License, version 3.
@@ -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]);
 
@@ -549,7 +562,7 @@ void wiki_rev(char *pagename, char *rev, char *operation)
                fclose(fp);
        }
        else {
-               syslog(LOG_ALERT, "Cannot open %s: %s\n", temp, strerror(errno));
+               syslog(LOG_ERR, "%s: %m", temp);
        }
        CM_Free(msg);