* Added the code to let display_wiki_page_backend() know when it's expected to fetch...
authorArt Cancro <ajc@citadel.org>
Tue, 27 Oct 2009 15:40:27 +0000 (15:40 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 27 Oct 2009 15:40:27 +0000 (15:40 +0000)
webcit/messages.c
webcit/wiki.c

index f2b1e1c11c0f334ef1835687ffd0bb5df03ba008..3e00496567e69794273886aa16fa709e0f71edf7 100644 (file)
@@ -230,11 +230,12 @@ int read_message(StrBuf *Target, const char *tmpl, long tmpllen, long msgnum, co
                FreeStrBuf(&Error);
        }
 
-       /* strip the bare contenttype, so we ommit charset etc. */
+       /* Extract just the content-type (omit attributes such as "charset") */
        StrBufExtract_token(Buf, Msg->MsgBody->ContentType, 0, ';');
        StrBufTrim(Buf);
        StrBufLowerCase(Buf);
-       /* look up the renderer, that will convert this mimeitem into the htmlized form */
+
+       /* Locate a renderer capable of converting this MIME part into HTML */
        if (GetHash(MimeRenderHandler, SKEY(Buf), &vHdr) &&
            (vHdr != NULL)) {
                RenderMimeFuncStruct *Render;
index 0d94c7d854c3e84c5b62d6a7eaa1631c2fe74ad7..f0287eb0667c028c35824e465e54b9488e533d87 100644 (file)
@@ -31,8 +31,10 @@ void str_wiki_index(char *s)
 
 /*
  * Display a specific page from a wiki room
+ *
+ * "rev" may be set to an empty string to display the current version.
  */
-void display_wiki_page_backend(const StrBuf *roomname, char *pagename)
+void display_wiki_page_backend(const StrBuf *roomname, char *pagename, char *rev)
 {
        const StrBuf *Mime;
        long msgnum = (-1L);
@@ -63,7 +65,7 @@ void display_wiki_page_backend(const StrBuf *roomname, char *pagename)
                strcpy(pagename, "home");
        }
 
-       /* Found it!  Now read it. */
+       /* Found it!  Now read it.   FIXME this is where we have to add the ability to read an old rev */
        msgnum = locate_message_by_uid(pagename);
        if (msgnum >= 0L) {
                read_message(WC->WBuf, HKEY("view_message"), msgnum, NULL, &Mime);
@@ -92,11 +94,13 @@ void display_wiki_page(void)
 {
        const StrBuf *roomname;
        char pagename[128];
+       char rev[128];
 
        output_headers(1, 1, 1, 0, 0, 0);
        roomname = sbstr("room");
        safestrncpy(pagename, bstr("page"), sizeof pagename);
-       display_wiki_page_backend(roomname, pagename);
+       safestrncpy(rev, bstr("rev"), sizeof rev);
+       display_wiki_page_backend(roomname, pagename, rev);
        wDumpContent(1);
 }
 
@@ -215,7 +219,7 @@ int wiki_Cleanup(void **ViewSpecific)
 {
        char pagename[5];
        safestrncpy(pagename, "home", sizeof pagename);
-       display_wiki_page_backend(WC->wc_roomname, pagename);
+       display_wiki_page_backend(WC->wc_roomname, pagename, "");
        wDumpContent(1);
        return 0;
 }