Readloop remove special cases
authorWilfried Goesgens <dothebart@citadel.org>
Sat, 18 Feb 2012 16:21:44 +0000 (17:21 +0100)
committerWilfried Goesgens <dothebart@citadel.org>
Sat, 18 Feb 2012 16:21:44 +0000 (17:21 +0100)
  - add handler for initializing the page
  - add parameter to handler GetParamsGetServerCall() so clients can register a list filter to MSG4
  - Json-view: use new initialisation handler to output the headers for the JSon-reply
  - Json-view: don't need the extra member on the session anymore.
  - Json-View: split functions into wrapper page and json list
  - wiki-view: register empty header output handler, since the sub-calls do this later.
  - wiki-view: use the GetParamsGetServerCall()-Callback to hook in our logic instead of tainting readloop() with special code.

23 files changed:
libcitadel/lib/libcitadel.h
webcit/bbsview_renderer.c
webcit/blogview_renderer.c
webcit/calendar.c
webcit/calendar.h
webcit/calendar_view.c
webcit/dav_propfind.c
webcit/dav_report.c
webcit/feed_generator.c
webcit/messages.c
webcit/messages.h
webcit/mk_module_init.sh
webcit/msg_renderers.c
webcit/notes.c
webcit/siteconfig.c
webcit/sitemap.c
webcit/summary.c
webcit/tasks.c
webcit/useredit.c
webcit/vcard_edit.c
webcit/webcit.h
webcit/webserver.c
webcit/wiki.c

index a0a70305a574fc8d45674910de43054463f6d12c..d520eae4c96d8733104465bc58402629ada5b796 100644 (file)
@@ -99,7 +99,8 @@ typedef enum _room_views {
        VIEW_DRAFTS             = 9,    /* Drafts view */
        VIEW_BLOG               = 10,   /* Blog view */
        VIEW_QUEUE              = 11,   /* SMTP/... QUEUE rooms */
-       VIEW_MAX
+       VIEW_MAX,
+       VIEW_JSON_LIST,
 } ROOM_VIEWS;
 
 #define BLOG_EUIDBUF_SIZE      40
index 1406e83c1e08e6a96643c1b63869742f33aa112d..8bed3af37ddae02e57728da12e16119607de7b82 100644 (file)
@@ -81,7 +81,9 @@ int bbsview_GetParamsGetServerCall(SharedMessageStatus *Stat,
                                   void **ViewSpecific, 
                                   long oper, 
                                   char *cmd, 
-                                  long len)
+                                  long len,
+                                  char *filter,
+                                  long flen)
 {
        struct bbsview *BBS = malloc(sizeof(struct bbsview));
        memset(BBS, 0, sizeof(struct bbsview));
@@ -417,6 +419,7 @@ InitModule_BBSVIEWRENDERERS
                VIEW_BBS,
                bbsview_GetParamsGetServerCall,
                NULL,
+               NULL,
                NULL, 
                bbsview_LoadMsgFromServer,
                bbsview_RenderView_or_Tail,
index 60faa89746a579b9c3055f9588fefa34299b3ee5..70fa908ae97b9e787a0c554a1cac6cba6e3d2e55 100644 (file)
@@ -104,7 +104,9 @@ int blogview_GetParamsGetServerCall(SharedMessageStatus *Stat,
                                   void **ViewSpecific, 
                                   long oper, 
                                   char *cmd, 
-                                  long len)
+                                   long len,
+                                   char *filter,
+                                   long flen)
 {
        HashList *BLOG = NewHash(1, NULL);
        *ViewSpecific = BLOG;
@@ -345,6 +347,7 @@ InitModule_BLOGVIEWRENDERERS
                VIEW_BLOG,
                blogview_GetParamsGetServerCall,
                NULL,
+               NULL,
                NULL, 
                blogview_LoadMsgFromServer,
                blogview_render,
index 84493f90f8fbfc22189e1b9373e1945e6c0de1ba..2897ba20188d9a007eeb1623af1fee2709f5e3e7 100644 (file)
@@ -915,6 +915,7 @@ InitModule_CALENDAR
                calendar_GetParamsGetServerCall,
                NULL,
                NULL,
+               NULL,
                calendar_LoadMsgFromServer,
                calendar_RenderView_or_Tail,
                calendar_Cleanup);
@@ -924,6 +925,7 @@ InitModule_CALENDAR
                calendar_GetParamsGetServerCall,
                NULL,
                NULL,
+               NULL,
                calendar_LoadMsgFromServer,
                calendar_RenderView_or_Tail,
                calendar_Cleanup);
