* add way to have tokens do their custom parse-time preevaluation; this involves...
authorWilfried Göesgens <willi@citadel.org>
Mon, 19 Oct 2009 19:16:23 +0000 (19:16 +0000)
committerWilfried Göesgens <willi@citadel.org>
Mon, 19 Oct 2009 19:16:23 +0000 (19:16 +0000)
* load iterators by the new parse time evaluator, not at runtime; Now we can find non-existant iterators at parse-time.

21 files changed:
webcit/context_loop.c
webcit/downloads.c
webcit/http_datestring.c
webcit/ical_subst.c
webcit/iconbar.c
webcit/inetconf.c
webcit/msg_renderers.c
webcit/netconf.c
webcit/notes.c
webcit/paramhandling.c
webcit/preferences.c
webcit/roomlist.c
webcit/roomops.c
webcit/serv_func.c
webcit/setup.c
webcit/siteconfig.c
webcit/subst.c
webcit/subst.h
webcit/useredit.c
webcit/webcit.c
webcit/who.c

index bf201440433b4e4e5b7297312c8850769813195b..aa8a467a9287908a531f16b71de13799dadffc40 100644 (file)
@@ -772,9 +772,9 @@ InitModule_CONTEXT
        RegisterHeaderHandler(HKEY("ACCEPT-ENCODING"), Header_HandleAcceptEncoding);
        RegisterHeaderHandler(HKEY("IF-MODIFIED-SINCE"), Header_HandleIfModSince);
 
-       RegisterNamespace("CURRENT_USER", 0, 1, tmplput_current_user, CTX_NONE);
-       RegisterNamespace("CURRENT_ROOM", 0, 1, tmplput_current_room, CTX_NONE);
-       RegisterNamespace("NONCE", 0, 0, tmplput_nonce, 0);
+       RegisterNamespace("CURRENT_USER", 0, 1, tmplput_current_user, NULL, CTX_NONE);
+       RegisterNamespace("CURRENT_ROOM", 0, 1, tmplput_current_room, NULL, CTX_NONE);
+       RegisterNamespace("NONCE", 0, 0, tmplput_nonce, NULL, 0);
 
        WebcitAddUrlHandler(HKEY("404"), do_404, ANONYMOUS|COOKIEUNNEEDED);
 /*
index 28fcbe80fb1fb8a576f064b793ca6c885385148b..d7b915c3c2d092842d6128ee11a0b8a31ecb748c 100644 (file)
@@ -431,10 +431,10 @@ InitModule_DOWNLOAD
                         GroupchangeFilelistBySequence,
                         CTX_FILELIST);
 
-       RegisterNamespace("FILE:NAME", 0, 2, tmplput_FILE_NAME, CTX_FILELIST);
-       RegisterNamespace("FILE:SIZE", 0, 1, tmplput_FILE_SIZE, CTX_FILELIST);
-       RegisterNamespace("FILE:MIMETYPE", 0, 2, tmplput_FILEMIMETYPE, CTX_FILELIST);
-       RegisterNamespace("FILE:COMMENT", 0, 2, tmplput_FILE_COMMENT, CTX_FILELIST);
+       RegisterNamespace("FILE:NAME", 0, 2, tmplput_FILE_NAME, NULL, CTX_FILELIST);
+       RegisterNamespace("FILE:SIZE", 0, 1, tmplput_FILE_SIZE, NULL, CTX_FILELIST);
+       RegisterNamespace("FILE:MIMETYPE", 0, 2, tmplput_FILEMIMETYPE, NULL, CTX_FILELIST);
+       RegisterNamespace("FILE:COMMENT", 0, 2, tmplput_FILE_COMMENT, NULL, CTX_FILELIST);
 
        RegisterConditional(HKEY("COND:FILE:ISPIC"), 0, Conditional_FILE_ISPIC, CTX_FILELIST);
 
index f3db04ce9783427b1d5ed8060121eebb37b4e389..2394391f202dc968a244a33e0271d9567f7f0809 100644 (file)
@@ -81,8 +81,8 @@ void
 InitModule_DATE
 (void)
 {
-       RegisterNamespace("DATE:NOW:STR", 0, 0, tmplput_nowstr, CTX_NONE);
-       RegisterNamespace("DATE:NOW:NO", 0, 0, tmplput_nowno, CTX_NONE);
+       RegisterNamespace("DATE:NOW:STR", 0, 0, tmplput_nowstr, NULL, CTX_NONE);
+       RegisterNamespace("DATE:NOW:NO", 0, 0, tmplput_nowno, NULL, CTX_NONE);
 }
 
 /*@}*/
index 3de772c882843aaa8fddfe6502aa00c72b4d3070..4693786cb9da70d949e6a027a1b8a3a361c6448f 100644 (file)
@@ -82,6 +82,7 @@ void CreateIcalComponendKindLookup(void)
                           0, 
                           10, 
                           tmplput_ICalItem,
+                          NULL, 
                           CTX_ICAL);
                Put(IcalComponentMap, 
                    icalproperty_kind_map[i].Name, 
index 34ce7ff24d0efd365a0493a7a77439f9ad36cdf1..beb449882311fa4badba256efff9f87872b07760 100644 (file)
@@ -251,7 +251,7 @@ InitModule_ICONBAR
        WebcitAddUrlHandler(HKEY("user_iconbar"), doUserIconStylesheet, 0);
        WebcitAddUrlHandler(HKEY("commit_iconbar"), commit_iconbar, 0);
        RegisterConditional(HKEY("COND:ICONBAR:ACTIVE"), 3, ConditionalIsActiveStylesheet, CTX_NONE);
-       RegisterNamespace("ICONBAR", 0, 0, tmplput_iconbar, 0);
+       RegisterNamespace("ICONBAR", 0, 0, tmplput_iconbar, NULL, CTX_NONE);
 
        RegisterPreference("iconbar", _("Iconbar Setting"), PRF_STRING, LoadIconSettings);
 }
index e4f7254eddb688d1618bbf213e025427552b8d7f..c8e100d0a03af984a31888be70171f395c440530 100644 (file)
@@ -214,5 +214,5 @@ InitModule_INETCONF
 {
        WebcitAddUrlHandler(HKEY("save_inetconf"), new_save_inetconf, 0);
        RegisterIterator("SERVCFG:INET", 1, NULL, GetInetConfHash, InetCfgSubst, NULL, CTX_INETCFG, CTX_NONE, IT_NOFLAG);
-       RegisterNamespace("SERVCFG:FLUSHINETCFG",0, 0, DeleteInetConfHash, CTX_NONE);
+       RegisterNamespace("SERVCFG:FLUSHINETCFG",0, 0, DeleteInetConfHash, NULL, CTX_NONE);
 }
index 4aaeefe06468c3019bfe59f0f9b5d05d1b5cc0c9..bf387c3fc2e3c502c4413f0a6175a780ad7ad3ae 100644 (file)
@@ -1494,31 +1494,31 @@ InitModule_MSGRENDERERS
                         groupchange_sender,
                         CTX_MAILSUM);
 
-       RegisterNamespace("SUMM:COUNT", 0, 0, tmplput_SUMM_COUNT, CTX_NONE);
+       RegisterNamespace("SUMM:COUNT", 0, 0, tmplput_SUMM_COUNT, NULL, CTX_NONE);
        /* iterate over all known mails in WC->summ */
        RegisterIterator("MAIL:SUMM:MSGS", 0, NULL, iterate_get_mailsumm_All,
                         NULL,NULL, CTX_MAILSUM, CTX_NONE, IT_NOFLAG);
 
