]> code.citadel.org Git - citadel.git/blobdiff - citadel/modules/blog/serv_blog.c
use an Enum for the cm_fields vector instead of nameless chars
[citadel.git] / citadel / modules / blog / serv_blog.c
index 5459898f759095115fb06af6877b9d322d2efbb9..4424d46b89d255f5f07a8eae9b9ae51a1eff1b9f 100644 (file)
@@ -72,11 +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[BLOG_EUIDBUF_SIZE];
                generate_uuid(uuid);
-               msg->cm_fields['E'] = strdup(uuid);
+               msg->cm_fields[eExclusiveID] = strdup(uuid);
+       }
+
+       /*
+        * We also want to define a maximum length, whether we generated it or not.
+        */
+       else if (strlen(msg->cm_fields[eExclusiveID]) >= BLOG_EUIDBUF_SIZE) {
+               msg->cm_fields[eExclusiveID][BLOG_EUIDBUF_SIZE-1] = 0;
        }
 
        /* Now allow the save to complete. */