* add new 'Context' Parameter to the template call
authorWilfried Göesgens <willi@citadel.org>
Sun, 17 Aug 2008 10:53:12 +0000 (10:53 +0000)
committerWilfried Göesgens <willi@citadel.org>
Sun, 17 Aug 2008 10:53:12 +0000 (10:53 +0000)
* add PREF:VALUE("ConvigValueName") which will give you the value of a config
* add PREF:DESCR("ConfigValueName") which will give you the locale string describing that setting

20 files changed:
webcit/auth.c
webcit/graphics.c
webcit/inetconf.c
webcit/listsub.c
webcit/mainmenu.c
webcit/messages.c
webcit/openid.c
webcit/paging.c
webcit/preferences.c
webcit/pushemail.c
webcit/roomops.c
webcit/rss.c
webcit/sieve.c
webcit/subst.c
webcit/summary.c
webcit/sysmsgs.c
webcit/useredit.c
webcit/vcard_edit.c
webcit/webcit.c
webcit/webcit.h

index db5ed181c1d78b11f65c6be3a82e788da39796d9..0b01a16b8ebea184aa3fec6277dbd84e832abab4 100644 (file)
@@ -97,7 +97,7 @@ void display_login(char *mesg)
                svput("OFFER_OPENID_LOGIN", WCS_STRING, "");
        }
 
-       do_template("login");
+       do_template("login", NULL);
 
        wDumpContent(2);
 }
@@ -153,7 +153,7 @@ void display_openid_login(char *mesg)
                "Log in using a user name and password"
        );
 
-       do_template("openid_login");
+       do_template("openid_login", NULL);
        wDumpContent(2);
 }
 
@@ -188,7 +188,7 @@ void display_openid_name_request(char *claimed_id, char *username) {
        svprintf(HKEY("BOXTITLE"), WCS_STRING, _("%s - powered by <a href=\"http://www.citadel.org\">Citadel</a>"),
                serv_info.serv_humannode);
 
-       do_template("openid_manual_create");
+       do_template("openid_manual_create", NULL);
        wDumpContent(2);
 }
 
@@ -795,7 +795,7 @@ void display_changepw(void)
        output_headers(1, 1, 1, 0, 0, 0);
 
        svput("BOXTITLE", WCS_STRING, _("Change your password"));
-       do_template("beginbox");
+       do_template("beginbox", NULL);
 
        if (!IsEmptyStr(WC->ImportantMessage)) {
                wprintf("<span class=\"errormsg\">"
@@ -829,7 +829,7 @@ void display_changepw(void)
        wprintf("</div>\n");
        wprintf("</form>\n");
 
-       do_template("endbox");
+       do_template("endbox", NULL);
        wDumpContent(1);
 }
 
index 9cc0d4145babb464433ba2eabcec8e8ef3c48b66..601b4d0a43359aed77fef439aa3a2394dcc02ab6 100644 (file)
@@ -25,7 +25,7 @@ void display_graphics_upload(char *description, char *filename, char *uplurl)
        output_headers(1, 1, 1, 0, 0, 0);
 
        svput("BOXTITLE", WCS_STRING, _("Image upload"));
-       do_template("beginbox");
+       do_template("beginbox", NULL);
 
        wprintf("<form enctype=\"multipart/form-data\" action=\"%s\" "
                "method=\"post\" name=\"graphicsupload\">\n", uplurl);
@@ -52,7 +52,7 @@ void display_graphics_upload(char *description, char *filename, char *uplurl)
        wprintf("</div>\n");
        wprintf("</form>\n");
 
-       do_template("endbox");
+       do_template("endbox", NULL);
 
        wDumpContent(1);
 }
index ad27d97b595513639b3d4a44c33694e6754f4031..87964d30554208acc8c65a8d22bba9ef0b8ceaa8 100644 (file)
@@ -105,7 +105,7 @@ void display_inetconf(void)
                        wprintf("</td><td valign=top>");
                }
                svput("BOXTITLE", WCS_STRING, ic_boxtitle[which]);