-       RegisterNamespace("MAIL:SUMM:DATEBRIEF", 0, 0, tmplput_MAIL_SUMM_DATE_BRIEF, CTX_MAILSUM);
-       RegisterNamespace("MAIL:SUMM:DATEFULL", 0, 0, tmplput_MAIL_SUMM_DATE_FULL, CTX_MAILSUM);
-       RegisterNamespace("MAIL:SUMM:DATENO",  0, 0, tmplput_MAIL_SUMM_DATE_NO,  CTX_MAILSUM);
-       RegisterNamespace("MAIL:SUMM:N",       0, 0, tmplput_MAIL_SUMM_N,        CTX_MAILSUM);
-       RegisterNamespace("MAIL:SUMM:FROM",    0, 2, tmplput_MAIL_SUMM_FROM,     CTX_MAILSUM);
-       RegisterNamespace("MAIL:SUMM:TO",      0, 2, tmplput_MAIL_SUMM_TO,       CTX_MAILSUM);
-       RegisterNamespace("MAIL:SUMM:SUBJECT", 0, 4, tmplput_MAIL_SUMM_SUBJECT,  CTX_MAILSUM);
-       RegisterNamespace("MAIL:SUMM:NTATACH", 0, 0, tmplput_MAIL_SUMM_NATTACH,  CTX_MAILSUM);
-       RegisterNamespace("MAIL:SUMM:CCCC", 0, 2, tmplput_MAIL_SUMM_CCCC,  CTX_MAILSUM);
-       RegisterNamespace("MAIL:SUMM:H_NODE", 0, 2, tmplput_MAIL_SUMM_H_NODE,  CTX_MAILSUM);
-       RegisterNamespace("MAIL:SUMM:ALLRCPT", 0, 2, tmplput_MAIL_SUMM_ALLRCPT,  CTX_MAILSUM);
-       RegisterNamespace("MAIL:SUMM:ORGROOM", 0, 2, tmplput_MAIL_SUMM_ORGROOM,  CTX_MAILSUM);
-       RegisterNamespace("MAIL:SUMM:RFCA", 0, 2, tmplput_MAIL_SUMM_RFCA,  CTX_MAILSUM);
-       RegisterNamespace("MAIL:SUMM:OTHERNODE", 2, 0, tmplput_MAIL_SUMM_OTHERNODE,  CTX_MAILSUM);
-       RegisterNamespace("MAIL:SUMM:REFIDS", 0, 1, tmplput_MAIL_SUMM_REFIDS,  CTX_MAILSUM);
-       RegisterNamespace("MAIL:SUMM:INREPLYTO", 0, 2, tmplput_MAIL_SUMM_INREPLYTO,  CTX_MAILSUM);
-       RegisterNamespace("MAIL:BODY", 0, 2, tmplput_MAIL_BODY,  CTX_MAILSUM);
-       RegisterNamespace("MAIL:QUOTETEXT", 1, 2, tmplput_QUOTED_MAIL_BODY,  CTX_NONE);
-       RegisterNamespace("MAIL:EDITTEXT", 1, 2, tmplput_EDIT_MAIL_BODY,  CTX_NONE);
-       RegisterNamespace("MAIL:EDITWIKI", 1, 2, tmplput_EDIT_WIKI_BODY,  CTX_NONE);
+       RegisterNamespace("MAIL:SUMM:DATEBRIEF", 0, 0, tmplput_MAIL_SUMM_DATE_BRIEF, NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:SUMM:DATEFULL", 0, 0, tmplput_MAIL_SUMM_DATE_FULL, NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:SUMM:DATENO",  0, 0, tmplput_MAIL_SUMM_DATE_NO,  NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:SUMM:N",       0, 0, tmplput_MAIL_SUMM_N,        NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:SUMM:FROM",    0, 2, tmplput_MAIL_SUMM_FROM,     NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:SUMM:TO",      0, 2, tmplput_MAIL_SUMM_TO,       NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:SUMM:SUBJECT", 0, 4, tmplput_MAIL_SUMM_SUBJECT,  NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:SUMM:NTATACH", 0, 0, tmplput_MAIL_SUMM_NATTACH,  NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:SUMM:CCCC", 0, 2, tmplput_MAIL_SUMM_CCCC, NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:SUMM:H_NODE", 0, 2, tmplput_MAIL_SUMM_H_NODE,  NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:SUMM:ALLRCPT", 0, 2, tmplput_MAIL_SUMM_ALLRCPT,  NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:SUMM:ORGROOM", 0, 2, tmplput_MAIL_SUMM_ORGROOM,  NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:SUMM:RFCA", 0, 2, tmplput_MAIL_SUMM_RFCA, NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:SUMM:OTHERNODE", 2, 0, tmplput_MAIL_SUMM_OTHERNODE,  NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:SUMM:REFIDS", 0, 1, tmplput_MAIL_SUMM_REFIDS,  NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:SUMM:INREPLYTO", 0, 2, tmplput_MAIL_SUMM_INREPLYTO,  NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:BODY", 0, 2, tmplput_MAIL_BODY,  NULL, CTX_MAILSUM);
+       RegisterNamespace("MAIL:QUOTETEXT", 1, 2, tmplput_QUOTED_MAIL_BODY,  NULL, CTX_NONE);
+       RegisterNamespace("MAIL:EDITTEXT", 1, 2, tmplput_EDIT_MAIL_BODY,  NULL, CTX_NONE);
+       RegisterNamespace("MAIL:EDITWIKI", 1, 2, tmplput_EDIT_WIKI_BODY,  NULL, CTX_NONE);
        RegisterConditional(HKEY("COND:MAIL:SUMM:RFCA"), 0, Conditional_MAIL_SUMM_RFCA,  CTX_MAILSUM);
        RegisterConditional(HKEY("COND:MAIL:SUMM:CCCC"), 0, Conditional_MAIL_SUMM_CCCC,  CTX_MAILSUM);
        RegisterConditional(HKEY("COND:MAIL:SUMM:UNREAD"), 0, Conditional_MAIL_SUMM_UNREAD, CTX_MAILSUM);
@@ -1544,17 +1544,17 @@ InitModule_MSGRENDERERS
                         NULL, NULL, CTX_MIME_ATACH, CTX_MAILSUM, IT_NOFLAG);
 
        /* Parts of a mime attachent */
