From 24fb51aa089fb0d81bfe455789e99aec52b2d413 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Mon, 19 Oct 2009 19:16:23 +0000 Subject: [PATCH] * add way to have tokens do their custom parse-time preevaluation; this involves an api change to the RegisterNS function * load iterators by the new parse time evaluator, not at runtime; Now we can find non-existant iterators at parse-time. --- webcit/context_loop.c | 6 ++-- webcit/downloads.c | 8 ++--- webcit/http_datestring.c | 4 +-- webcit/ical_subst.c | 1 + webcit/iconbar.c | 2 +- webcit/inetconf.c | 2 +- webcit/msg_renderers.c | 62 ++++++++++++++++++------------------ webcit/netconf.c | 8 ++--- webcit/notes.c | 20 ++++++------ webcit/paramhandling.c | 4 +-- webcit/preferences.c | 10 +++--- webcit/roomlist.c | 38 +++++++++++----------- webcit/roomops.c | 6 ++-- webcit/serv_func.c | 16 +++++----- webcit/setup.c | 1 + webcit/siteconfig.c | 2 +- webcit/subst.c | 47 +++++++++++++++++++-------- webcit/subst.h | 69 +++++++++++++++++++++++++++------------- webcit/useredit.c | 22 ++++++------- webcit/webcit.c | 6 ++-- webcit/who.c | 20 ++++++------ 21 files changed, 201 insertions(+), 153 deletions(-) diff --git a/webcit/context_loop.c b/webcit/context_loop.c index bf2014404..aa8a467a9 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -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); /* diff --git a/webcit/downloads.c b/webcit/downloads.c index 28fcbe80f..d7b915c3c 100644 --- a/webcit/downloads.c +++ b/webcit/downloads.c @@ -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); diff --git a/webcit/http_datestring.c b/webcit/http_datestring.c index f3db04ce9..2394391f2 100644 --- a/webcit/http_datestring.c +++ b/webcit/http_datestring.c @@ -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); } /*@}*/ diff --git a/webcit/ical_subst.c b/webcit/ical_subst.c index 3de772c88..4693786cb 100644 --- a/webcit/ical_subst.c +++ b/webcit/ical_subst.c @@ -82,6 +82,7 @@ void CreateIcalComponendKindLookup(void) 0, 10, tmplput_ICalItem, + NULL, CTX_ICAL); Put(IcalComponentMap, icalproperty_kind_map[i].Name, diff --git a/webcit/iconbar.c b/webcit/iconbar.c index 34ce7ff24..beb449882 100644 --- a/webcit/iconbar.c +++ b/webcit/iconbar.c @@ -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); } diff --git a/webcit/inetconf.c b/webcit/inetconf.c index e4f7254ed..c8e100d0a 100644 --- a/webcit/inetconf.c +++ b/webcit/inetconf.c @@ -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); } diff --git a/webcit/msg_renderers.c b/webcit/msg_renderers.c index 4aaeefe06..bf387c3fc 100644 --- a/webcit/msg_renderers.c +++ b/webcit/msg_renderers.c @@ -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, diff --git a/webcit/netconf.c b/webcit/netconf.c index c8add9311..9b369e79b 100644 --- a/webcit/netconf.c +++ b/webcit/netconf.c @@ -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); } diff --git a/webcit/notes.c b/webcit/notes.c index 13e03723a..291712278 100644 --- a/webcit/notes.c +++ b/webcit/notes.c @@ -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); } diff --git a/webcit/paramhandling.c b/webcit/paramhandling.c index c00f9de03..f17fe08df 100644 --- a/webcit/paramhandling.c +++ b/webcit/paramhandling.c @@ -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); } diff --git a/webcit/preferences.c b/webcit/preferences.c index 8a04213c8..a8c1ce56c 100644 --- a/webcit/preferences.c +++ b/webcit/preferences.c @@ -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); diff --git a/webcit/roomlist.c b/webcit/roomlist.c index b0004d105..04cd48abb 100644 --- a/webcit/roomlist.c +++ b/webcit/roomlist.c @@ -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); diff --git a/webcit/roomops.c b/webcit/roomops.c index caa3d7e9a..cd7076227 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -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); diff --git a/webcit/serv_func.c b/webcit/serv_func.c index 165b192a2..ed5010e4e 100644 --- a/webcit/serv_func.c +++ b/webcit/serv_func.c @@ -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); */ } diff --git a/webcit/setup.c b/webcit/setup.c index ee8f81277..f0bf85fd8 100644 --- a/webcit/setup.c +++ b/webcit/setup.c @@ -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; diff --git a/webcit/siteconfig.c b/webcit/siteconfig.c index b15b41e20..67c954a71 100644 --- a/webcit/siteconfig.c +++ b/webcit/siteconfig.c @@ -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); diff --git a/webcit/subst.c b/webcit/subst.c index 7b189e4af..71b8e3ff3 100644 --- a/webcit/subst.c +++ b/webcit/subst.c @@ -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); diff --git a/webcit/subst.h b/webcit/subst.h index 36c68a2d2..d1157d87a 100644 --- a/webcit/subst.h +++ b/webcit/subst.h @@ -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 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, diff --git a/webcit/useredit.c b/webcit/useredit.c index 40d66cc90..f3f233a0d 100644 --- a/webcit/useredit.c +++ b/webcit/useredit.c @@ -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); diff --git a/webcit/webcit.c b/webcit/webcit.c index 2aaca0060..013e38cd4 100644 --- a/webcit/webcit.c +++ b/webcit/webcit.c @@ -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)) { diff --git a/webcit/who.c b/webcit/who.c index 408cf590d..dec178110 100644 --- a/webcit/who.c +++ b/webcit/who.c @@ -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); -- 2.30.2