-               do_template("beginbox");
+               do_template("beginbox", NULL);
                wprintf("<span class=\"menudesc\">");
                escputs(ic_desc[which]);
                wprintf("</span><br />");
@@ -141,7 +141,7 @@ void display_inetconf(void)
                wprintf("</td><td align=left>"
                        "<input type=\"submit\" name=\"oper\" value=\"Add\">"
                        "</td></tr></table></form>\n");
-               do_template("endbox");
+               do_template("endbox", NULL);
                wprintf("<br />");
        }
        wprintf("</td></tr></table></div>\n");
index ce9b1ed5250a37555f3167242adf42abe826b280..604d3d47b0acd46d5d61bb6c3eecee997a421075 100644 (file)
@@ -49,7 +49,7 @@ void do_listsub(void)
        wprintf("<table border=0 width=75%%><tr><td>");
 
        svput("BOXTITLE", WCS_STRING, _("List subscribe/unsubscribe"));
-       do_template("beginbox");
+       do_template("beginbox", NULL);
        wprintf("<div align=center><br>");
 
        /*
@@ -217,7 +217,7 @@ FORM:               wprintf("<form method=\"POST\" action=\"listsub\">\n");
        }
 
        wprintf("</div>");
-       do_template("endbox");
+       do_template("endbox", NULL);
        wprintf("</td></tr></table></div>");
 
        wprintf("</BODY></HTML>\n");
index 1ec145374b3d9a3894174584d2dd7bb9935b6bdf..040294d62d9da0e939e52b9a9917856770cc7e84 100644 (file)
@@ -17,7 +17,7 @@ void display_main_menu(void)
                "<tr><td colspan=\"2\" class=\"advanced\">\n");
 
        svput("BOXTITLE", WCS_STRING, _("Basic commands"));
-       do_template("beginbox");
+       do_template("beginbox", NULL);
 
        /* start of first column */
        wprintf("<ul class=\"adminitems col1\">");
@@ -108,7 +108,7 @@ void display_main_menu(void)
 
        wprintf("&nbsp;");
 
-       do_template("endbox");
+       do_template("endbox", NULL);
 
        wprintf("</td></tr>"
                "<tr valign=top><td width=50%%>");
@@ -262,7 +262,7 @@ void do_generic(void)
        serv_getln(buf, sizeof buf);
 
        svput("BOXTITLE", WCS_STRING, _("Server command results"));
-       do_template("beginbox");
+       do_template("beginbox", NULL);
 
        wprintf("<table border=0><tr><td>Command:</td><td><tt>");
        escputs(bstr("g_cmd"));
@@ -300,7 +300,7 @@ void do_generic(void)
        wprintf("<hr />");
        wprintf("<a href=\"display_generic\">Enter another command</a><br />\n");
        wprintf("<a href=\"display_advanced\">Return to menu</a>\n");
-       do_template("endbox");
+       do_template("endbox", NULL);
        wDumpContent(1);
 }
 
@@ -322,10 +322,10 @@ void display_menubar(int as_single_page) {
                        "body   { text-decoration: none; }\n"
                        "</style>\n"
                        "</head>\n");
-               do_template("background");
+               do_template("background", NULL);
        }
 
