Permalinks work now but they are ugly.
authorArt Cancro <ajc@citadel.org>
Mon, 22 Nov 2010 04:58:33 +0000 (23:58 -0500)
committerArt Cancro <ajc@citadel.org>
Mon, 22 Nov 2010 04:58:33 +0000 (23:58 -0500)
webcit/blogview_renderer.c
webcit/webcit.h

index 164c7539563fb542bded28a0e1a2254708786346..fa7403e7147897e2df9abf4e48245c70c8f7053d 100644 (file)
@@ -45,6 +45,7 @@ void blogpost_render_and_destroy(struct blogpost *bp) {
        int i;
 
        p = atoi(BSTR("p"));    /* are we looking for a specific post? */
+       WC->bptlid = bp->top_level_id;
 
        if ( ((p == 0) || (p == bp->top_level_id)) && (bp->num_msgs > 0) ) {
                /* Show the top level post */
@@ -244,16 +245,12 @@ int blogview_Cleanup(void **ViewSpecific)
  *
  */
 void tmplput_blog_permalink(StrBuf *Target, WCTemplputParams *TP) {
-       int p = atoi(BSTR("p"));        /* are we looking for a specific post? */
        char perma[SIZ];
        char encoded_perma[SIZ];
        
        strcpy(perma, "/readfwd?gotofirst=");
        urlesc(&perma[strlen(perma)], sizeof(perma)-strlen(perma), ChrPtr(WC->CurRoom.name));
-
-       if (p != 0) {
-               snprintf(&perma[strlen(perma)], sizeof(perma)-strlen(perma), "?p=%d", p);
-       }
+       snprintf(&perma[strlen(perma)], sizeof(perma)-strlen(perma), "?p=%d", WC->bptlid);
 
        CtdlEncodeBase64(encoded_perma, perma, strlen(perma), 0);
        StrBufAppendPrintf(Target, "/B64%s", encoded_perma);
index 163830c4698d4d1099ff5410d4179aea39a53be3..ef7c2c456ccc9367dba6a99820521a9ad1620376 100644 (file)
@@ -563,6 +563,9 @@ struct wcsession {
        HashList *ServCfg;                      /* cache our server config for editing */
        HashList *InetCfg;                      /* Our inet server config for editing */
        ExpirePolicy Policy[maxpolicy];
+
+/* used by the blog viewer */
+       int bptlid;                             /* hash of thread currently being rendered */
 };