index 755d931019a27a7e99b72a2ef4cf18819deddf44..b71786396006194cdf845529dc0803100f20293f 100644 (file)
@@ -62,7 +62,9 @@ int calendar_GetParamsGetServerCall(SharedMessageStatus *Stat,
                                    void **ViewSpecific, 
                                    long oper, 
                                    char *cmd, 
-                                   long len);
+                                   long len,
+                                   char *filter,
+                                   long flen);
 
 int calendar_Cleanup(void **ViewSpecific);
 int __calendar_Cleanup(void **ViewSpecific);
index 6cde0748ed3a6fbb389cc57a3297a863fac985c5..c8820b22c6333092e972889fc79f4bfaae8b7e6f 100644 (file)
@@ -1429,7 +1429,9 @@ int calendar_GetParamsGetServerCall(SharedMessageStatus *Stat,
                                    void **ViewSpecific,
                                    long oper,
                                    char *cmd,
-                                   long len)
+                                   long len,
+                                   char *filter,
+                                   long flen)
 {
        wcsession *WCC = WC;
        calview *c;
index 80efafca4b9c626858374c4ca15ef6240e269e08..66b2063e9139dfc3f1081b4ee9263035d00705ae 100644 (file)
@@ -782,10 +782,12 @@ int ParseMessageListHeaders_EUID(StrBuf *Line,
 }
 
 int DavUIDL_GetParamsGetServerCall(SharedMessageStatus *Stat, 
-                                   void **ViewSpecific, 
-                                   long oper, 
-                                   char *cmd, 
-                                   long len)
+                                  void **ViewSpecific, 
+                                  long oper, 
+                                  char *cmd, 
+                                  long len,
+                                  char *filter,
+                                  long flen)
 {
        Stat->defaultsortorder = 0;
        Stat->sortit = 0;
@@ -825,6 +827,7 @@ InitModule_PROPFIND
        RegisterReadLoopHandlerset(
                eReadEUIDS,
                DavUIDL_GetParamsGetServerCall,
+               NULL,
                NULL, /// TODO: is this right?
                ParseMessageListHeaders_EUID,
                NULL, //// ""
index 33d1683421281b8d339ce4c9d7ed21f934587968..9574a5a660d7732b87bb9895d5992d249ec7eeda 100644 (file)
@@ -86,10 +86,12 @@ extern int ParseMessageListHeaders_EUID(StrBuf *Line,
                                 StrBuf *ConversionBuffer);
 
 extern int DavUIDL_GetParamsGetServerCall(SharedMessageStatus *Stat, 
-                                   void **ViewSpecific, 
-                                   long oper, 
-                                   char *cmd, 
-                                   long len);
+                                         void **ViewSpecific, 
+                                         long oper, 
+                                         char *cmd, 
+                                         long len,
+                                         char *filter,
+                                         long flen);
 
 extern int DavUIDL_RenderView_or_Tail(SharedMessageStatus *Stat, 
                                void **ViewSpecific, 
@@ -107,6 +109,7 @@ InitModule_REPORT
                eReadEUIDS,
                DavUIDL_GetParamsGetServerCall,
                NULL,
+               NULL,
                ParseMessageListHeaders_EUID,
                NULL,
                DavUIDL_RenderView_or_Tail,
index 3c0e06919deb03ed85bd3bbf583a6727324dc0bf..34b721bdd248ec35fd8902a6558e69902d2eb6f5 100644 (file)
@@ -155,7 +155,7 @@ void feed_rss_do_messages(void) {
        Stat.maxload = INT_MAX;
        Stat.lowest_found = (-1);
        Stat.highest_found = (-1);
-       num_msgs = load_msg_ptrs("MSGS ALL", &Stat, NULL);
+       num_msgs = load_msg_ptrs("MSGS ALL", NULL, &Stat, NULL);
        if (num_msgs < 1) return;
 
        i = num_msgs;                                   /* convention is to feed newest-to-oldest */
index 2915ce1480d5b623c2320395ee8e7cad63830c56..6af7002b58a4d29288e74584395559587b5bae67 100644 (file)
@@ -529,7 +529,8 @@ message_summary *ReadOneMessageSummary(StrBuf *RawMessage, const char *DefaultSu
  *
  * servcmd:            the citadel command to send to the citserver
  */
-int load_msg_ptrs(const char *servcmd, 
+int load_msg_ptrs(const char *servcmd,
+                 const char *filter,
                  SharedMessageStatus *Stat, 
                  load_msg_ptrs_detailheaders LH)
 {
@@ -540,6 +541,7 @@ int load_msg_ptrs(const char *servcmd,
        int n;
        int skipit;
        const char *Ptr = NULL;
+       int StatMajor;
 
        Stat->lowest_found = LONG_MAX;
        Stat->highest_found = LONG_MIN;
@@ -552,7 +554,21 @@ int load_msg_ptrs(const char *servcmd,
        Buf = NewStrBuf();
        serv_puts(servcmd);
        StrBuf_ServGetln(Buf);
-       if (GetServerStatus(Buf, NULL) != 1) {
+       StatMajor = GetServerStatus(Buf, NULL);
+       switch (StatMajor) {
+       case 1:
+               break;
+       case 8:
+               if (filter != NULL) {
+                       serv_puts(filter);
+                        serv_puts("000");
+                       break;
+               }
+               /* fall back to empty filter in case of we were fooled... */
+               serv_puts("");
+               serv_puts("000");
+               break;
+       default:
                FreeStrBuf(&Buf);
                return (Stat->nummsgs);
        }
@@ -672,6 +688,8 @@ typedef struct _RoomRenderer{
        int RoomType;
 
        GetParamsGetServerCall_func GetParamsGetServerCall;
+       
+       PrintViewHeader_func PrintPageHeader;
        PrintViewHeader_func PrintViewHeader;
        LoadMsgFromServer_func LoadMsgFromServer;
        RenderView_or_Tail_func RenderView_or_Tail;
@@ -692,6 +710,7 @@ void readloop(long oper, eCustomRoomRenderer ForceRenderer)
        void *vMsg;
        message_summary *Msg;
        char cmd[256] = "";
+       char filter[256] = "";
        int i, r;
        wcsession *WCC = WC;
        HashPos *at;
@@ -705,18 +724,8 @@ void readloop(long oper, eCustomRoomRenderer ForceRenderer)
                WCC->CurRoom.view = VIEW_MAILBOX;
        }
 
-       if (havebstr("is_ajax") && (1 == (ibstr("is_ajax")))) {
-               WCC->is_ajax = 1;
-       }
-
-       if ((oper == do_search) && (WCC->CurRoom.view == VIEW_WIKI)) {
-               display_wiki_pagelist();
-               return;
-       }
-
-       if (WCC->CurRoom.view == VIEW_WIKI) {
-               http_redirect("wiki?page=home");
-               return;
+       if (havebstr("view")) {
+               WCC->CurRoom.view = ibstr("view");
        }
 
        memset(&Stat, 0, sizeof(SharedMessageStatus));
@@ -736,22 +745,23 @@ void readloop(long oper, eCustomRoomRenderer ForceRenderer)
        }
 
        ViewMsg = (RoomRenderer*) vViewMsg;
-       if (!WCC->is_ajax) {
+       if (ViewMsg->PrintPageHeader == NULL)
                output_headers(1, 1, 1, 0, 0, 0);
-       } else if (WCC->CurRoom.view == VIEW_MAILBOX) {
-               jsonMessageListHdr();
-       }
+       else 
+               ViewMsg->PrintPageHeader(&Stat, ViewSpecific);
 
        if (ViewMsg->GetParamsGetServerCall != NULL) {
                r = ViewMsg->GetParamsGetServerCall(
                       &Stat,
                       &ViewSpecific,
                       oper,
-                      cmd, sizeof(cmd)
+                      cmd, sizeof(cmd),
+                      filter, sizeof(filter)
                );
        } else {
                r = 0;
        }
+
        switch(r)
        {
        case 400:
@@ -764,8 +774,12 @@ void readloop(long oper, eCustomRoomRenderer ForceRenderer)
        default:
                break;
        }
-       if (!IsEmptyStr(cmd))
-               Stat.nummsgs = load_msg_ptrs(cmd, &Stat, ViewMsg->LHParse);
+       if (!IsEmptyStr(cmd)) {
+               const char *p = NULL;
+               if (!IsEmptyStr(filter))
+                       p = filter;
+               Stat.nummsgs = load_msg_ptrs(cmd, p, &Stat, ViewMsg->LHParse);
+       }
 
        if (Stat.sortit) {
                CompareFunc SortIt;
@@ -1894,31 +1908,23 @@ void h_do_search(void) { readloop(do_search, eUseDefault);}
 void h_readgt(void) { readloop(readgt, eUseDefault);}
 void h_readlt(void) { readloop(readlt, eUseDefault);}
 
-void jsonMessageListHdr(void) 
-{
-       /* TODO: make a generic function */
-       hprintf("HTTP/1.1 200 OK\r\n");
-       hprintf("Content-type: application/json; charset=utf-8\r\n");
-       hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software));
-       hprintf("Connection: close\r\n");
-       hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
-       begin_burst();
-}
 
 
 /* Output message list in JSON format */
 void jsonMessageList(void) {
+       StrBuf *View = NewStrBuf();
        const StrBuf *room = sbstr("room");
        long oper = (havebstr("query")) ? do_search : readnew;
-       WC->is_ajax = 1; 
+       StrBufPrintf(View, "%d", VIEW_JSON_LIST);
+       putbstr("view", View);; 
        gotoroom(room);
        readloop(oper, eUseDefault);
-       WC->is_ajax = 0;
 }
 
 void RegisterReadLoopHandlerset(
        int RoomType,
        GetParamsGetServerCall_func GetParamsGetServerCall,
+       PrintViewHeader_func PrintPageHeader,
        PrintViewHeader_func PrintViewHeader,
        load_msg_ptrs_detailheaders LH,
        LoadMsgFromServer_func LoadMsgFromServer,
@@ -1932,6 +1938,7 @@ void RegisterReadLoopHandlerset(
 
        Handler->RoomType = RoomType;
        Handler->GetParamsGetServerCall = GetParamsGetServerCall;
+       Handler->PrintPageHeader = PrintPageHeader;
        Handler->PrintViewHeader = PrintViewHeader;
        Handler->LoadMsgFromServer = LoadMsgFromServer;
        Handler->RenderView_or_Tail = RenderView_or_Tail;
index d7eefbda63e415ede2bc8b1b6387b1cbc3a89c7b..a063170e046c0d96ae688b75555f1e36bed785a8 100644 (file)
@@ -147,7 +147,8 @@ typedef struct _SharedMessageStatus {
 
 } SharedMessageStatus;
 
-int load_msg_ptrs(const char *servcmd, 
+int load_msg_ptrs(const char *servcmd,
+                 const char *filter,
                  SharedMessageStatus *Stat, 
                  load_msg_ptrs_detailheaders LH);
 
@@ -155,7 +156,9 @@ typedef int (*GetParamsGetServerCall_func)(SharedMessageStatus *Stat,
                                           void **ViewSpecific, 
                                           long oper, 
                                           char *cmd, 
-                                          long len);
+                                          long len,
+                                          char *filter,
+                                          long flen);
 
 typedef int (*PrintViewHeader_func)(SharedMessageStatus *Stat, void **ViewSpecific);
 
@@ -188,6 +191,13 @@ void RegisterReadLoopHandlerset(
         */
        GetParamsGetServerCall_func GetParamsGetServerCall,
 
+       /**
+        * PrintpageHeader prints the surrounding information like iconbar, header etc.
+        * by default, output_headers() is called.
+        *
+        */
+       PrintViewHeader_func PrintPageHeader,
+
        /**
         * PrintViewHeader is here to print informations infront of your messages.
         * The message list is already loaded & sorted (if) so you can evaluate 
@@ -245,3 +255,14 @@ int ParseMessageListHeaders_Detail(StrBuf *Line,
 
 
 
+/**
+ * @brief function to register the availability to render a specific message
+ * @param HeaderName Mimetype we know howto display
+ * @param HdrNLen length...
+ * @param InlineRenderable Should we announce to citserver that we want to receive these mimeparts immediately?
+ * @param Priority if multipart/alternative; which mimepart/Renderer should be prefered? (only applies if InlineRenderable)
+ */
+void RegisterMimeRenderer(const char *HeaderName, long HdrNLen, 
+                         RenderMimeFunc MimeRenderer,
+                         int InlineRenderable,
+                         int Priority);
index 95325dcb2447532d6c7cb6baeb8091226000d457..ae1cd375133a4c594c57fc073610fed36459eab6 100755 (executable)
@@ -34,6 +34,7 @@ rm -f $C_FILE $H_FILE
 # server lifetime:
 START_FUNCS=`grep ServerStartModule_ *.c |sed "s;.*:;;" |sort -u`
 INIT_FUNCS=`grep InitModule_ *.c |sed "s;.*:;;" |sort -u`
+INIT2_FUNCS=`grep InitModule2_ *.c |sed "s;.*:;;" |sort -u`
 FINALIZE_FUNCS=`grep FinalizeModule_ *.c |sed "s;.*:;;" |sort -u`
 SHUTDOWN_FUNCS=`grep ServerShutdownModule_ *.c |sed "s;.*:;;" |sort -u`
 
@@ -68,6 +69,7 @@ extern size_t nSizErrmsg;
  * server lifetime: 
  */
 void initialise_modules (void);
+void initialise2_modules (void);
 void start_modules (void);
 void shutdown_modules (void);
 
@@ -197,6 +199,36 @@ extern void $HOOK(void);
 EOF
 done
 
+#********************************************************************************
+# server module  ******** initialisation ********  second stage.
+#********************************************************************************
+cat <<EOF >> $H_FILE
+
+/* Server Init Hooks: */
+EOF
+
+cat <<EOF  >>$C_FILE
+}
+
+
+void initialise2_modules (void)
+{
+
+EOF
+for HOOK in $INIT2_FUNCS; do
+    HOOKNAME=`echo $HOOK |sed "s;InitModule2_;;"`
+# Add this entry point to the .c file
+    cat <<EOF >> $C_FILE
+#ifdef DBG_PRINNT_HOOKS_AT_START
+       syslog(CTDL_INFO, "Initializing $HOOKNAME\n");
+#endif
+       $HOOK();
+EOF
+# Add this entry point to the .h file
+    cat <<EOF >> $H_FILE
+extern void $HOOK(void);
+EOF
+done
 
 
 
index 8255449cab317b5373c36b7aea9c184c14a20b7c..c5af544928774e9e11be62961bc69f7df997caf3 100644 (file)
@@ -1367,59 +1367,83 @@ int ParseMessageListHeaders_Detail(StrBuf *Line,
        return 1;
 }
 
-/* Spit out the new summary view. This is basically a static page, so clients can cache the layout, all the dirty work is javascript :) */
-void new_summary_view(void) {
-       DoTemplate(HKEY("msg_listview"),NULL,&NoCtx);
-}
-
 
 int mailview_GetParamsGetServerCall(SharedMessageStatus *Stat, 
                                    void **ViewSpecific, 
                                    long oper, 
                                    char *cmd, 
-                                   long len)
-{
-       if (!WC->is_ajax) {
-               new_summary_view();
-               return 200;
-       } else {
-               Stat->defaultsortorder = 2;
-               Stat->sortit = 1;
-               Stat->load_seen = 1;
-               /* Generally using maxmsgs|startmsg is not required
-                  in mailbox view, but we have a 'safemode' for clients
-                  (*cough* Exploder) that simply can't handle too many */
-               if (havebstr("maxmsgs"))  Stat->maxmsgs  = ibstr("maxmsgs");
-               else                      Stat->maxmsgs  = 9999999;
-               if (havebstr("startmsg")) Stat->startmsg = lbstr("startmsg");
-               snprintf(cmd, len, "MSGS %s|%s||1",
-                        (oper == do_search) ? "SEARCH" : "ALL",
-                        (oper == do_search) ? bstr("query") : ""
-                       );
-       }
+                                   long len,
+                                   char *filter,
+                                   long flen)
+{
+       DoTemplate(HKEY("msg_listview"),NULL,&NoCtx);
+
        return 200;
 }
 
-int mailview_RenderView_or_Tail(SharedMessageStatus *Stat, 
+int mailview_Cleanup(void **ViewSpecific)
+{
+       /* Note: wDumpContent() will output one additional </div> tag. */
+       /* We ought to move this out into template */
+       wDumpContent(1);
+
+       return 0;
+}
+
+
+int json_GetParamsGetServerCall(SharedMessageStatus *Stat, 
                                void **ViewSpecific, 
-                               long oper)
+                               long oper, 
+                               char *cmd, 
+                               long len,
+                               char *filter,
+                               long flen)
+{
+       Stat->defaultsortorder = 2;
+       Stat->sortit = 1;
+       Stat->load_seen = 1;
+       /* Generally using maxmsgs|startmsg is not required
+          in mailbox view, but we have a 'safemode' for clients
+          (*cough* Exploder) that simply can't handle too many */
+       if (havebstr("maxmsgs"))  Stat->maxmsgs  = ibstr("maxmsgs");
+       else                      Stat->maxmsgs  = 9999999;
+       if (havebstr("startmsg")) Stat->startmsg = lbstr("startmsg");
+       snprintf(cmd, len, "MSGS %s|%s||1",
+                (oper == do_search) ? "SEARCH" : "ALL",
+                (oper == do_search) ? bstr("query") : ""
+               );
+
+       return 200;
+}
+int json_MessageListHdr(SharedMessageStatus *Stat, void **ViewSpecific) 
+{
+       /* TODO: make a generic function */
+       hprintf("HTTP/1.1 200 OK\r\n");
+       hprintf("Content-type: application/json; charset=utf-8\r\n");
+       hprintf("Server: %s / %s\r\n", PACKAGE_STRING, ChrPtr(WC->serv_info->serv_software));
+       hprintf("Connection: close\r\n");
+       hprintf("Pragma: no-cache\r\nCache-Control: no-store\r\nExpires:-1\r\n");
+       begin_burst();
+       return 0;
+}
+
+int json_RenderView_or_Tail(SharedMessageStatus *Stat, 
+                           void **ViewSpecific, 
+                           long oper)
 {
        WCTemplputParams SubTP;
 
-       if (WC->is_ajax)
-               DoTemplate(HKEY("mailsummary_json"),NULL, &SubTP);
+       memset(&SubTP, 0, sizeof(WCTemplputParams));
+       DoTemplate(HKEY("mailsummary_json"),NULL, &SubTP);
        
        return 0;
 }
 
-int mailview_Cleanup(void **ViewSpecific)
+int json_Cleanup(void **ViewSpecific)
 {
        /* Note: wDumpContent() will output one additional </div> tag. */
        /* We ought to move this out into template */
-       if (WC->is_ajax)
-               end_burst();
-       else
-               wDumpContent(1);
+       end_burst();
 
        return 0;
 }
@@ -1434,11 +1458,22 @@ InitModule_MSGRENDERERS
                VIEW_MAILBOX,
                mailview_GetParamsGetServerCall,
                NULL, /* TODO: is this right? */
+               NULL,
                ParseMessageListHeaders_Detail,
                NULL,
-               mailview_RenderView_or_Tail,
+               NULL,
                mailview_Cleanup);
 
+       RegisterReadLoopHandlerset(
+               VIEW_JSON_LIST,
+               json_GetParamsGetServerCall,
+               json_MessageListHdr,
+               NULL, /* TODO: is this right? */
+               ParseMessageListHeaders_Detail,
+               NULL,
+               json_RenderView_or_Tail,
+               json_Cleanup);
+
        RegisterSortFunc(HKEY("date"), 
                         NULL, 0,
                         summcmp_date,
@@ -1540,8 +1575,6 @@ InitModule_MSGRENDERERS
        RegisterMimeRenderer(HKEY("text"), render_MAIL_text_plain, 1, 1);
        RegisterMimeRenderer(HKEY("text/html"), render_MAIL_html, 1, 100);
        RegisterMimeRenderer(HKEY(""), render_MAIL_UNKNOWN, 0, 0);
-       /* and finalize the anouncement to the server... */
-       CreateMimeStr();
 
        /* these headers are citserver replies to MSG4 and friends. one evaluator for each */
        RegisterMsgHdr(HKEY("nhdr"), examine_nhdr, 0);
@@ -1572,6 +1605,13 @@ InitModule_MSGRENDERERS
        RegisterMsgHdr(HKEY("path"), examine_path, 0);
 }
 
+void 
+InitModule2_MSGRENDERERS
+(void)
+{
+       /* and finalize the anouncement to the server... */
+       CreateMimeStr();
+}
 void 
 ServerStartModule_MSGRENDERERS
 (void)
index 31000fd7eb8bc98721beb0cd45d0fc8658caf0ae..d9d0ebf65b4867dcf869f529bd618e241c2fc021 100644 (file)
@@ -416,7 +416,9 @@ int notes_GetParamsGetServerCall(SharedMessageStatus *Stat,
                                 void **ViewSpecific, 
                                 long oper, 
                                 char *cmd, 
-                                long len)
+                                long len,
+                                char *filter,
+                                long flen)
 {
        strcpy(cmd, "MSGS ALL");
        Stat->maxmsgs = 32767;
@@ -441,6 +443,7 @@ InitModule_NOTES
                notes_GetParamsGetServerCall,
                NULL,
                NULL,
+               NULL,
                notes_LoadMsgFromServer,
                NULL,
                notes_Cleanup);
index 2f3d91cb5dcfec2f6b4fd3a66bfad500b1e45a3f..bdc3cc20576c288af5bf7d66b9aa481891f9ecf3 100644 (file)
@@ -209,6 +209,7 @@ CfgMapping ServerConfig[] = {
 };
 
 
+
 /*
  *  display all configuration items
  */
@@ -218,7 +219,7 @@ void load_siteconfig(void)
        StrBuf *Buf;
        HashList *Cfg;
        long len;
-       int i;
+       int i, j;
        
        if (WCC->ServCfg == NULL)
                WCC->ServCfg = NewHash(1, NULL);
@@ -233,40 +234,29 @@ void load_siteconfig(void)
                AppendImportantMessage(SKEY(Buf));
                FreeStrBuf(&Buf);
                return;
+               
        }
-
-       i = 0;
+       j = i = 0;
        while (len = StrBuf_ServGetln(Buf),
-               (len >= 0)
-               && (i < (sizeof(ServerConfig) / sizeof(CfgMapping)))
-               && ((len != 3) || strcmp(ChrPtr(Buf), "000"))
-       ) {
-               Put(Cfg,
-                       ServerConfig[i].Key, 
-                       ServerConfig[i].len, 
-                       Buf, 
-                       HFreeStrBuf
-               );
-               i++;
-               if (i <= sizeof(ServerConfig) / sizeof(CfgMapping)) {
+              (len >= 0) && 
+              ((len != 3) || strcmp(ChrPtr(Buf), "000")))
+       {
+               if (i < (sizeof(ServerConfig) / sizeof(CfgMapping)))
+               {
+                       Put(Cfg,
+                           ServerConfig[i].Key, 
+                           ServerConfig[i].len, 
+                           Buf, 
+                           HFreeStrBuf);
+                       i++;
                        Buf = NewStrBuf();
                }
                else {
-                       Buf = NULL;
+                       if (j == 0)
+                               AppendImportantMessage(_("WARNING: Failed to parse Server Config; do you run a to new citserver?"), -1);
+                       j++;
                }
        }
-
-       if (strcmp(ChrPtr(Buf), "000") != 0)
-       {
-               /* Discard config lines which we don't yet support */
-               while ( (len = StrBuf_ServGetln(Buf),
-                       strcmp(ChrPtr(Buf), "000"))
-               ) {
-               }
-               AppendImportantMessage(_("WARNING: Failed to parse Server Config; do you run a to new citserver?"), -1);
-               FreeStrBuf(&Buf);
-               return;
-       }
        FreeStrBuf(&Buf);
 
        LoadExpirePolicy(sitepolicy);
index b704ca6922e5840e771ca71056b30d5ba569f97f..cab60d43ec01307ceef379db619a34fe0a22c485 100644 (file)
@@ -36,7 +36,7 @@ void sitemap_do_bbs(void) {
        Stat.maxload = INT_MAX;
        Stat.lowest_found = (-1);
        Stat.highest_found = (-1);
-       num_msgs = load_msg_ptrs("MSGS ALL", &Stat, NULL);
+       num_msgs = load_msg_ptrs("MSGS ALL", NULL, &Stat, NULL);
        if (num_msgs < 1) return;
 
        for (i=0; i<num_msgs; i+=20) {
@@ -66,7 +66,7 @@ void sitemap_do_blog(void) {
        Stat.maxload = INT_MAX;
        Stat.lowest_found = (-1);
        Stat.highest_found = (-1);
-       num_msgs = load_msg_ptrs("MSGS ALL", &Stat, NULL);
+       num_msgs = load_msg_ptrs("MSGS ALL", NULL, &Stat, NULL);
        if (num_msgs < 1) return;
 
        for (i=0; i<num_msgs; ++i) {
@@ -100,7 +100,7 @@ void sitemap_do_wiki(void) {
        Stat.maxload = INT_MAX;
        Stat.lowest_found = (-1);
        Stat.highest_found = (-1);
-       num_msgs = load_msg_ptrs("MSGS ALL", &Stat, NULL);
+       num_msgs = load_msg_ptrs("MSGS ALL", NULL, &Stat, NULL);
        if (num_msgs < 1) return;
 
        for (i=0; i<num_msgs; ++i) {
index ecb90c0b19be3bccbc3ec1d141bacd777b4e2ae1..172a15486703d700279a37f4ee2abac124a1dee8 100644 (file)
@@ -117,7 +117,7 @@ void tasks_section(void) {
                num_msgs = 0;
        }
        else {
-               num_msgs = load_msg_ptrs("MSGS ALL", &Stat, NULL);
+               num_msgs = load_msg_ptrs("MSGS ALL", NULL, &Stat, NULL);
        }
 
        if (num_msgs > 0) {
@@ -142,6 +142,7 @@ void tasks_section(void) {
  */
 void calendar_section(void) {
        char cmd[SIZ];
+       char filter[SIZ];
        int num_msgs = 0;
        HashPos *at;
        const char *HashKey;
@@ -165,13 +166,16 @@ void calendar_section(void) {
                num_msgs = 0;
        }
        else {
-               num_msgs = load_msg_ptrs("MSGS ALL", &Stat, NULL);
+               num_msgs = load_msg_ptrs("MSGS ALL", NULL, &Stat, NULL);
        }
        calendar_GetParamsGetServerCall(&Stat, 
                                        &v,
                                        readnew, 
                                        cmd, 
-                                       sizeof(cmd));
+                                       sizeof(cmd),
+                                       filter,
+                                       sizeof(filter));
+
 
        if (num_msgs > 0) {
                at = GetNewHashPos(WCC->summ, 0);
index e0d5a55717bb97e2ef9689bf94caa00c21fef5cf..adf758378e08cd549c26993ec61d1ba1be3770f6 100644 (file)
@@ -720,7 +720,9 @@ int tasks_GetParamsGetServerCall(SharedMessageStatus *Stat,
                                 void **ViewSpecific, 
                                 long oper, 
                                 char *cmd, 
-                                long len)
+                                long len,
+                                char *filter,
+                                long flen)
 {
        strcpy(cmd, "MSGS ALL");
        Stat->maxmsgs = 32767;
@@ -747,6 +749,7 @@ InitModule_TASKS
                tasks_GetParamsGetServerCall,
                NULL,
                NULL,
+               NULL,
                tasks_LoadMsgFromServer,
                tasks_RenderView_or_Tail,
                tasks_Cleanup);
index ef72b6e201b5139909367e1048883aba884f1890..ef1be72b6b50b7fd2653ef25249fff7963f8bfe7 100644 (file)
@@ -531,7 +531,7 @@ TRYAGAIN:
        Stat.lowest_found = (-1);
        Stat.highest_found = (-1);
        /* Search for the user's vCard */
-       if (load_msg_ptrs("MSGS ALL||||1", &Stat, NULL) > 0) {
+       if (load_msg_ptrs("MSGS ALL||||1", NULL, &Stat, NULL) > 0) {
                at = GetNewHashPos(WCC->summ, 0);
                while (GetNextHashPos(WCC->summ, at, &HKLen, &HashKey, &vMsg)) {
                        Msg = (message_summary*) vMsg;          
index 3b9629d64582d2d5ce6060369bddc7080f734b80..9c8bd3b0c4c76b899883eb610e0df2308d633a7e 100644 (file)
@@ -1417,7 +1417,9 @@ int vcard_GetParamsGetServerCall(SharedMessageStatus *Stat,
                                 void **ViewSpecific, 
                                 long oper, 
                                 char *cmd, 
-                                long len)
+                                long len,
+                                char *filter,
+                                long flen)
 {
        vcardview_struct *VS;
 
@@ -1514,6 +1516,7 @@ InitModule_VCARD
                VIEW_ADDRESSBOOK,
                vcard_GetParamsGetServerCall,
                NULL,
+               NULL,
                NULL, 
                vcard_LoadMsgFromServer,
                vcard_RenderView_or_Tail,
index 6611a927517cd3a22615c5c3af0af99297d3dce1..e713e75bbfb4b0bc62db459339fd082678bdac01 100644 (file)
@@ -487,7 +487,6 @@ struct wcsession {
        time_t lastreq;                         /* Timestamp of most recent HTTP */
        time_t last_pager_check;                /* last time we polled for instant msgs */
        ServInfo *serv_info;                    /* Information about the citserver we're connected to */
-       int is_ajax;                            /* are we doing an ajax request? */
        StrBuf *PushedDestination;              /* Where to go after login, registration, etc. */
 
 /* Request local Members */
index 803fe4c7217d57607e72f1a62e8d1f8324147a7c..3a896b4726e7cc37fdea541ed8808d8e032a7e37 100644 (file)
@@ -250,6 +250,7 @@ int main(int argc, char **argv)
        /* initialize various subsystems */
 
        initialise_modules();
+       initialise2_modules();
        InitTemplateCache();
        if (DumpTemplateI18NStrings) {
                FILE *fd;
index 56ad06d02687a6f5955f52eb004479dafec774e1..ef1a4441212dad909e6ee031dd6df87b11319364 100644 (file)
@@ -365,13 +365,37 @@ int ConditionalHavewikiType(StrBuf *Target, WCTemplputParams *TP)
 }
 
 
+int wiki_PrintHeaderPage(SharedMessageStatus *Stat, void **ViewSpecific)
+{
+       /* this function was intentionaly left empty. */
+       return 0;
+}
+
+int wiki_GetParamsGetServerCall(SharedMessageStatus *Stat, 
+                               void **ViewSpecific, 
+                               long oper, 
+                               char *cmd, 
+                               long len,
+                               char *filter,
+                               long flen)
+{
+       if (oper == do_search)
+               display_wiki_pagelist();
+       else 
+               http_redirect("wiki?page=home");
+
+       return 300;
+}
+
+
 void 
 InitModule_WIKI
 (void)
 {
        RegisterReadLoopHandlerset(
                VIEW_WIKI,
-               NULL,
+               wiki_GetParamsGetServerCall,
+               wiki_PrintHeaderPage,
                NULL,
                NULL,
                NULL,