From dca4414169da8ea7161d5b95fc9ccbefe5d39651 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Mon, 23 Apr 2012 14:06:34 -0400 Subject: [PATCH] Began fixing http://uncensored.citadel.org/wiki?page=stefan2012mar07?go=exterminate --- webcit/messages.c | 27 +++++++++++++-------------- webcit/msg_renderers.c | 5 ++++- webcit/webcit.h | 2 ++ webcit/wiki.c | 7 +------ 4 files changed, 20 insertions(+), 21 deletions(-) diff --git a/webcit/messages.c b/webcit/messages.c index 0c4786c87..f990c8700 100644 --- a/webcit/messages.c +++ b/webcit/messages.c @@ -5,17 +5,11 @@ * * This program is open source software. You can redistribute it and/or * modify it under the terms of the GNU General Public License, version 3. - * - * * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * - * - * */ #include "webcit.h" @@ -1017,7 +1011,7 @@ void post_message(void) StrBuf *Recp = NULL; StrBuf *Cc = NULL; StrBuf *Bcc = NULL; - const StrBuf *Wikipage = NULL; + char *wikipage = NULL; const StrBuf *my_email_addr = NULL; StrBuf *CmdBuf = NULL; StrBuf *references = NULL; @@ -1072,14 +1066,15 @@ void post_message(void) FreeStrBuf(&EmailAddress); FreeStrBuf(&EncBuf); - Wikipage = sbstr("page"); + wikipage = strdup(bstr("page")); + str_wiki_index(wikipage); my_email_addr = sbstr("my_email_addr"); HeaderLen = StrLength(Recp) + StrLength(encoded_subject) + StrLength(Cc) + StrLength(Bcc) + - StrLength(Wikipage) + + strlen(wikipage) + StrLength(my_email_addr) + StrLength(references); CmdBuf = NewStrBufPlain(NULL, sizeof (CMD) + HeaderLen); @@ -1091,11 +1086,12 @@ void post_message(void) ChrPtr(display_name), saving_to_drafts?"":ChrPtr(Cc), saving_to_drafts?"":ChrPtr(Bcc), - ChrPtr(Wikipage), + wikipage, ChrPtr(my_email_addr), ChrPtr(references)); FreeStrBuf(&references); FreeStrBuf(&encoded_subject); + free(wikipage); if ((HeaderLen + StrLength(sbstr("msgtext")) < 10) && (GetCount(WCC->attachments) == 0)){ @@ -1579,14 +1575,15 @@ void display_enter(void) const StrBuf *Recp = NULL; const StrBuf *Cc = NULL; const StrBuf *Bcc = NULL; - const StrBuf *Wikipage = NULL; + char *wikipage = NULL; StrBuf *CmdBuf = NULL; const char CMD[] = "ENT0 0|%s|%d|0||%s||%s|%s|%s"; Recp = sbstr("recp"); Cc = sbstr("cc"); Bcc = sbstr("bcc"); - Wikipage = sbstr("page"); + wikipage = strdup(bstr("page")); + str_wiki_index(wikipage); CmdBuf = NewStrBufPlain(NULL, sizeof (CMD) + @@ -1594,7 +1591,7 @@ void display_enter(void) StrLength(display_name) + StrLength(Cc) + StrLength(Bcc) + - StrLength(Wikipage)); + strlen(wikipage)); StrBufPrintf(CmdBuf, CMD, @@ -1603,9 +1600,11 @@ void display_enter(void) ChrPtr(display_name), ChrPtr(Cc), ChrPtr(Bcc), - ChrPtr(Wikipage)); + wikipage + ); serv_puts(ChrPtr(CmdBuf)); StrBuf_ServGetln(CmdBuf); + free(wikipage); rc = GetServerStatusMsg(CmdBuf, &Result, 0, 0); diff --git a/webcit/msg_renderers.c b/webcit/msg_renderers.c index c00817739..d2de1f4bd 100644 --- a/webcit/msg_renderers.c +++ b/webcit/msg_renderers.c @@ -938,7 +938,10 @@ void tmplput_EDIT_WIKI_BODY(StrBuf *Target, WCTemplputParams *TP) * to do it again. */ if (!havebstr("attach_button")) { - msgnum = locate_message_by_uid(BSTR("page")); + char *wikipage = strdup(bstr("page")); + str_wiki_index(wikipage); + msgnum = locate_message_by_uid(wikipage); + free(wikipage); if (msgnum >= 0L) { Buf = NewStrBuf(); read_message(Buf, HKEY("view_message_wikiedit"), msgnum, NULL, &Mime); diff --git a/webcit/webcit.h b/webcit/webcit.h index 3d5b86116..fd64a229c 100644 --- a/webcit/webcit.h +++ b/webcit/webcit.h @@ -756,6 +756,8 @@ void end_tab(int tabnum, int num_tabs); int get_time_format_cached (void); void display_wiki_pagelist(void); +void str_wiki_index(char *); + HashList *GetRoomListHashLKRA(StrBuf *Target, WCTemplputParams *TP); /* actual supported locales */ diff --git a/webcit/wiki.c b/webcit/wiki.c index 4f1413790..c1ba90512 100644 --- a/webcit/wiki.c +++ b/webcit/wiki.c @@ -5,17 +5,11 @@ * * This program is open source software. You can redistribute it and/or * modify it under the terms of the GNU General Public License, version 3. - * - * * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * - * - * - * */ #include "webcit.h" @@ -129,6 +123,7 @@ void display_wiki_page(void) output_headers(1, 1, 1, 0, 0, 0); roomname = sbstr("room"); safestrncpy(pagename, bstr("page"), sizeof pagename); + str_wiki_index(pagename); safestrncpy(rev, bstr("rev"), sizeof rev); do_revert = atoi(bstr("revert")); display_wiki_page_backend(roomname, pagename, rev, do_revert); -- 2.30.2