-       do_template("menubar");
+       do_template("menubar", NULL);
 
        if (as_single_page) {
                wDumpContent(2);
@@ -377,7 +377,7 @@ void display_shutdown(void)
                {
                        output_headers(1, 1, 1, 0, 0, 0);
                        svput("BOXTITLE", WCS_STRING, _("Message to your Users:"));
-                       do_template("beginbox");
+                       do_template("beginbox", NULL);
                        wprintf("<form action=\"server_shutdown\">\n"
                                "<input type=\"hidden\" name=\"when\" value=\"page\">\n"
                                "<input type=\"text\" name=\"message\" value=\"%s\">\n"
@@ -385,7 +385,7 @@ void display_shutdown(void)
                                "</form>\n",
                                _("The citadel server has to be restarted. It 'll be back in a minute.")
                                );
-                       do_template("endbox");
+                       do_template("endbox", NULL);
                        wDumpContent(1);
 
                        
index 86b6a7c2f0bfc9754d37613ab647394416489204..19f29b0451169853c971c138eb74bcb3403092bc 100644 (file)
@@ -1439,7 +1439,7 @@ void mobile_message_view(void) {
   msgnum = StrTol(WC->UrlFragment1);
   output_headers(1, 0, 0, 0, 0, 1);
   begin_burst();
-  do_template("msgcontrols");
+  do_template("msgcontrols", NULL);
   read_message(msgnum,1, "");
   wDumpContent(0);
 }
@@ -3660,7 +3660,7 @@ void display_enter(void)
         * The following template embeds the TinyMCE richedit control, and automatically
         * transforms the textarea into a richedit textarea.
         */
-       do_template("richedit");
+       do_template("richedit", NULL);
 
        /** Enumerate any attachments which are already in place... */
        wprintf("<div class=\"attachment buttons\"><img src=\"static/diskette_24x.gif\" class=\"imgedit\" > ");
index 58c3503ab46049cc8f4aee249dfeb82fbade4c2a..2d905bd50d915d7abd7a1c17227d41241e584373 100644 (file)
@@ -18,7 +18,7 @@ void display_openids(void)
        wprintf("<div class=\"fix_scrollbar_bug\">");
 
        svput("BOXTITLE", WCS_STRING, _("Manage Account/OpenID Associations"));
-       do_template("beginbox");
+       do_template("beginbox", NULL);
 
        if (serv_info.serv_supports_openid) {
 
@@ -54,7 +54,7 @@ void display_openids(void)
                wprintf(_("%s does not permit authentication via OpenID."), serv_info.serv_humannode);
        }
 
-       do_template("endbox");
+       do_template("endbox", NULL);
        wprintf("</div>");
        wDumpContent(2);
 }
index 502f9c069a1ff1a28a58de88e98b271d291a4717..ed05e2b7c1b29bb7d4b48d620da5b3c19b0dc064 100644 (file)
@@ -128,7 +128,7 @@ void do_chat(void)
         * output by begin_ajax_response() happen to be the ones we need.)
         */
        begin_ajax_response();
-       do_template("chatframeset");
+       do_template("chatframeset", NULL);
        end_ajax_response();
        return;
 }
index bf416215d4b0ec25bdb34398031cf27def04825c..0d4d4b3b34cc653c72769cb3c674accebfa27a49 100644 (file)
@@ -668,6 +668,27 @@ void set_preferences(void)
 #define PRF_QP_STRING 3
 #define PRF_YESNO 4
 
+
+void tmplput_CFG_Value(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context)
+{
+       StrBuf *Setting;
+       if (get_PREFERENCE(Token->Params[0]->Start,
+                          Token->Params[0]->len,
+                          &Setting))
+               StrBufAppendBuf(Target, Setting, 0);
+}
+
+void tmplput_CFG_Descr(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context)
+{
+       const char *SettingStr;
+       SettingStr = PrefGetLocalStr(Token->Params[0]->Start,
+                                    Token->Params[0]->len);
+       if (SettingStr != NULL) 
+               StrBufAppendBufPlain(Target, SettingStr, -1, 0);
+}
+
+
+
 void 
 InitModule_PREFERENCES
 (void)
@@ -685,5 +706,8 @@ InitModule_PREFERENCES
        RegisterPreference("signature",_("Use this signature:"),PRF_QP_STRING);
        RegisterPreference("default_header_charset", _("Default character set for email headers:") ,PRF_STRING);
        RegisterPreference("emptyfloors", _("Show empty floors"), PRF_YESNO);
+       
+       RegisterNS(HKEY("PREF:VALUE"), 1, 1, tmplput_CFG_Value);
+       RegisterNS(HKEY("PREF:DESCR"), 1, 1, tmplput_CFG_Descr);
 }
 /*@}*/
