From: Art Cancro Date: Tue, 27 Oct 2009 15:40:27 +0000 (+0000) Subject: * Added the code to let display_wiki_page_backend() know when it's expected to fetch... X-Git-Tag: v7.86~694 X-Git-Url: https://code.citadel.org/?p=citadel.git;a=commitdiff_plain;h=090d68398dee252c7001c1f71d536b5859dfd0c6 * Added the code to let display_wiki_page_backend() know when it's expected to fetch a specific revision of a wiki page. Stopped cold dead when I realized that it's going to be practically impossible to supply read_message() with anything other than a message number. --- diff --git a/webcit/messages.c b/webcit/messages.c index f2b1e1c11..3e0049656 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -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; diff --git a/webcit/wiki.c b/webcit/wiki.c index 0d94c7d85..f0287eb06 100644 --- a/webcit/wiki.c +++ b/webcit/wiki.c @@ -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; }