Revert "Generate UUID in blog posts to be used in permalinks"
authorArt Cancro <ajc@uncensored.citadel.org>
Mon, 23 May 2011 21:50:59 +0000 (17:50 -0400)
committerWilfried Goesgens <dothebart@citadel.org>
Sun, 4 Sep 2011 20:51:47 +0000 (20:51 +0000)
This reverts commit fbeca38240b0a9771dc3c5349877e42768900025.

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

index 5459898f759095115fb06af6877b9d322d2efbb9..6997a057e48548fd2597b7691900ce616318d4dd 100644 (file)
@@ -1,11 +1,11 @@
 /*
  * Support for blog rooms
  *
- * Copyright (c) 1999-2011 by the citadel.org team
+ * Copyright (c) 1999-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 published
- * by the Free Software Foundation; either version 3 of the License, or
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
@@ -15,7 +15,7 @@
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
 #include "sysdep.h"
 #include "ctdl_module.h"
 
 /*
- * Pre-save hook for saving a message in a blog room.
- * (Do we want to only do this for top-level messages?)
+ * sd sdhfksdjhkjsdfhk jsdhfkjsdfhkjsd hkfjhsdkjfhsdkjfhksdjfhsd
  */
 int blog_upload_beforesave(struct CtdlMessage *msg) {
+       char buf[SIZ];
 
        /* Only run this hook for blog rooms */
        if (CC->room.QRdefaultview != VIEW_BLOG) {
@@ -72,11 +72,10 @@ 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['E'] != NULL)
        {
-               char uuid[37];
-               generate_uuid(uuid);
-               msg->cm_fields['E'] = strdup(uuid);
+               generate_uuid(buf);
+               msg->cm_fields['E'] = strdup(buf);
        }
 
        /* Now allow the save to complete. */
index 0c012e7955e184d128b589ad547b1bf645ebb767..db8fe3af8f2809f79c1b78808c86bd547a18d7fd 100644 (file)
@@ -858,11 +858,8 @@ char *strcpy(char *dest, const char *src) {
  * Generate a new, globally unique UID parameter for a calendar etc. object
  */
 void generate_uuid(char *buf) {
-       static int seq = (-1);
+       static int seq = 0;
 
-       if (seq == (-1)) {
-               seq = (int)rand();
-       }
        ++seq;
        seq = (seq % 0x0FFF) ;
 
index 8190cb8c8ddca9a1b7b6f2c16d85bfad989a058f..215fa94ef222726e6228493cf314ab78b67b37ea 100644 (file)
@@ -87,7 +87,6 @@ void blogpost_render_and_destroy(struct blogpost *bp) {
 struct bltr {
        int id;
        int refs;
-       StrBuf *euid;
 };
 
 
@@ -124,7 +123,7 @@ struct bltr blogview_learn_thread_references(long msgnum)
        StrBuf *Buf;
        StrBuf *r;
        int len;
-       struct bltr bltr = { 0, 0, NULL };
+       struct bltr bltr = { 0, 0 } ;
        Buf = NewStrBuf();
        r = NewStrBuf();
        serv_printf("MSG0 %ld|1", msgnum);              /* top level citadel headers only */
@@ -143,10 +142,6 @@ struct bltr blogview_learn_thread_references(long msgnum)
                                StrBufExtract_token(r, Buf, 0, '|');
                                bltr.refs = HashLittle(ChrPtr(r), StrLength(r));
                        }
-                       else if (!strncasecmp(ChrPtr(Buf), "exti=", 5)) {
-                               StrBufCutLeft(Buf, 5);          /* trim the field name */
-                               bltr.euid = NewStrBufDup(Buf);
-                       }
                }
        }
        FreeStrBuf(&Buf);
@@ -170,11 +165,6 @@ int blogview_LoadMsgFromServer(SharedMessageStatus *Stat,
 
        b = blogview_learn_thread_references(Msg->msgnum);
 
-       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
         * function immediately if the viewer is only interested in a single post and
         * that message ID is neither the id nor the refs.  Actually, that might *be*