-       RegisterNamespace("MAIL:MIME:NAME", 0, 2, tmplput_MIME_Name, CTX_MIME_ATACH);
-       RegisterNamespace("MAIL:MIME:FILENAME", 0, 2, tmplput_MIME_FileName, CTX_MIME_ATACH);
-       RegisterNamespace("MAIL:MIME:PARTNUM", 0, 2, tmplput_MIME_PartNum, CTX_MIME_ATACH);
-       RegisterNamespace("MAIL:MIME:MSGNUM", 0, 2, tmplput_MIME_MsgNum, CTX_MIME_ATACH);
-       RegisterNamespace("MAIL:MIME:DISPOSITION", 0, 2, tmplput_MIME_Disposition, CTX_MIME_ATACH);
-       RegisterNamespace("MAIL:MIME:CONTENTTYPE", 0, 2, tmplput_MIME_ContentType, CTX_MIME_ATACH);
-       RegisterNamespace("MAIL:MIME:CHARSET", 0, 2, tmplput_MIME_Charset, CTX_MIME_ATACH);
-       RegisterNamespace("MAIL:MIME:LENGTH", 0, 2, tmplput_MIME_Length, CTX_MIME_ATACH);
-       RegisterNamespace("MAIL:MIME:DATA", 0, 2, tmplput_MIME_Data, CTX_MIME_ATACH);
+       RegisterNamespace("MAIL:MIME:NAME", 0, 2, tmplput_MIME_Name, NULL, CTX_MIME_ATACH);
+       RegisterNamespace("MAIL:MIME:FILENAME", 0, 2, tmplput_MIME_FileName, NULL, CTX_MIME_ATACH);
+       RegisterNamespace("MAIL:MIME:PARTNUM", 0, 2, tmplput_MIME_PartNum, NULL, CTX_MIME_ATACH);
+       RegisterNamespace("MAIL:MIME:MSGNUM", 0, 2, tmplput_MIME_MsgNum, NULL, CTX_MIME_ATACH);
+       RegisterNamespace("MAIL:MIME:DISPOSITION", 0, 2, tmplput_MIME_Disposition, NULL, CTX_MIME_ATACH);
+       RegisterNamespace("MAIL:MIME:CONTENTTYPE", 0, 2, tmplput_MIME_ContentType, NULL, CTX_MIME_ATACH);
+       RegisterNamespace("MAIL:MIME:CHARSET", 0, 2, tmplput_MIME_Charset, NULL, CTX_MIME_ATACH);
+       RegisterNamespace("MAIL:MIME:LENGTH", 0, 2, tmplput_MIME_Length, NULL, CTX_MIME_ATACH);
+       RegisterNamespace("MAIL:MIME:DATA", 0, 2, tmplput_MIME_Data, NULL, CTX_MIME_ATACH);
        /* load the actual attachment into WC->attachments; no output!!! */
-       RegisterNamespace("MAIL:MIME:LOADDATA", 0, 0, tmplput_MIME_LoadData, CTX_MIME_ATACH);
+       RegisterNamespace("MAIL:MIME:LOADDATA", 0, 0, tmplput_MIME_LoadData, NULL, CTX_MIME_ATACH);
 
        /* iterate the WC->attachments; use the above tokens for their contents */
        RegisterIterator("MSG:ATTACHNAMES", 0, NULL, iterate_get_registered_Attachments, 
index c8add93118d324e876e0a37d2fdce673ba9a5436..9b369e79b48ac88f7139d0a6efda21fc515120a0 100644 (file)
@@ -306,10 +306,10 @@ InitModule_NETCONF
        WebcitAddUrlHandler(HKEY("delete_node"), delete_node, 0);
 
                                                                                           
-        RegisterNamespace("CFG:IGNET:NODE", 0, 1, tmplput_NodeName, CTX_NODECONF);
-        RegisterNamespace("CFG:IGNET:SECRET", 0, 1, tmplput_Secret, CTX_NODECONF);
-        RegisterNamespace("CFG:IGNET:HOST", 0, 1, tmplput_Host, CTX_NODECONF);
-        RegisterNamespace("CFG:IGNET:PORT", 0, 1, tmplput_Port, CTX_NODECONF);
+        RegisterNamespace("CFG:IGNET:NODE", 0, 1, tmplput_NodeName, NULL, CTX_NODECONF);
+        RegisterNamespace("CFG:IGNET:SECRET", 0, 1, tmplput_Secret, NULL, CTX_NODECONF);
+        RegisterNamespace("CFG:IGNET:HOST", 0, 1, tmplput_Host, NULL, CTX_NODECONF);
+        RegisterNamespace("CFG:IGNET:PORT", 0, 1, tmplput_Port, NULL, CTX_NODECONF);
 
        RegisterIterator("NODECONFIG", 0, NULL, load_netconf, NULL, DeleteHash, CTX_NODECONF, CTX_NONE, IT_NOFLAG);
 }
index 13e03723a86e54a67c2180233e6cbe7987fb5fec..2917122785ed673600d115c3c14504c1eb425db6 100644 (file)
@@ -453,14 +453,14 @@ InitModule_NOTES
        WebcitAddUrlHandler(HKEY("add_new_note"), add_new_note, 0);
        WebcitAddUrlHandler(HKEY("ajax_update_note"), ajax_update_note, 0);
 
-       RegisterNamespace("VNOTE:POS:LEFT", 0, 0, tmpl_vcard_put_posleft, CTX_VNOTE);
-       RegisterNamespace("VNOTE:POS:TOP", 0, 0, tmpl_vcard_put_postop, CTX_VNOTE);
-       RegisterNamespace("VNOTE:POS:WIDTH", 0, 0, tmpl_vcard_put_poswidth, CTX_VNOTE);
-       RegisterNamespace("VNOTE:POS:HEIGHT", 0, 0, tmpl_vcard_put_posheight, CTX_VNOTE);
-       RegisterNamespace("VNOTE:POS:HEIGHT2", 0, 0, tmpl_vcard_put_posheight2, CTX_VNOTE);
-       RegisterNamespace("VNOTE:POS:WIDTH2", 0, 0, tmpl_vcard_put_width2, CTX_VNOTE);
-       RegisterNamespace("VNOTE:COLOR", 0, 0, tmpl_vcard_put_color, CTX_VNOTE);
-       RegisterNamespace("VNOTE:BGCOLOR", 0, 0,tmpl_vcard_put_bgcolor, CTX_VNOTE);
-       RegisterNamespace("VNOTE:MSG", 0, 1, tmpl_vcard_put_message, CTX_VNOTE);
-       RegisterNamespace("VNOTE:UID", 0, 0, tmpl_vcard_put_uid, CTX_VNOTE);
+       RegisterNamespace("VNOTE:POS:LEFT", 0, 0, tmpl_vcard_put_posleft, NULL, CTX_VNOTE);
+       RegisterNamespace("VNOTE:POS:TOP", 0, 0, tmpl_vcard_put_postop, NULL, CTX_VNOTE);
+       RegisterNamespace("VNOTE:POS:WIDTH", 0, 0, tmpl_vcard_put_poswidth, NULL, CTX_VNOTE);
+       RegisterNamespace("VNOTE:POS:HEIGHT", 0, 0, tmpl_vcard_put_posheight, NULL, CTX_VNOTE);
+       RegisterNamespace("VNOTE:POS:HEIGHT2", 0, 0, tmpl_vcard_put_posheight2, NULL, CTX_VNOTE);
+       RegisterNamespace("VNOTE:POS:WIDTH2", 0, 0, tmpl_vcard_put_width2, NULL, CTX_VNOTE);
+       RegisterNamespace("VNOTE:COLOR", 0, 0, tmpl_vcard_put_color, NULL, CTX_VNOTE);
+       RegisterNamespace("VNOTE:BGCOLOR", 0, 0,tmpl_vcard_put_bgcolor, NULL, CTX_VNOTE);
+       RegisterNamespace("VNOTE:MSG", 0, 1, tmpl_vcard_put_message, NULL, CTX_VNOTE);
+       RegisterNamespace("VNOTE:UID", 0, 0, tmpl_vcard_put_uid, NULL, CTX_VNOTE);
 }