index 4b2e753d4ec203409f0b31cad281d81800853bf5..d4e06bed52e2fd450b583fd39c24d341369fc226 100644 (file)
@@ -62,10 +62,10 @@ void display_pushemail(void) {
        serv_printf("GOTO %s", WC->wc_roomname);
        serv_getln(buf, sizeof  buf);
        }
-output_headers(1, 1, 2, 0, 0, 0);
-do_template("pushemail");
+       output_headers(1, 1, 2, 0, 0, 0);
+       do_template("pushemail", NULL);
 //do_template("endbox");
-wDumpContent(1);
+       wDumpContent(1);
 }
 
 void save_pushemail(void) {
index 2a3070d88811ed2de6831f752521eb7919570f2a..d1e3abd22ee6cc8b61b74c0fbc5753247d8198bb 100644 (file)
@@ -259,13 +259,13 @@ void zapped_list(void)
        output_headers(1, 1, 1, 0, 0, 0);
 
        svput("BOXTITLE", WCS_STRING, _("Zapped (forgotten) rooms"));
-       do_template("beginbox");
+       do_template("beginbox", NULL);
 
        listrms("LZRM -1");
 
        wprintf("<br /><br />\n");
        wprintf(_("Click on any room to un-zap it and goto that room.\n"));
-       do_template("endbox");
+       do_template("endbox", NULL);
        wDumpContent(1);
 }
 
@@ -506,7 +506,7 @@ void embed_room_banner(char *got, int navbar_style) {
        svcallback("SEARCHOMATIC", embed_search_o_matic);
        svcallback("START", offer_start_page); 
  
-       do_template("roombanner");
+       do_template("roombanner", NULL);
        // roombanner contains this for mobile
        if (navbar_style != navbar_none && !WC->is_mobile) { 
 
@@ -2408,7 +2408,7 @@ void display_entroom(void)
        output_headers(1, 1, 1, 0, 0, 0);
 
        svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Create a new room"));
-       do_template("beginbox");
+       do_template("beginbox", NULL);
 
        wprintf("<form name=\"create_room_form\" method=\"POST\" action=\"entroom\">\n");
        wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
@@ -2530,7 +2530,7 @@ void display_entroom(void)
                fmout("LEFT");
        }
 
-       do_template("endbox");
+       do_template("endbox", NULL);
 
        wDumpContent(1);
 }
@@ -2635,7 +2635,7 @@ void display_private(char *rname, int req_pass)
        output_headers(1, 1, 1, 0, 0, 0);
 
        svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Go to a hidden room"));
-       do_template("beginbox");
+       do_template("beginbox", NULL);
 
        wprintf("<p>");
        wprintf(_("If you know the name of a hidden (guess-name) or "
@@ -2672,7 +2672,7 @@ void display_private(char *rname, int req_pass)
        );
        wprintf("</div></form>\n");
 
-       do_template("endbox");
+       do_template("endbox", NULL);
 
        wDumpContent(1);
 }
@@ -3126,7 +3126,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
                if ( (strcasecmp(floor_name, old_floor_name))
                   && (!IsEmptyStr(old_floor_name)) ) {
                        /* End inner box */
-                       do_template("endbox");
+                       do_template("endbox", NULL);
                        wprintf("<br>");
 
                        ++num_boxes;
@@ -3143,7 +3143,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
                        /** Begin inner box */
                        stresc(boxtitle, 256, floor_name, 1, 0);
                        svprintf(HKEY("BOXTITLE"), WCS_STRING, boxtitle);
-                       do_template("beginbox");
+                       do_template("beginbox", NULL);
                }
 
                oldlevels = levels;
@@ -3181,7 +3181,7 @@ void do_rooms_view(struct folder *fold, int max_folders, int num_floors) {
                }
        }
        /** End the final inner box */
-       do_template("endbox");
+       do_template("endbox", NULL);
 
        wprintf("</td></tr></table>\n");
 }
