]> code.citadel.org Git - citadel.git/blobdiff - webcit/blogview_renderer.c
Change to blog euid storage; note new definition in libcitadel.h
[citadel.git] / webcit / blogview_renderer.c
index 9a93a686cad02040d30600c70a8299acef35d649..25af87053da59a37b5cea43618f5dba5cb122ac9 100644 (file)
@@ -1,7 +1,7 @@
 /* 
  * Blog view renderer module for WebCit
  *
- * Copyright (c) 1996-2010 by the citadel.org team
+ * Copyright (c) 1996-2011 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,6 +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 */
 };
 
 
@@ -122,13 +123,17 @@ struct bltr blogview_learn_thread_references(long msgnum)
 {
        StrBuf *Buf;
        StrBuf *r;
-       struct bltr bltr = { 0, 0 } ;
+       int len;
+       struct bltr bltr = { 0, 0, "" } ;
        Buf = NewStrBuf();
        r = NewStrBuf();
        serv_printf("MSG0 %ld|1", msgnum);              /* top level citadel headers only */
        StrBuf_ServGetln(Buf);
        if (GetServerStatus(Buf, NULL) == 1) {
-               while (StrBuf_ServGetln(Buf), strcmp(ChrPtr(Buf), "000")) {
+               while (len = StrBuf_ServGetln(Buf), 
+                      ((len >= 0) && 
+                       ((len != 3) || strcmp(ChrPtr(Buf), "000") )))
+               {
                        if (!strncasecmp(ChrPtr(Buf), "msgn=", 5)) {
                                StrBufCutLeft(Buf, 5);
                                bltr.id = HashLittle(ChrPtr(Buf), StrLength(Buf));
@@ -138,6 +143,10 @@ 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 */
+                               safestrncpy(bltr.euid, ChrPtr(Buf), sizeof(bltr.euid));
+                       }
                }
        }
        FreeStrBuf(&Buf);
@@ -161,6 +170,10 @@ 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);
+       }
+
        /* 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*