]> code.citadel.org Git - citadel.git/blobdiff - webcit/messages.c
* The 'Search' box now works properly in a Wiki room.
[citadel.git] / webcit / messages.c
index f2b1e1c11c0f334ef1835687ffd0bb5df03ba008..53b5b9eb6b15c57d70f540767da4f8066b85cd84 100644 (file)
@@ -63,7 +63,7 @@ int load_message(message_summary *Msg,
 
        /* begin everythingamundo table */
        HdrToken = NewStrBuf();
-       while ((StrBuf_ServGetln(Buf)>=0) && !Done) {
+       while (!Done && StrBuf_ServGetln(Buf)>=0) {
                if ( (StrLength(Buf)==3) && 
                    !strcmp(ChrPtr(Buf), "000")) 
                {
@@ -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;
@@ -750,7 +751,7 @@ typedef struct _RoomRenderer{
 /*
  * command loop for reading messages
  *
- * Set oper to "readnew" or "readold" or "readfwd" or "headers" or "readgt"
+ * Set oper to "readnew" or "readold" or "readfwd" or "headers" or "readgt" or "do_search"
  */
 void readloop(long oper)
 {
@@ -768,8 +769,14 @@ void readloop(long oper)
        SharedMessageStatus Stat;
        void *ViewSpecific;
 
-       if (havebstr("is_summary") && (1 == (ibstr("is_summary"))))
+       if (havebstr("is_summary") && (1 == (ibstr("is_summary")))) {
                WCC->wc_view = VIEW_MAILBOX;
+       }
+
+       if (WCC->wc_view == VIEW_WIKI) {
+               display_wiki_pagelist();
+               return;
+       }
 
        memset(&Stat, 0, sizeof(SharedMessageStatus));
        Stat.maxload = 10000;
@@ -780,8 +787,9 @@ void readloop(long oper)
                WCC->wc_view = VIEW_BBS;
                GetHash(ReadLoopHandler, IKEY(WCC->wc_view), &vViewMsg);
        }
-       if (vViewMsg == NULL)
-               return;///TODO: print message
+       if (vViewMsg == NULL) {
+               return;                 // TODO: print message
+       }
 
        ViewMsg = (RoomRenderer*) vViewMsg;
        if (!WCC->is_ajax) {
@@ -818,7 +826,7 @@ void readloop(long oper)
        if (Stat.sortit) {
                CompareFunc SortIt;
                memset(&SubTP, 0, sizeof(WCTemplputParams));
-               SubTP.Filter.ContextType = CTX_NONE;
+               SubTP.Filter.ContextType = CTX_MAILSUM;
                SubTP.Context = NULL;
                SortIt =  RetrieveSort(&SubTP, NULL, 0,
                                       HKEY("date"), Stat.defaultsortorder);