]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/blog/serv_blog.c
Route all access to cm_fields[] through api functions
[citadel.git] / citadel / modules / blog / serv_blog.c
index 5459898f759095115fb06af6877b9d322d2efbb9..a6513e775cab8f93e5a2aff0ff97cd496b072646 100644 (file)
@@ -72,13 +72,18 @@ int blog_upload_beforesave(struct CtdlMessage *msg) {
        /* 
         * If the message doesn't have an EUID, give it one.
         */
-       if (msg->cm_fields['E'] == NULL)
+       if (msg->cm_fields[eExclusiveID] == NULL)
        {
-               char uuid[37];
+               char uuid[SIZ];
                generate_uuid(uuid);
-               msg->cm_fields['E'] = strdup(uuid);
+               CM_SetField(msg, eExclusiveID, uuid, strlen(uuid));
        }
 
+       /*
+        * We also want to define a maximum length, whether we generated it or not.
+        */
+       CM_CutFieldAt(msg, eExclusiveID, BLOG_EUIDBUF_SIZE - 1);
+       
        /* Now allow the save to complete. */
        return(0);
 }