* fixes
authorWilfried Göesgens <willi@citadel.org>
Tue, 19 Aug 2008 23:28:53 +0000 (23:28 +0000)
committerWilfried Göesgens <willi@citadel.org>
Tue, 19 Aug 2008 23:28:53 +0000 (23:28 +0000)
* handle roomname via static callback instead of svprintf

webcit/context_loop.c
webcit/roomops.c
webcit/siteconfig.c
webcit/subst.c

index eb73cd44cc5cd307a21257c16f5ba553f77e3fe4..41d39bd1e37169381e58a3c659f49d1a7e9d1bec 100644 (file)
@@ -489,6 +489,7 @@ void context_loop(int sock)
                TheSession->urlstrings = NULL;
                TheSession->vars = NULL;
                TheSession->nonce = rand();
+               TheSession->WBuf = NULL;
                TheSession->next = SessionList;
                SessionList = TheSession;
                pthread_mutex_unlock(&SessionListMutex);
index d1e3abd22ee6cc8b61b74c0fbc5753247d8198bb..7014040f17c02edf88e349619b798bae1fc4f82a 100644 (file)
@@ -444,7 +444,6 @@ void embed_search_o_matic(void) {
 void embed_room_banner(char *got, int navbar_style) {
        char buf[256];
        char buf2[1024];
-       char sanitized_roomname[256];
        char with_files[256];
        int file_count=0;
        
@@ -491,9 +490,7 @@ void embed_room_banner(char *got, int navbar_style) {
        }
        else
                strcpy (with_files, "");
-               
-       stresc(sanitized_roomname, 256, WC->wc_roomname, 1, 1);
-       svprintf(HKEY("ROOMNAME"), WCS_STRING, "%s", sanitized_roomname);
+       
        svprintf(HKEY("NUMMSGS"), WCS_STRING,
                _("%d new of %d messages%s"),
                extract_int(&got[4], 1),
@@ -3648,6 +3645,11 @@ void set_room_policy(void) {
 }
 
 
+void tmplput_RoomName(StrBuf *Target, int nArgs, WCTemplateToken *Tokens, void *Context)
+{
+       StrEscAppend(Target, NULL, WC->wc_roomname, 1, 1);
+}
+
 void _gotonext(void) { slrp_highest(); gotonext(); }
 void dotskip(void) {smart_goto(bstr("room"));}
 void _display_private(void) { display_private("", 0); }
@@ -3663,6 +3665,8 @@ void
 InitModule_ROOMOPS
 (void)
 {
+       RegisterNamespace("ROOMNAME", 0, 0, tmplput_RoomName);
+
        WebcitAddUrlHandler(HKEY("knrooms"), knrooms, 0);
        WebcitAddUrlHandler(HKEY("gotonext"), _gotonext, 0);
        WebcitAddUrlHandler(HKEY("skip"), gotonext, 0);
index 25e8ae034235c5afbb39b4d7581cba35bb892b4d..bdcaf0530c1828dcd315d7dd6674a1e14f95e7d0 100644 (file)
@@ -20,8 +20,7 @@ void LoadZoneFiles(void)
        long len;
        char this_zone[128];
        char *ZName;
-       HashPos  *it;
-
+       
        ZoneHash = NewHash(1, NULL);
        len = sizeof("UTC") + 1;
        ZName = malloc(len + 1);
index c3a1fffc02032e4da0e73edee2ac69b04e258076..139e91932995914e363df01e9e31df4b4d102466 100644 (file)
@@ -386,7 +386,7 @@ void PutNewToken(WCTemplate *Template, WCTemplateToken *NewToken)
                                sizeof(WCTemplateToken*) * 
                                Template->TokenSpace * 2);
                        memcpy(NewTokens, Template->Tokens, 
-                              sizeof(WCTemplateToken) * Template->nTokensUsed);
+                              sizeof(WCTemplateToken*) * Template->nTokensUsed);
                        free(Template->Tokens);
                        Template->TokenSpace *= 2;
                        Template->Tokens = NewTokens;