index 062227d1839d2915b84a3195aaf6e9b00bb58a94..fb6cb59267567c397f7a14221c8f6261df62994a 100644 (file)
@@ -174,7 +174,7 @@ void display_rss(char *roomname, char *request_method)
                svput("822_PUB_DATE", WCS_STRING, date);
        }
        svput("GENERATOR", WCS_STRING, PACKAGE_STRING);
-       do_template("rss_head");
+       do_template("rss_head", NULL);
 
        /** Read all messages and output as RSS items */
        for (a = 0; a < nummsgs; ++a) {
@@ -230,7 +230,7 @@ void display_rss(char *roomname, char *request_method)
                        svprintf(HKEY("822_PUB_DATE"),WCS_STRING, _("%s"), date);
                }
                svprintf(HKEY("GUID"), WCS_STRING,"%s", msgn);
-               do_template("rss_item");
+               do_template("rss_item", NULL);
                /** Now the hard part, the message itself */
                strcpy(content_type, "text/plain");
                while (serv_getln(buf, sizeof buf), !IsEmptyStr(buf)) {
@@ -343,7 +343,7 @@ void display_rss(char *roomname, char *request_method)
 
 ENDBODY:
                //wprintf("   </item>\n");
-               do_template("rss_item_end");
+               do_template("rss_item_end", NULL);
 ENDITEM:
                now = 0L;
        }
index d4d00dab74771c026a5db96cd60bc1e8f8981f87..370f3c611d23550c39eee212502a86b8135850b4 100644 (file)
@@ -649,7 +649,7 @@ void display_add_remove_scripts(char *message)
        wprintf("<table border=0 cellspacing=10><tr valign=top><td>\n");
 
        svput("BOXTITLE", WCS_STRING, _("Add a new script"));
-       do_template("beginbox");
+       do_template("beginbox", NULL);
 
        wprintf(_("To create a new script, enter the desired "
                "script name in the box below and click 'Create'."));
@@ -662,19 +662,19 @@ void display_add_remove_scripts(char *message)
                "<input type=\"submit\" name=\"create_button\" value=\"%s\">"
                "</form></center>\n", _("Create"));
 
-       do_template("endbox");
+       do_template("endbox", NULL);
 
        svput("BOXTITLE", WCS_STRING, _("Edit scripts"));
-       do_template("beginbox");
+       do_template("beginbox", NULL);
        wprintf("<br /><div align=center><a href=\"display_sieve\">%s</a><br /><br />\n",
                _("Return to the script editing screen")
        );
-       do_template("endbox");
+       do_template("endbox", NULL);
 
        wprintf("</td><td>");
 
        svput("BOXTITLE", WCS_STRING, _("Delete scripts"));
-       do_template("beginbox");
+       do_template("beginbox", NULL);
 
        wprintf(_("To delete an existing script, select the script "
                "name from the list and click 'Delete'."));
@@ -702,7 +702,7 @@ void display_add_remove_scripts(char *message)
         wprintf("<input type=\"submit\" name=\"delete_button\" value=\"%s\" "
                "onClick=\"return confirm('%s');\">", _("Delete script"), _("Delete this script?"));
         wprintf("</form></center>\n");
-       do_template("endbox");
+       do_template("endbox", NULL);
 
        wprintf("</td></tr></table>\n");
 
index 45af8bf9978bc71cc80708560d439c1fb05c5305..d52fc4f0ac50276917594487ceb6ed14a7c91c57 100644 (file)
@@ -316,7 +316,7 @@ void print_value_of(const char *keyname, size_t keylen) {
 
        /*if (WCC->vars != NULL) PrintHash(WCC->vars, VarPrintTransition, VarPrintEntry);*/
        if (keyname[0] == '=') {
-               DoTemplate(keyname+1, keylen - 1);
+               DoTemplate(keyname+1, keylen - 1, NULL);
        }
        /** Page-local variables */
        if ((WCC->vars!= NULL) && GetHash(WCC->vars, keyname, keylen, &vVar)) {
@@ -497,7 +497,7 @@ void FreeWCTemplate(void *vFreeMe)
        free(FreeMe);
 }
 
-void EvaluateToken(StrBuf *Target, WCTemplateToken *Token)
+void EvaluateToken(StrBuf *Target, WCTemplateToken *Token, void *Context)
 {
        void *vVar;
 // much output, since pName is not terminated...
@@ -516,7 +516,8 @@ void EvaluateToken(StrBuf *Target, WCTemplateToken *Token)
                else {
                        Handler->HandlerFunc(Target, 
                                             Token->nParameters,
-                                            &Token); /*TODO: subset of that */
+                                            Token,
+                                            Context); /*TODO: subset of that */
                
                        
                }
@@ -526,7 +527,7 @@ void EvaluateToken(StrBuf *Target, WCTemplateToken *Token)
        }
 }
 