index c00f9de03121235e67c675b2276cbecb1d690e73..f17fe08df9f07f01e4faf7bf915fe09cbb59e39b 100644 (file)
@@ -424,8 +424,8 @@ InitModule_PARAMHANDLING
        WebcitAddUrlHandler(HKEY("diagnostics"), diagnostics, NEED_URL);
 
        RegisterConditional(HKEY("COND:BSTR"), 1, ConditionalBstr, CTX_NONE);
-       RegisterNamespace("BSTR", 1, 2, tmplput_bstr, CTX_NONE);
-       RegisterNamespace("URLPART", 1, 2, tmplput_url_part, CTX_NONE);
+       RegisterNamespace("BSTR", 1, 2, tmplput_bstr, NULL, CTX_NONE);
+       RegisterNamespace("URLPART", 1, 2, tmplput_url_part, NULL, CTX_NONE);
 }
 
 
index 8a04213c882f091fa2be8074f31d1fe38deeecc6..a8c1ce56c9462f1ce11f4c30e484256a0e49d67e 100644 (file)
@@ -1007,12 +1007,12 @@ InitModule_PREFERENCES
 
        RegisterPreference("startpage", _("Prefered startpage"), PRF_STRING, LoadStartpage);
 
-       RegisterNamespace("OFFERSTARTPAGE", 0, 0, offer_start_page, CTX_NONE);
-       RegisterNamespace("PREF:ROOM:VALUE", 1, 2, tmplput_CFG_RoomValue,  CTX_NONE);
-       RegisterNamespace("PREF:ROOM:VALUE:INT", 1, 2, tmplput_CFG_RoomValueLong,  CTX_NONE);
-       RegisterNamespace("PREF:VALUE", 1, 2, tmplput_CFG_Value, CTX_NONE);
+       RegisterNamespace("OFFERSTARTPAGE", 0, 0, offer_start_page, NULL, CTX_NONE);
+       RegisterNamespace("PREF:ROOM:VALUE", 1, 2, tmplput_CFG_RoomValue,  NULL, CTX_NONE);
+       RegisterNamespace("PREF:ROOM:VALUE:INT", 1, 2, tmplput_CFG_RoomValueLong,  NULL, CTX_NONE);
+       RegisterNamespace("PREF:VALUE", 1, 2, tmplput_CFG_Value, NULL, CTX_NONE);
        
-       RegisterNamespace("PREF:DESCR", 1, 1, tmplput_CFG_Descr, CTX_NONE);
+       RegisterNamespace("PREF:DESCR", 1, 1, tmplput_CFG_Descr, NULL, CTX_NONE);
 
        RegisterConditional(HKEY("COND:PREF"), 4, ConditionalPreference, CTX_NONE);
        RegisterConditional(HKEY("COND:PREF:SET"), 4, ConditionalHasPreference, CTX_NONE);
index b0004d105cbcaf65883830794014be17d8a2a21f..04cd48abbf963b6a4f5d18ce1c9b3d24a6dc4852 100644 (file)
@@ -702,31 +702,31 @@ InitModule_ROOMLIST
        WebcitAddUrlHandler(HKEY("json_roomflr"), jsonRoomFlr, 0);
 
 
-       RegisterNamespace("FLOOR:ID", 0, 0, tmplput_FLOOR_ID, CTX_FLOORS);
-       RegisterNamespace("FLOOR:NAME", 0, 1, tmplput_FLOOR_NAME, CTX_FLOORS);
-       RegisterNamespace("FLOOR:NROOMS", 0, 0, tmplput_FLOOR_NROOMS, CTX_FLOORS);
+       RegisterNamespace("FLOOR:ID", 0, 0, tmplput_FLOOR_ID, NULL, CTX_FLOORS);
+       RegisterNamespace("FLOOR:NAME", 0, 1, tmplput_FLOOR_NAME, NULL, CTX_FLOORS);
+       RegisterNamespace("FLOOR:NROOMS", 0, 0, tmplput_FLOOR_NROOMS, NULL, CTX_FLOORS);
        RegisterConditional(HKEY("COND:ROOM:REST:ISSUBFLOOR"), 0, ConditionalFloorIsRESTSubFloor, CTX_FLOORS);
 
        RegisterIterator("LFLR", 0, NULL, GetFloorListHash, NULL, NULL, CTX_FLOORS, CTX_NONE, IT_FLAG_DETECT_GROUPCHANGE);
 
        RegisterIterator("LKRA", 0, NULL, GetRoomListHashLKRA, NULL, DeleteHash, CTX_ROOMS, CTX_NONE, IT_FLAG_DETECT_GROUPCHANGE);
 
-       RegisterNamespace("ROOM:INFO:FLOORID", 0, 1, tmplput_ROOM_FLOORID, CTX_ROOMS);
-       RegisterNamespace("ROOM:INFO:NAME", 0, 1, tmplput_ROOM_NAME, CTX_ROOMS);
-       RegisterNamespace("ROOM:INFO:PRINT_NAME", 0, 1, tmplput_ROOM_NAME, CTX_ROOMS);/// TODO!
-       RegisterNamespace("ROOM:INFO:BASENAME", 0, 1, tmplput_ROOM_BASENAME, CTX_ROOMS);
-       RegisterNamespace("ROOM:INFO:LEVELNTIMES", 1, 2, tmplput_ROOM_LEVEL_N_TIMES, CTX_ROOMS);
-
-       RegisterNamespace("ROOM:INFO:ACL", 0, 1, tmplput_ROOM_ACL, CTX_ROOMS);
-       RegisterNamespace("ROOM:INFO:QRFLAGS", 0, 1, tmplput_ROOM_QRFLAGS, CTX_ROOMS);
-       RegisterNamespace("ROOM:INFO:LISTORDER", 0, 1, tmplput_ROOM_LISTORDER, CTX_ROOMS);
-       RegisterNamespace("ROOM:INFO:VIEW", 0, 1, tmplput_ROOM_VIEW, CTX_ROOMS);
-       RegisterNamespace("ROOM:INFO:DEFVIEW", 0, 1, tmplput_ROOM_DEFVIEW, CTX_ROOMS);
-       RegisterNamespace("ROOM:INFO:LASTCHANGE", 0, 1, tmplput_ROOM_LASTCHANGE, CTX_ROOMS);
-       RegisterNamespace("ROOM:INFO:COLLECTIONTYPE", 0, 1, tmplput_ROOM_COLLECTIONTYPE, CTX_ROOMS);
-       RegisterNamespace("ROOM:INFO:FLOOR:ID", 0, 0, tmplput_ROOM_FLOOR_ID, CTX_ROOMS);
-       RegisterNamespace("ROOM:INFO:FLOOR:NAME", 0, 1, tmplput_ROOM_FLOOR_NAME, CTX_ROOMS);
-       RegisterNamespace("ROOM:INFO:FLOOR:NROOMS", 0, 0, tmplput_ROOM_FLOOR_NROOMS, CTX_ROOMS);
+       RegisterNamespace("ROOM:INFO:FLOORID", 0, 1, tmplput_ROOM_FLOORID, NULL, CTX_ROOMS);
+       RegisterNamespace("ROOM:INFO:NAME", 0, 1, tmplput_ROOM_NAME, NULL, CTX_ROOMS);
+       RegisterNamespace("ROOM:INFO:PRINT_NAME", 0, 1, tmplput_ROOM_NAME, NULL, CTX_ROOMS);/// TODO!
+       RegisterNamespace("ROOM:INFO:BASENAME", 0, 1, tmplput_ROOM_BASENAME, NULL, CTX_ROOMS);
+       RegisterNamespace("ROOM:INFO:LEVELNTIMES", 1, 2, tmplput_ROOM_LEVEL_N_TIMES, NULL, CTX_ROOMS);
+
+       RegisterNamespace("ROOM:INFO:ACL", 0, 1, tmplput_ROOM_ACL, NULL, CTX_ROOMS);
+       RegisterNamespace("ROOM:INFO:QRFLAGS", 0, 1, tmplput_ROOM_QRFLAGS, NULL, CTX_ROOMS);
+       RegisterNamespace("ROOM:INFO:LISTORDER", 0, 1, tmplput_ROOM_LISTORDER, NULL, CTX_ROOMS);
+       RegisterNamespace("ROOM:INFO:VIEW", 0, 1, tmplput_ROOM_VIEW, NULL, CTX_ROOMS);
+       RegisterNamespace("ROOM:INFO:DEFVIEW", 0, 1, tmplput_ROOM_DEFVIEW, NULL, CTX_ROOMS);
+       RegisterNamespace("ROOM:INFO:LASTCHANGE", 0, 1, tmplput_ROOM_LASTCHANGE, NULL, CTX_ROOMS);
+       RegisterNamespace("ROOM:INFO:COLLECTIONTYPE", 0, 1, tmplput_ROOM_COLLECTIONTYPE, NULL, CTX_ROOMS);
+       RegisterNamespace("ROOM:INFO:FLOOR:ID", 0, 0, tmplput_ROOM_FLOOR_ID, NULL, CTX_ROOMS);
+       RegisterNamespace("ROOM:INFO:FLOOR:NAME", 0, 1, tmplput_ROOM_FLOOR_NAME, NULL, CTX_ROOMS);
+       RegisterNamespace("ROOM:INFO:FLOOR:NROOMS", 0, 0, tmplput_ROOM_FLOOR_NROOMS, NULL, CTX_ROOMS);
 
        RegisterConditional(HKEY("COND:ROOM:REST:ISSUBROOM"), 0, ConditionalRoomIsRESTSubRoom, CTX_ROOMS);
 
