From: Wilfried Goesgens Date: Tue, 24 Apr 2012 09:45:28 +0000 (+0200) Subject: Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel X-Git-Tag: v8.11~75 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=dba8d7a9fb79dd7a776478781736c2425b19bd17;hp=91d5dd26d1d156e2bea3193b283144ff2f854d00;p=citadel.git Merge branch 'master' of ssh://git.citadel.org/appl/gitroot/citadel --- diff --git a/citadel/control.c b/citadel/control.c index 1e469b489..b81526cf1 100644 --- a/citadel/control.c +++ b/citadel/control.c @@ -693,8 +693,9 @@ void cmd_conf(char *argbuf) } put_config(); snprintf(buf, sizeof buf, - "The global system configuration has been edited by %s.\n", - CC->curr_user); + "The global system configuration has been edited by %s.\n", + (CC->logged_in ? CC->curr_user : "an administrator") + ); CtdlAideMessage(buf,"Citadel Configuration Manager Message"); if (!IsEmptyStr(config.c_logpages)) diff --git a/citadel/modules/wiki/serv_wiki.c b/citadel/modules/wiki/serv_wiki.c index 680f63733..07e5eed41 100644 --- a/citadel/modules/wiki/serv_wiki.c +++ b/citadel/modules/wiki/serv_wiki.c @@ -1,21 +1,15 @@ /* * Server-side module for Wiki rooms. This handles things like version control. * - * Copyright (c) 2009-2011 by the citadel.org team + * Copyright (c) 2009-2012 by the citadel.org team * * This program is open source software. You can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 3 of the - * License, or (at your option) any later version. + * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "sysdep.h" @@ -431,7 +425,7 @@ void wiki_rev_callback(char *name, char *filename, char *partnum, char *disp, CtdlDecodeBase64(memo, filename, strlen(filename)); extract_token(this_rev, memo, 0, '|', sizeof this_rev); - syslog(LOG_DEBUG, "callback found rev: %s\n", this_rev); + striplt(this_rev); /* Perform the patch */ fp = popen(PATCH " -f -s -p0 -r /dev/null >/dev/null 2>/dev/null", "w"); @@ -566,6 +560,7 @@ void wiki_rev(char *pagename, char *rev, char *operation) memset(&hecbd, 0, sizeof(struct HistoryEraserCallBackData)); hecbd.tempfilename = temp; hecbd.stop_when = rev; + striplt(hecbd.stop_when); mime_parser(msg->cm_fields['M'], NULL, *wiki_rev_callback, NULL, NULL, (void *)&hecbd, 0); CtdlFreeMessage(msg); diff --git a/citadel/room_ops.c b/citadel/room_ops.c index c91551739..c9e651b15 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -1608,7 +1608,9 @@ void cmd_setr(char *args) mkdir(buf, 0755); } snprintf(buf, sizeof buf, "The room \"%s\" has been edited by %s.\n", - CC->room.QRname, CC->curr_user); + CC->room.QRname, + (CC->logged_in ? CC->curr_user : "an administrator") + ); CtdlAideMessage(buf, "Room modification Message"); cprintf("%d Ok\n", CIT_OK); } @@ -1853,7 +1855,9 @@ void cmd_kill(char *argbuf) /* tell the world what we did */ snprintf(msg, sizeof msg, "The room \"%s\" has been deleted by %s.\n", - deleted_room_name, CC->curr_user); + deleted_room_name, + (CC->logged_in ? CC->curr_user : "an administrator") + ); CtdlAideMessage(msg, "Room Purger Message"); cprintf("%d '%s' deleted.\n", CIT_OK, deleted_room_name); } else { @@ -2071,7 +2075,7 @@ void cmd_cre8(char *args) snprintf(notification_message, 1024, "A new room called \"%s\" has been created by %s%s%s%s%s%s\n", new_room_name, - CC->user.fullname, + (CC->logged_in ? CC->curr_user : "an administrator"), ((newflags & QR_MAILBOX) ? " [personal]" : ""), ((newflags & QR_PRIVATE) ? " [private]" : ""), ((newflags & QR_GUESSNAME) ? " [hidden]" : ""), diff --git a/citadel/user_ops.c b/citadel/user_ops.c index 37cbfcd64..7bc53ce36 100644 --- a/citadel/user_ops.c +++ b/citadel/user_ops.c @@ -1587,7 +1587,8 @@ int CtdlInvtKick(char *iuser, int op) { iuser, ((op == 1) ? "invited to" : "kicked out of"), CC->room.QRname, - CC->user.fullname); + (CC->logged_in ? CC->user.fullname : "an administrator") + ); CtdlAideMessage(bbb,"User Admin Message"); return(0); @@ -1966,7 +1967,9 @@ void cmd_asup(char *cmdbuf) if (deleted) { snprintf(notify, SIZ, "User \"%s\" has been deleted by %s.\n", - usbuf.fullname, CC->user.fullname); + usbuf.fullname, + (CC->logged_in ? CC->user.fullname : "an administrator") + ); CtdlAideMessage(notify, "User Deletion Message"); } 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/static/t/view_message/wikiedit.html b/webcit/static/t/view_message/wikiedit.html index ac3f3102e..a44881877 100644 --- a/webcit/static/t/view_message/wikiedit.html +++ b/webcit/static/t/view_message/wikiedit.html @@ -1,2 +1,4 @@ - + + + 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..c72dbf656 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" @@ -49,31 +43,14 @@ void str_wiki_index(char *s) * "rev" may be set to an empty string to display the current version. * "do_revert" may be set to nonzero to perform a reversion to the specified version. */ -void display_wiki_page_backend(const StrBuf *roomname, char *pagename, char *rev, int do_revert) +void display_wiki_page_backend(char *pagename, char *rev, int do_revert) { const StrBuf *Mime; long msgnum = (-1L); char buf[256]; - str_wiki_index(pagename); - - if (StrLength(roomname) > 0) { - - /* If we're not in the correct room, try going there. */ - if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) { - gotoroom(roomname); - } - - /* If we're still not in the correct room, it doesn't exist. */ - if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) { - wc_printf(_("There is no room called '%s'."), ChrPtr(roomname)); - return; - } - - } - if (WC->CurRoom.view != VIEW_WIKI) { - wc_printf(_("'%s' is not a Wiki room."), ChrPtr(roomname)); + wc_printf(_("'%s' is not a Wiki room."), ChrPtr(WC->CurRoom.name) ); return; } @@ -81,7 +58,7 @@ void display_wiki_page_backend(const StrBuf *roomname, char *pagename, char *rev strcpy(pagename, "home"); } - /* Found it! Now read it. */ + str_wiki_index(pagename); /* convert index name to lowercase and numeric only */ if ((rev != NULL) && (strlen(rev) > 0)) { /* read an older revision */ @@ -92,7 +69,7 @@ void display_wiki_page_backend(const StrBuf *roomname, char *pagename, char *rev } } else { - /* read the current revision? */ + /* read the current revision */ msgnum = locate_message_by_uid(pagename); } @@ -121,17 +98,16 @@ void display_wiki_page_backend(const StrBuf *roomname, char *pagename, char *rev */ void display_wiki_page(void) { - const StrBuf *roomname; char pagename[128]; char rev[128]; int do_revert = 0; 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); + display_wiki_page_backend(pagename, rev, do_revert); wDumpContent(1); } @@ -141,30 +117,13 @@ void display_wiki_page(void) */ void tmplput_display_wiki_history(StrBuf *Target, WCTemplputParams *TP) { - const StrBuf *roomname; char pagename[128]; StrBuf *Buf; int row = 0; - roomname = sbstr("room"); safestrncpy(pagename, bstr("page"), sizeof pagename); str_wiki_index(pagename); - if (StrLength(roomname) > 0) { - - /* If we're not in the correct room, try going there. */ - if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) { - gotoroom(roomname); - } - - /* If we're still not in the correct room, it doesn't exist. */ - if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) { - wc_printf(_("There is no room called '%s'."), ChrPtr(roomname)); - return; - } - - } - serv_printf("WIKI history|%s", pagename); Buf = NewStrBuf(); StrBuf_ServGetln(Buf); @@ -204,10 +163,9 @@ void tmplput_display_wiki_history(StrBuf *Target, WCTemplputParams *TP) wc_printf(""); if (row == 0) { - wc_printf("%s", - bstr("page"), - _("(show)") - ); + wc_printf("%s", _("(show)")); wc_printf("(%s)", _("Current version")); } @@ -266,24 +224,9 @@ void display_wiki_history(void) */ void tmplput_display_wiki_pagelist(StrBuf *Target, WCTemplputParams *TP) { - const StrBuf *roomname; StrBuf *Buf; int row = 0; - roomname = sbstr("room"); - if (StrLength(roomname) > 0) { - /* If we're not in the correct room, try going there. */ - if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) { - gotoroom(roomname); - } - - /* If we're still not in the correct room, it doesn't exist. */ - if (strcasecmp(ChrPtr(roomname), ChrPtr(WC->CurRoom.name))) { - wc_printf(_("There is no room called '%s'."), ChrPtr(roomname)); - return; - } - } - if (!IsEmptyStr(bstr("query"))) { serv_printf("MSGS SEARCH|%s||4", bstr("query")); /* search-reduced list */ } @@ -336,7 +279,7 @@ int wiki_Cleanup(void **ViewSpecific) { char pagename[5]; safestrncpy(pagename, "home", sizeof pagename); - display_wiki_page_backend(WC->CurRoom.name, pagename, "", 0); + display_wiki_page_backend(pagename, "", 0); wDumpContent(1); return 0; }