From d113532edf96d15e1cc025c0e7bde57214b524d6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Wilfried=20G=C3=B6esgens?= Date: Tue, 19 Aug 2008 23:28:53 +0000 Subject: [PATCH] * fixes * handle roomname via static callback instead of svprintf --- webcit/context_loop.c | 1 + webcit/roomops.c | 12 ++++++++---- webcit/siteconfig.c | 3 +-- webcit/subst.c | 2 +- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/webcit/context_loop.c b/webcit/context_loop.c index eb73cd44c..41d39bd1e 100644 --- a/webcit/context_loop.c +++ b/webcit/context_loop.c @@ -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); diff --git a/webcit/roomops.c b/webcit/roomops.c index d1e3abd22..7014040f1 100644 --- a/webcit/roomops.c +++ b/webcit/roomops.c @@ -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); diff --git a/webcit/siteconfig.c b/webcit/siteconfig.c index 25e8ae034..bdcaf0530 100644 --- a/webcit/siteconfig.c +++ b/webcit/siteconfig.c @@ -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); diff --git a/webcit/subst.c b/webcit/subst.c index c3a1fffc0..139e91932 100644 --- a/webcit/subst.c +++ b/webcit/subst.c @@ -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; -- 2.30.2