-void ProcessTemplate(WCTemplate *Tmpl, StrBuf *Target)
+void ProcessTemplate(WCTemplate *Tmpl, StrBuf *Target, void *Context)
 {
        int done = 0;
        int i;
@@ -545,7 +546,7 @@ void ProcessTemplate(WCTemplate *Tmpl, StrBuf *Target)
                        StrBufAppendBufPlain(
                                Target, pData, 
                                Tmpl->Tokens[i]->pTokenStart - pData, 0);
-                       EvaluateToken(Target, Tmpl->Tokens[i]);
+                       EvaluateToken(Target, Tmpl->Tokens[i], Context);
                        pData = Tmpl->Tokens[i++]->pTokenEnd + 1;
                }
        }
@@ -632,7 +633,7 @@ void *load_template(StrBuf *filename, StrBuf *Key, HashList *PutThere)
  * \brief Display a variable-substituted template
  * \param templatename template file to load
  */
-void DoTemplate(const char *templatename, long len) 
+void DoTemplate(const char *templatename, long len, void *Context
 {
        HashList *Static;
        HashList *StaticLocal;
@@ -654,7 +655,7 @@ void DoTemplate(const char *templatename, long len)
        }
        if (vTmpl == NULL) 
                return;
-       ProcessTemplate(vTmpl, WC->WBuf);       
+       ProcessTemplate(vTmpl, WC->WBuf, Context);      
 }
 
 int LoadTemplateDir(const char *DirName, HashList *wireless, HashList *big)
@@ -721,49 +722,49 @@ void InitTemplateCache(void)
                        LocalTemplateCache);
 }
 