index caa3d7e9a94666a743527345e212212c47fe0d20..cd707622737b7e42e291f720391872e198079334 100644 (file)
@@ -3171,7 +3171,7 @@ InitModule_ROOMOPS
                            NULL);
         RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO, NULL);
 
-       RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, 0);
+       RegisterNamespace("ROOMNAME", 0, 1, tmplput_RoomName, NULL, CTX_NONE);
 
        WebcitAddUrlHandler(HKEY("knrooms"), knrooms, 0);
        WebcitAddUrlHandler(HKEY("dotgoto"), dotgoto, NEED_URL);
@@ -3192,7 +3192,7 @@ InitModule_ROOMOPS
        WebcitAddUrlHandler(HKEY("set_room_policy"), set_room_policy, 0);
        WebcitAddUrlHandler(HKEY("changeview"), change_view, 0);
        WebcitAddUrlHandler(HKEY("toggle_self_service"), toggle_self_service, 0);
-       RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, 0);
+       RegisterNamespace("ROOMBANNER", 0, 1, tmplput_roombanner, NULL, CTX_NONE);
 
        RegisterConditional(HKEY("COND:ROOM:TYPE_IS"), 0, ConditionalIsRoomtype, CTX_NONE);
        RegisterConditional(HKEY("COND:ROOM:FLAGS:QR_PERMANENT"), 0, ConditionalRoomHas_QR_PERMANENT, CTX_NONE);
@@ -3214,7 +3214,7 @@ InitModule_ROOMOPS
        RegisterConditional(HKEY("COND:UNGOTO"), 0, ConditionalHaveUngoto, CTX_NONE);
        RegisterConditional(HKEY("COND:ROOM:EDITACCESS"), 0, ConditionalHaveRoomeditRights, CTX_NONE);
 
-       RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, 0);
+       RegisterNamespace("ROOM:UNGOTO", 0, 0, tmplput_ungoto, NULL, CTX_NONE);
        RegisterIterator("FLOORS", 0, NULL, GetFloorListHash, NULL, NULL, CTX_FLOORS, CTX_NONE, IT_NOFLAG);
 
 
index 165b192a21c56113ba230e38260a737e883c1f43..ed5010e4e145eae069d27057735e1d118230c896 100644 (file)
@@ -792,14 +792,14 @@ InitModule_SERVFUNC
        RegisterConditional(HKEY("COND:SERV:OPENID"), 2, conditional_serv_supports_openid, CTX_NONE);
        RegisterConditional(HKEY("COND:SERV:NEWU"), 2, conditional_serv_newuser_disabled, CTX_NONE);
        RegisterConditional(HKEY("COND:SERV:HAVEFULLTEXT"), 2, conditional_serv_fulltext_enabled, CTX_NONE);
-       RegisterNamespace("SERV:PID", 0, 0, tmplput_serv_ip, CTX_NONE);
-       RegisterNamespace("SERV:NODENAME", 0, 1, tmplput_serv_nodename, CTX_NONE);
-       RegisterNamespace("SERV:HUMANNODE", 0, 1, tmplput_serv_humannode, CTX_NONE);
-       RegisterNamespace("SERV:FQDN", 0, 1, tmplput_serv_fqdn, CTX_NONE);
-       RegisterNamespace("SERV:SOFTWARE", 0, 1, tmplput_serv_software, CTX_NONE);
-       RegisterNamespace("SERV:REV_LEVEL", 0, 0, tmplput_serv_rev_level, CTX_NONE);
-       RegisterNamespace("SERV:BBS_CITY", 0, 1, tmplput_serv_bbs_city, CTX_NONE);
-       RegisterNamespace("SERV:MESG", 1, 2, tmplput_mesg, CTX_NONE);
+       RegisterNamespace("SERV:PID", 0, 0, tmplput_serv_ip, NULL, CTX_NONE);
+       RegisterNamespace("SERV:NODENAME", 0, 1, tmplput_serv_nodename, NULL, CTX_NONE);
+       RegisterNamespace("SERV:HUMANNODE", 0, 1, tmplput_serv_humannode, NULL, CTX_NONE);
+       RegisterNamespace("SERV:FQDN", 0, 1, tmplput_serv_fqdn, NULL, CTX_NONE);
+       RegisterNamespace("SERV:SOFTWARE", 0, 1, tmplput_serv_software, NULL, CTX_NONE);
+       RegisterNamespace("SERV:REV_LEVEL", 0, 0, tmplput_serv_rev_level, NULL, CTX_NONE);
+       RegisterNamespace("SERV:BBS_CITY", 0, 1, tmplput_serv_bbs_city, NULL, CTX_NONE);
+       RegisterNamespace("SERV:MESG", 1, 2, tmplput_mesg, NULL, CTX_NONE);
 /*TODO //      RegisterNamespace("SERV:LDAP_SUPP", 0, 0, tmplput_serv_ldap_enabled, 0); */
 }
 
index ee8f8127752ab43a7792a6650f957b3738e0c724..f0bf85fd898302c55f4e79036e5e3ee12a395659 100644 (file)
@@ -27,6 +27,7 @@ void RegisterNS(const char *NSName, long len,
                int nMinArgs, 
                int nMaxArgs, 
                WCHandlerFunc HandlerFunc,
+               WCPreevalFunc PreEvalFunc,
                int ContextRequired){}
 pthread_key_t MyConKey;
 
