Revert "Change to blog euid storage; note new definition in libcitadel.h"
authorArt Cancro <ajc@uncensored.citadel.org>
Mon, 23 May 2011 21:50:53 +0000 (17:50 -0400)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 4 Sep 2011 20:51:39 +0000 (20:51 +0000)
This reverts commit 6d51b9ea0e3670d8ac52cc183e5ac0bcd3f3f2d6.

citadel/modules/blog/serv_blog.c
libcitadel/lib/libcitadel.h
webcit/blogview_renderer.c

index fb95d613b4a1fc2a2df963a686a31f15d6bb15d0..5459898f759095115fb06af6877b9d322d2efbb9 100644 (file)
@@ -74,18 +74,11 @@ int blog_upload_beforesave(struct CtdlMessage *msg) {
         */
        if (msg->cm_fields['E'] == NULL)
        {
-               char uuid[BLOG_EUIDBUF_SIZE];
+               char uuid[37];
                generate_uuid(uuid);
                msg->cm_fields['E'] = strdup(uuid);
        }
 
-       /*
-        * We also want to define a maximum length, whether we generated it or not.
-        */
-       else if (strlen(msg->cm_fields['E']) >= BLOG_EUIDBUF_SIZE) {
-               msg->cm_fields['E'][BLOG_EUIDBUF_SIZE-1] = 0;
-       }
-
        /* Now allow the save to complete. */
        return(0);
 }
index 13737c39c797b6c2547f8d0cc402558a133a2f90..f47c4a24106f9c6b998563a9355be1c5a5aeee95 100644 (file)
@@ -89,7 +89,6 @@ typedef enum _room_views {
        VIEW_MAX
 } ROOM_VIEWS;
 
-#define BLOG_EUIDBUF_SIZE      40
 
 #ifndef IsEmptyStr
 #define IsEmptyStr(a) ((a)[0] == '\0')
index 25af87053da59a37b5cea43618f5dba5cb122ac9..8190cb8c8ddca9a1b7b6f2c16d85bfad989a058f 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * Blog view renderer module for WebCit
  *
- * Copyright (c) 1996-2011 by the citadel.org team
+ * Copyright (c) 1996-2010 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 as
@@ -87,7 +87,7 @@ void blogpost_render_and_destroy(struct blogpost *bp) {
 struct bltr {
        int id;
        int refs;
-       char euid[BLOG_EUIDBUF_SIZE];   /* please do not change this to a StrBuf */
+       StrBuf *euid;
 };
 
 
@@ -124,7 +124,7 @@ struct bltr blogview_learn_thread_references(long msgnum)
        StrBuf *Buf;
        StrBuf *r;
        int len;
-       struct bltr bltr = { 0, 0, "" } ;
+       struct bltr bltr = { 0, 0, NULL };
        Buf = NewStrBuf();
        r = NewStrBuf();
        serv_printf("MSG0 %ld|1", msgnum);              /* top level citadel headers only */
@@ -145,7 +145,7 @@ struct bltr blogview_learn_thread_references(long msgnum)
                        }
                        else if (!strncasecmp(ChrPtr(Buf), "exti=", 5)) {
                                StrBufCutLeft(Buf, 5);          /* trim the field name */
-                               safestrncpy(bltr.euid, ChrPtr(Buf), sizeof(bltr.euid));
+                               bltr.euid = NewStrBufDup(Buf);
                        }
                }
        }
@@ -170,8 +170,9 @@ int blogview_LoadMsgFromServer(SharedMessageStatus *Stat,
 
        b = blogview_learn_thread_references(Msg->msgnum);
 
-       if (!IsEmptyStr(b.euid)) {
-               syslog(LOG_DEBUG, "\033[7m%s\033[0m", b.euid);
+       if (b.euid != NULL) {
+               syslog(LOG_DEBUG, "\033[7m%s\033[0m", ChrPtr(b.euid));
+               FreeStrBuf(&b.euid);
        }
 
        /* FIXME an optimization here -- one we ought to perform -- is to exit this