-void tmplput_serv_ip(StrBuf *Target, int nArgs, WCTemplateToken **Tokens)
+void tmplput_serv_ip(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
 {
        StrBufAppendPrintf(Target, "%d", WC->ctdl_pid);
 }
 
-void tmplput_serv_nodename(StrBuf *Target, int nArgs, WCTemplateToken **Tokens)
+void tmplput_serv_nodename(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
 {
        escputs(serv_info.serv_nodename); ////TODO: respcect Target
 }
 
-void tmplput_serv_humannode(StrBuf *Target, int nArgs, WCTemplateToken **Tokens)
+void tmplput_serv_humannode(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
 {
        escputs(serv_info.serv_humannode);////TODO: respcect Target
 }
 
-void tmplput_serv_fqdn(StrBuf *Target, int nArgs, WCTemplateToken **Tokens)
+void tmplput_serv_fqdn(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
 {
        escputs(serv_info.serv_fqdn);////TODO: respcect Target
 }
 
-void tmmplput_serv_software(StrBuf *Target, int nArgs, WCTemplateToken **Tokens)
+void tmmplput_serv_software(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
 {
        escputs(serv_info.serv_software);////TODO: respcect Target
 }
 
-void tmplput_serv_rev_level(StrBuf *Target, int nArgs, WCTemplateToken **Tokens)
+void tmplput_serv_rev_level(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
 {
        StrBufAppendPrintf(Target, "%d.%02d",
                            serv_info.serv_rev_level / 100,
                            serv_info.serv_rev_level % 100);
 }
 
-void tmmplput_serv_bbs_city(StrBuf *Target, int nArgs, WCTemplateToken **Tokens)
+void tmmplput_serv_bbs_city(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
 {
        escputs(serv_info.serv_bbs_city);////TODO: respcect Target
 }
 
-void tmplput_current_user(StrBuf *Target, int nArgs, WCTemplateToken **Tokens)
+void tmplput_current_user(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
 {
        escputs(WC->wc_fullname);////TODO: respcect Target
 }
 
-void tmplput_current_room(StrBuf *Target, int nArgs, WCTemplateToken **Tokens)
+void tmplput_current_room(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
 {
        escputs(WC->wc_roomname);////TODO: respcect Target
 }
index f7230e6b6aafd42bff7ec3122a6d387c89d69940..ce67551c57f4ccbd7bd6ed642df7c27edf6a793e 100644 (file)
@@ -29,9 +29,9 @@ void output_date(void) {
  */
 void dummy_section(void) {
        svput("BOXTITLE", WCS_STRING, "(dummy&nbsp;section)");
-       do_template("beginbox");
+       do_template("beginbox", NULL);
        wprintf(_("(nothing)"));
-       do_template("endbox");
+       do_template("endbox", NULL);
 }
 
 
index b734e16f01b80559e1981b099688dbbfe419231c..d626fbc6b11e2eb370257c3c731b5144edff3d8a 100644 (file)
@@ -38,7 +38,7 @@ void display_edit(char *description, char *check_cmd,
        }
 
        svprintf(HKEY("BOXTITLE"), WCS_STRING, _("Edit %s"), description);
-       do_template("beginbox");
+       do_template("beginbox", NULL);
 
        wprintf(_("Enter %s below. Text is formatted to the reader's browser."
                " A newline is forced by preceding the next line by a blank."), description);
@@ -57,7 +57,7 @@ void display_edit(char *description, char *check_cmd,
        wprintf("<input type=\"submit\" name=\"cancel_button\" value=\"%s\"><br />\n", _("Cancel"));
        wprintf("</div></form>\n");
 
-       do_template("endbox");
+       do_template("endbox", NULL);
        wDumpContent(1);
 }
 
index ed4db3ea932b1f4025fb26e8cd8cadf001ccaeab..f392d3997a420c5ec8f0a46f1ead58a7344575b2 100644 (file)
@@ -37,7 +37,7 @@ void select_user_to_edit(char *message, char *preselect)
        wprintf("<table border=0 cellspacing=10><tr valign=top><td>\n");
 
        svput("BOXTITLE", WCS_STRING, _("Add users"));
-       do_template("beginbox");
+       do_template("beginbox", NULL);
 
        wprintf(_("To create a new user account, enter the desired "
                "user name in the box below and click 'Create'."));
@@ -50,12 +50,12 @@ void select_user_to_edit(char *message, char *preselect)
                "<input type=\"submit\" name=\"create_button\" value=\"%s\">"
                "</form></center>\n", _("Create"));
 
-       do_template("endbox");
+       do_template("endbox", NULL);
 
        wprintf("</td><td>");
 
        svput("BOXTITLE", WCS_STRING, _("Edit or Delete users"));
-       do_template("beginbox");
+       do_template("beginbox", NULL);
 
        wprintf(_("To edit an existing user account, select the user "
                "name from the list and click 'Edit'."));
@@ -86,7 +86,7 @@ void select_user_to_edit(char *message, char *preselect)
         wprintf("<input type=\"submit\" name=\"delete_button\" value=\"%s\" "
                "onClick=\"return confirm('%s');\">", _("Delete user"), _("Delete this user?"));
         wprintf("</form></center>\n");
-       do_template("endbox");
+       do_template("endbox", NULL);
 
        wprintf("</td></tr></table>\n");
 
index d0e3ef7a074e5733721c98254d52327a8abdbce9..6eabd801c3080500ea98a4514122cf0b7b05d771 100644 (file)
@@ -188,7 +188,7 @@ void do_edit_vcard(long msgnum, char *partnum, char *return_to, char *force_room
        output_headers(1, 1, 1, 0, 0, 0);
 
        svput("BOXTITLE", WCS_STRING, _("Edit contact information"));
-       do_template("beginbox");
+       do_template("beginbox", NULL);
 
        wprintf("<form method=\"POST\" action=\"submit_vcard\">\n");
        wprintf("<input type=\"hidden\" name=\"nonce\" value=\"%d\">\n", WC->nonce);
@@ -360,7 +360,7 @@ void do_edit_vcard(long msgnum, char *partnum, char *return_to, char *force_room
        );
        
        wprintf("</td></tr></table>\n");
-       do_template("endbox");
+       do_template("endbox", NULL);
        wDumpContent(1);
 }
 
index f510e27bbd37301bc18243c7ccbf75bf0fe2be43..723bc0db9113acb70e403c13f887a5d24d656a7a 100644 (file)
@@ -399,7 +399,7 @@ void wDumpContent(int print_standard_html_footer)
 {
        if (print_standard_html_footer) {
                wprintf("</div>\n");    /* end of "text" div */
-               do_template("trailing");
+               do_template("trailing", NULL);
        }
 
        /* If we've been saving it all up for one big output burst,
@@ -742,7 +742,7 @@ void output_headers(        int do_httpheaders,     /* 1 = output HTTP headers
                           "<link href=\"static.local/webcit.css\" rel=\"stylesheet\" type=\"text/css\">"
                        );
                }
-               do_template("head");
+               do_template("head", NULL);
        }
 
        /* ICONBAR */
@@ -830,7 +830,7 @@ void print_menu_box(char* Title, char *Class, int nLines, ...)
        long i;
        
        svput("BOXTITLE", WCS_STRING, Title);
-       do_template("beginbox");
+       do_template("beginbox", NULL);
        
        wprintf("<ul class=\"%s\">", Class);
        
@@ -847,7 +847,7 @@ void print_menu_box(char* Title, char *Class, int nLines, ...)
        
        wprintf("</ul>");
        
-       do_template("endbox");
+       do_template("endbox", NULL);
 }
 
 
@@ -1094,7 +1094,7 @@ void blank_page(void) {
  * A template has been requested
  */
 void url_do_template(void) {
-       do_template(bstr("template"));
+       do_template(bstr("template"), NULL);
 }
 
 
@@ -1134,7 +1134,7 @@ void change_start_page(void) {
        set_preference("startpage", NewStrBufPlain(bstr("startpage"), -1), 1);
 
        output_headers(1, 1, 0, 0, 0, 0);
-       do_template("newstartpage");
+       do_template("newstartpage", NULL);
        wDumpContent(1);
 }
 
index d263e643997c9b2d8a7a81dd00f006f4b3603bd8..3923d5aca84ed37609c727a1471c1d5e57f4ac0b 100644 (file)
@@ -316,7 +316,9 @@ typedef struct _TemplateToken {
        TemplateParam *Params[MAXPARAM];
 } WCTemplateToken;
 
-typedef void (*WCHandlerFunc)(StrBuf *Target, int nArgs, WCTemplateToken **Tokens);
+typedef void (*WCHandlerFunc)(StrBuf *Target, int nArgs, WCTemplateToken *Token, void *Context);
+
+void RegisterNS(const char *NSName, long len, int nMinArgs, int nMaxArgs, WCHandlerFunc HandlerFunc);
 
 /**
  * \brief Values for wcs_type
@@ -644,8 +646,8 @@ void SVCALLBACK(char *keyname, var_callback_fptr fcn_ptr);
 void SVCallback(char *keyname, size_t keylen,  var_callback_fptr fcn_ptr);
 #define svcallback(a, b) SVCallback(a, sizeof(a) - 1, b)
 
-void DoTemplate(const char *templatename, long len);
-#define do_template(a) DoTemplate(a, sizeof(a) -1);
+void DoTemplate(const char *templatename, long len, void *Context);
+#define do_template(a, b) DoTemplate(a, sizeof(a) -1, b);
 
 
 int lingering_close(int fd);