index b15b41e209667ac9adceb2159c7774a2a953c1d6..67c954a7118ea660cfadce1848c52b803356d975 100644 (file)
@@ -314,7 +314,7 @@ InitModule_SITECONFIG
 {
        WebcitAddUrlHandler(HKEY("siteconfig"), siteconfig, CTX_NONE);
 
-       RegisterNamespace("SERV:CFG", 1, 2, tmplput_servcfg, CTX_NONE);
+       RegisterNamespace("SERV:CFG", 1, 2, tmplput_servcfg, NULL, CTX_NONE);
        RegisterConditional(HKEY("COND:SERVCFG"), 3, ConditionalServCfg, CTX_NONE);
        RegisterConditional(HKEY("COND:SERVCFG:SUBST"), 4, ConditionalServCfgSubst, CTX_NONE);
        RegisterIterator("PREF:ZONE", 0, ZoneHash, NULL, CfgZoneTempl, NULL, CTX_PREF, CTX_NONE, IT_NOFLAG);
index 7b189e4aff708778fce418d5f4151c03ba032a86..71b8e3ff3aeabc520e2e4fed59c6bb3ff011e77f 100644 (file)
@@ -66,7 +66,7 @@ typedef struct _WCTemplate {
 
 typedef struct _HashHandler {
        ContextFilter Filter;
-
+       WCPreevalFunc PreEvalFunc;
        WCHandlerFunc HandlerFunc;
 }HashHandler;
 
@@ -289,6 +289,7 @@ void RegisterNS(const char *NSName,
                int nMinArgs, 
                int nMaxArgs, 
                WCHandlerFunc HandlerFunc, 
+               WCPreevalFunc PreevalFunc,
                int ContextRequired)
 {
        HashHandler *NewHandler;
@@ -300,6 +301,7 @@ void RegisterNS(const char *NSName,
        NewHandler->Filter.ContextType = ContextRequired;
        NewHandler->Filter.ControlContextType = CTX_NONE;
 
+       NewHandler->PreEvalFunc = PreevalFunc;
        NewHandler->HandlerFunc = HandlerFunc;  
        Put(GlobalNS, NSName, len, NewHandler, NULL);
 }
@@ -1350,6 +1352,8 @@ WCTemplateToken *NewTemplateSubstitute(StrBuf *Buf,
                        else {
                                NewToken->PreEval = Handler;
                                NewToken->Flags = SV_PREEVALUATED;              
+                               if (Handler->PreEvalFunc != NULL)
+                                       Handler->PreEvalFunc(NewToken);
                        }
                }
                break;
@@ -1892,9 +1896,27 @@ typedef struct _iteratestruct {
        int LastN;
        }IterateStruct; 
 
-void tmpl_iterate_subtmpl(StrBuf *Target, WCTemplputParams *TP)
+int preeval_iterate(WCTemplateToken *Token)
 {
+       WCTemplputParams TPP;
+       WCTemplputParams *TP;
        void *vIt;
+
+       memset(&TPP, 0, sizeof(WCTemplputParams));
+       TP = &TPP;
+       TP->Tokens = Token;
+       if (!GetHash(Iterators, TKEY(0), &vIt)) {
+               LogTemplateError(
+                       NULL, "Iterator", ERR_NAME, TP,
+                       "not found");
+               return 0;
+       }
+       Token->Preeval2 = vIt;
+       return 1;
+}
+
+void tmpl_iterate_subtmpl(StrBuf *Target, WCTemplputParams *TP)
+{
        HashIterator *It;
        HashList *List;
        HashPos  *it;
@@ -1915,14 +1937,13 @@ void tmpl_iterate_subtmpl(StrBuf *Target, WCTemplputParams *TP)
        memset(&Status, 0, sizeof(IterateStruct));
        memcpy (&SubTP, &TP, sizeof(WCTemplputParams));
        
-       if (!GetHash(Iterators, TKEY(0), &vIt)) {
+       It = (HashIterator*) TP->Tokens->Preeval2;
+       if (It == NULL) {
                LogTemplateError(
                        Target, "Iterator", ERR_PARM1, TP, "Unknown!");
                return;
        }
 
-       It = (HashIterator*) vIt;
-
        if (TP->Tokens->nParameters < It->AdditionalParams + 2) {
                LogTemplateError(                               
                        Target, "Iterator", ERR_PARM1, TP,
@@ -2603,14 +2624,14 @@ InitModule_SUBST
 (void)
 {
        memset(&NoCtx, 0, sizeof(WCTemplputParams));
-       RegisterNamespace("SORT:ICON", 1, 2, tmplput_SORT_ICON, CTX_NONE);
-       RegisterNamespace("SORT:ORDER", 1, 2, tmplput_SORT_ORDER, CTX_NONE);
-       RegisterNamespace("SORT:NEXT", 1, 2, tmplput_SORT_NEXT, CTX_NONE);
-       RegisterNamespace("CONTEXTSTR", 0, 1, tmplput_ContextString, CTX_STRBUF);
-       RegisterNamespace("ITERATE", 2, 100, tmpl_iterate_subtmpl, CTX_NONE);
-       RegisterNamespace("DOBOXED", 1, 2, tmpl_do_boxed, CTX_NONE);
-       RegisterNamespace("DOTABBED", 2, 100, tmpl_do_tabbed, CTX_NONE);
-       RegisterNamespace("LONGVECTOR", 1, 1, tmplput_long_vector, CTX_LONGVECTOR);
+       RegisterNamespace("SORT:ICON", 1, 2, tmplput_SORT_ICON, NULL, CTX_NONE);
+       RegisterNamespace("SORT:ORDER", 1, 2, tmplput_SORT_ORDER, NULL, CTX_NONE);
+       RegisterNamespace("SORT:NEXT", 1, 2, tmplput_SORT_NEXT, NULL, CTX_NONE);
+       RegisterNamespace("CONTEXTSTR", 0, 1, tmplput_ContextString, NULL, CTX_STRBUF);
+       RegisterNamespace("ITERATE", 2, 100, tmpl_iterate_subtmpl, preeval_iterate, CTX_NONE);
+       RegisterNamespace("DOBOXED", 1, 2, tmpl_do_boxed, NULL, CTX_NONE);
+       RegisterNamespace("DOTABBED", 2, 100, tmpl_do_tabbed, NULL, CTX_NONE);
+       RegisterNamespace("LONGVECTOR", 1, 1, tmplput_long_vector, NULL, CTX_LONGVECTOR);
        RegisterConditional(HKEY("COND:SUBST"), 3, ConditionalVar, CTX_NONE);
        RegisterConditional(HKEY("COND:CONTEXTSTR"), 3, ConditionalContextStr, CTX_STRBUF);
        RegisterConditional(HKEY("COND:LONGVECTOR"), 4, ConditionalLongVector, CTX_LONGVECTOR);
index 36c68a2d2c47c4f4521a3e5a99cdc06b090377ce..d1157d87ab90f1515e7097acd639fad108855f35 100644 (file)
@@ -77,6 +77,9 @@ typedef struct WCTemplputParams WCTemplputParams;
 /* this is the signature of a tmplput function */
 typedef void (*WCHandlerFunc)(StrBuf *Target, WCTemplputParams *TP);
 
+/* if you want to pre-evaluate parts of your token, or do additional syntax, use this. */ 
+typedef int (*WCPreevalFunc)(WCTemplateToken *Token);
+
 /* make a template token a lookup key: */
 #define TKEY(a) TP->Tokens->Params[a]->Start, TP->Tokens->Params[a]->len
 
@@ -124,6 +127,7 @@ struct WCTemplateToken {
        int Flags;
        /* pointer to our runntime evaluator; so we can cache this and save hash-lookups */
        void *PreEval;
+       void *Preeval2;
 
        /* if we have parameters here we go: */
        /* do we have parameters or not? */
@@ -167,11 +171,11 @@ extern WCTemplputParams NoCtx;
 #define ERR_PARM1 1
 #define ERR_PARM2 2
 /**
- * \Brief log an error while evaluating a token; print it to the actual template 
- * \param Target your Target Buffer to print the error message next to the log
- * \param Type What sort of thing are we talking about? Tokens? Conditionals?
- * \param TP grab our set of default information here
- * \param Format for the custom error message
+ * @Brief log an error while evaluating a token; print it to the actual template 
+ * @param Target your Target Buffer to print the error message next to the log
+ * @param Type What sort of thing are we talking about? Tokens? Conditionals?
+ * @param TP grab our set of default information here
+ * @param Format for the custom error message
  */ 
 void LogTemplateError (StrBuf *Target, 
                       const char *Type, 
@@ -181,15 +185,15 @@ void LogTemplateError (StrBuf *Target,
 
 
 /**
- * \Brief log an error while in global context; print it to Wildfire / Target
- * \param Target your Target Buffer to print the error message next to the log
- * \param Type What sort of thing are we talking about? Tokens? Conditionals?
- * \param Format for the custom error message
+ * @Brief log an error while in global context; print it to Wildfire / Target
+ * @param Target your Target Buffer to print the error message next to the log
+ * @param Type What sort of thing are we talking about? Tokens? Conditionals?
+ * @param Format for the custom error message
  */ 
 void LogError (StrBuf *Target, const char *Type, const char *Format, ...);
 
 /**
- * \Brief get the actual value of a token parameter
+ * @Brief get the actual value of a token parameter
  * in your tmplputs or conditionals use this function to access parameters that can also be 
  * retrieved from dynamic facilities:
  *  _ -> Gettext; retrieve this token from the i18n facilities
@@ -197,9 +201,9 @@ void LogError (StrBuf *Target, const char *Type, const char *Format, ...);
  *  B -> bstr; an URL-Parameter
  *  = -> subtemplate; parse a template by this name, and treat its content as this tokens value 
  * 
- * \param N which token do you want to lookup?
- * \param Value reference to the string of the token; don't free me.
- * \param len the length of Value
+ * @param N which token do you want to lookup?
+ * @param Value reference to the string of the token; don't free me.
+ * @param len the length of Value
  */
 void GetTemplateTokenString(StrBuf *Target, 
                            WCTemplputParams *TP,
@@ -210,7 +214,7 @@ void GetTemplateTokenString(StrBuf *Target,
 
 
 /**
- * \Brief get the actual integer value of a token parameter
+ * @Brief get the actual integer value of a token parameter
  * in your tmplputs or conditionals use this function to access parameters that can also be 
  * retrieved from dynamic facilities:
  *  _ -> Gettext; retrieve this token from the i18n facilities
@@ -218,8 +222,8 @@ void GetTemplateTokenString(StrBuf *Target,
  *  B -> bstr; an URL-Parameter
  *  = -> subtemplate; parse a template by this name, and treat its content as this tokens value 
  * 
- * \param N which token do you want to lookup?
- * \param dflt default value to be retrieved if not found in preferences
+ * @param N which token do you want to lookup?
+ * @param dflt default value to be retrieved if not found in preferences
  * \returns the long value
  */
 long GetTemplateTokenNumber(StrBuf *Target, 
@@ -227,16 +231,16 @@ long GetTemplateTokenNumber(StrBuf *Target,
                            int N, long dflt);
 
 /**
- * \Brief put a token value into the template
+ * @Brief put a token value into the template
  * use this function to append your strings into a Template. 
  * it can escape your string according to the token at FormattypeIndex:
  *  H: de-QP and utf8-ify
  *  X: escapize for HTML
  *  J: JSON Escapize
- * \param Target the destination buffer
- * \param TP the template token information
- * \param Source string to append
- * \param FormatTypeIndex which parameter contains the escaping functionality?
+ * @param Target the destination buffer
+ * @param TP the template token information
+ * @param Source string to append
+ * @param FormatTypeIndex which parameter contains the escaping functionality?
  *        if this token doesn't have as much parameters, plain append is done.
  */
 void StrBufAppendTemplate(StrBuf *Target, 
@@ -245,13 +249,34 @@ void StrBufAppendTemplate(StrBuf *Target,
                          int FormatTypeIndex);
 
 
-#define RegisterNamespace(a, b, c, d, e) RegisterNS(a, sizeof(a)-1, b, c, d, e)
+#define RegisterNamespace(a, b, c, d, e, f) RegisterNS(a, sizeof(a)-1, b, c, d, e, f)
+/**
+ * @Brief register a template token handler
+ * call this function in your InitModule_MODULENAME which will be called at the server start
+ * @param nMinArgs how much parameters does your token require at least?
+ * @param nMaxArgs how many parameters does your token accept?
+ * @param HandlerFunc your callback when the template is rendered and your token is there 
+ * @param PreEvalFunc is called when the template is parsed; you can do additional 
+ *        syntax checks here or pre-evaluate stuff for better performance
+ * @param ContextRequired if your token requires a specific context, else say CTX_NONE here.
+ */
 void RegisterNS(const char *NSName, long len, 
                int nMinArgs, 
                int nMaxArgs, 
                WCHandlerFunc HandlerFunc,
+               WCPreevalFunc PreEvalFunc,
                int ContextRequired);
 
+/**
+ * @Brief register a conditional token <pair> handler
+ * call this function in your InitModule_MODULENAME which will be called at the server start
+ * conditionals can be ? or ! with a pair or % similar to an implicit if
+ * @param Name whats the name of your conditional? should start with COND:
+ * @param len the token length so we don't have to measure it.
+ * @param nParams how many parameters does your conditional need on top of the default conditional parameters
+ * @param CondF your Callback to be called when the template is evaluated at runtime; return 0 or 1 to us please.
+ * @param ContextRequired if your token requires a specific context, else say CTX_NONE here.
+ */
 void RegisterConditional(const char *Name, long len, 
                         int nParams,
                         WCConditionalFunc CondF, 
index 40d66cc90244ff86cceb25bf5a6b0b2018f51b01..f3f233a0dac8811f76247300cf12622637d497bd 100644 (file)
@@ -730,18 +730,18 @@ InitModule_USEREDIT
        WebcitAddUrlHandler(HKEY("edituser"), edituser, 0);
        WebcitAddUrlHandler(HKEY("create_user"), create_user, 0);
 
-       RegisterNamespace("USERLIST:USERNAME",      0, 1, tmplput_USERLIST_UserName, CTX_USERLIST);
-       RegisterNamespace("USERLIST:PASSWD",        0, 1, tmplput_USERLIST_Password, CTX_USERLIST);
-       RegisterNamespace("USERLIST:ACCLVLNO",      0, 0, tmplput_USERLIST_AccessLevelNo, CTX_USERLIST);
-       RegisterNamespace("USERLIST:ACCLVLSTR",     0, 0, tmplput_USERLIST_AccessLevelStr, CTX_USERLIST);
-       RegisterNamespace("USERLIST:UID",           0, 0, tmplput_USERLIST_UID, CTX_USERLIST);
-       RegisterNamespace("USERLIST:LASTLOGON:STR", 0, 0, tmplput_USERLIST_LastLogonStr, CTX_USERLIST);
-       RegisterNamespace("USERLIST:LASTLOGON:NO",  0, 0, tmplput_USERLIST_LastLogonNo, CTX_USERLIST);
-       RegisterNamespace("USERLIST:NLOGONS",       0, 0, tmplput_USERLIST_nLogons, CTX_USERLIST);
-       RegisterNamespace("USERLIST:NPOSTS",        0, 0, tmplput_USERLIST_nPosts, CTX_USERLIST);
+       RegisterNamespace("USERLIST:USERNAME",      0, 1, tmplput_USERLIST_UserName, NULL, CTX_USERLIST);
+       RegisterNamespace("USERLIST:PASSWD",        0, 1, tmplput_USERLIST_Password, NULL, CTX_USERLIST);
+       RegisterNamespace("USERLIST:ACCLVLNO",      0, 0, tmplput_USERLIST_AccessLevelNo, NULL, CTX_USERLIST);
+       RegisterNamespace("USERLIST:ACCLVLSTR",     0, 0, tmplput_USERLIST_AccessLevelStr, NULL, CTX_USERLIST);
+       RegisterNamespace("USERLIST:UID",           0, 0, tmplput_USERLIST_UID, NULL, CTX_USERLIST);
+       RegisterNamespace("USERLIST:LASTLOGON:STR", 0, 0, tmplput_USERLIST_LastLogonStr, NULL, CTX_USERLIST);
+       RegisterNamespace("USERLIST:LASTLOGON:NO",  0, 0, tmplput_USERLIST_LastLogonNo, NULL, CTX_USERLIST);
+       RegisterNamespace("USERLIST:NLOGONS",       0, 0, tmplput_USERLIST_nLogons, NULL, CTX_USERLIST);
+       RegisterNamespace("USERLIST:NPOSTS",        0, 0, tmplput_USERLIST_nPosts, NULL, CTX_USERLIST);
                                                    
-       RegisterNamespace("USERLIST:FLAGS",         0, 0, tmplput_USERLIST_Flags, CTX_USERLIST);
-       RegisterNamespace("USERLIST:DAYSTILLPURGE", 0, 0, tmplput_USERLIST_DaysTillPurge, CTX_USERLIST);
+       RegisterNamespace("USERLIST:FLAGS",         0, 0, tmplput_USERLIST_Flags, NULL, CTX_USERLIST);
+       RegisterNamespace("USERLIST:DAYSTILLPURGE", 0, 0, tmplput_USERLIST_DaysTillPurge, NULL, CTX_USERLIST);
 
        RegisterConditional(HKEY("COND:USERNAME"),  0,    ConditionalUser, CTX_USERLIST);
        RegisterConditional(HKEY("COND:USERACCESS"), 0,   ConditionalUserAccess, CTX_USERLIST);
index 2aaca0060d17cc11495090fd232f8a5a09147fc4..013e38cd440fe5d206a6d2553564afd865e6cd74 100644 (file)
@@ -804,9 +804,9 @@ InitModule_WEBCIT
 
        WebcitAddUrlHandler(HKEY("401"), authorization_required, ANONYMOUS|COOKIEUNNEEDED);
        RegisterConditional(HKEY("COND:IMPMSG"), 0, ConditionalImportantMesage, CTX_NONE);
-       RegisterNamespace("CSSLOCAL", 0, 0, tmplput_csslocal, CTX_NONE);
-       RegisterNamespace("IMPORTANTMESSAGE", 0, 0, tmplput_importantmessage, CTX_NONE);
-       RegisterNamespace("TRAILING_JAVASCRIPT", 0, 0, tmplput_trailing_javascript, CTX_NONE);
+       RegisterNamespace("CSSLOCAL", 0, 0, tmplput_csslocal, NULL, CTX_NONE);
+       RegisterNamespace("IMPORTANTMESSAGE", 0, 0, tmplput_importantmessage, NULL, CTX_NONE);
+       RegisterNamespace("TRAILING_JAVASCRIPT", 0, 0, tmplput_trailing_javascript, NULL, CTX_NONE);
 
        snprintf(dir, SIZ, "%s/webcit.css", static_local_dir);
        if (!access(dir, R_OK)) {
index 408cf590dc4948002a21971a216c1608231cf9b1..dec178110e8b0041c6f64bb5351450de830bf40d 100644 (file)
@@ -328,16 +328,16 @@ InitModule_WHO
 
        RegisterIterator("WHOLIST", 0, NULL, GetWholistHash, NULL, DeleteWholistHash, CTX_WHO, CTX_NONE, IT_NOFLAG);
 
-       RegisterNamespace("WHO:NAME",        0, 1, tmplput_who_username, CTX_WHO);
-       RegisterNamespace("WHO:ROOM",        0, 1, tmplput_who_room, CTX_WHO);
-       RegisterNamespace("WHO:HOST",        0, 1, tmplput_who_host, CTX_WHO);
-       RegisterNamespace("WHO:REALROOM",    0, 1, tmplput_who_realroom, CTX_WHO);
-       RegisterNamespace("WHO:REALHOST",    0, 1, tmplput_who_realhost, CTX_WHO);
-       RegisterNamespace("WHO:LASTACTIVE",  0, 1, tmplput_who_lastactive, CTX_WHO);
-       RegisterNamespace("WHO:IDLESINCE",   0, 1, tmplput_who_idlesince, CTX_WHO);
-       RegisterNamespace("WHO:SESSION",     0, 1, tmplput_who_session, CTX_WHO);
-       RegisterNamespace("WHO:NSESSIONS",   0, 1, tmplput_who_nsessions, CTX_WHO);
-       RegisterNamespace("WHO:NSESSIONS",   0, 1, tmplput_who_nsessions, CTX_WHO);
+       RegisterNamespace("WHO:NAME",        0, 1, tmplput_who_username, NULL, CTX_WHO);
+       RegisterNamespace("WHO:ROOM",        0, 1, tmplput_who_room, NULL, CTX_WHO);
+       RegisterNamespace("WHO:HOST",        0, 1, tmplput_who_host, NULL, CTX_WHO);
+       RegisterNamespace("WHO:REALROOM",    0, 1, tmplput_who_realroom, NULL, CTX_WHO);
+       RegisterNamespace("WHO:REALHOST",    0, 1, tmplput_who_realhost, NULL, CTX_WHO);
+       RegisterNamespace("WHO:LASTACTIVE",  0, 1, tmplput_who_lastactive, NULL, CTX_WHO);
+       RegisterNamespace("WHO:IDLESINCE",   0, 1, tmplput_who_idlesince, NULL, CTX_WHO);
+       RegisterNamespace("WHO:SESSION",     0, 1, tmplput_who_session, NULL, CTX_WHO);
+       RegisterNamespace("WHO:NSESSIONS",   0, 1, tmplput_who_nsessions, NULL, CTX_WHO);
+       RegisterNamespace("WHO:NSESSIONS",   0, 1, tmplput_who_nsessions, NULL, CTX_WHO);
 
        RegisterConditional(HKEY("WHO:IDLE"),      1, conditional_who_idle, CTX_WHO);
        RegisterConditional(HKEY("WHO:NSESSIONS"), 1, conditional_who_nsessions, CTX_WHO);