From 66a3c3763a6d805e292ddde06c905dffccc0a877 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 28 Mar 2007 19:25:28 +0000 Subject: [PATCH] * New room flag QR2_COLLABDEL ('collaborative deletion') to allow anyone with permission to post in a room, to also delete messages from the room. Useful for collaborative public folders and the like. * Bumped the version number to 7.07 --- citadel/citadel.c | 2 ++ citadel/citadel.h | 2 +- citadel/citadel.nsi | 4 ++-- citadel/citadel_ipc.c | 1 + citadel/citadel_ipc.h | 1 + citadel/configure.ac | 2 +- citadel/ipcdef.h | 1 + citadel/messages.c | 14 +++++++++----- citadel/room_ops.c | 16 +++++++++++++--- citadel/rooms.c | 9 ++++++--- 10 files changed, 37 insertions(+), 15 deletions(-) diff --git a/citadel/citadel.c b/citadel/citadel.c index 0c5ccc835..b18eb2e92 100644 --- a/citadel/citadel.c +++ b/citadel/citadel.c @@ -74,6 +74,7 @@ char fullname[USERNAME_SIZE]; int screenwidth; int screenheight; unsigned room_flags; +unsigned room_flags2; char room_name[ROOMNAMELEN]; char *uglist[UGLISTLEN]; /* size of the ungoto list */ long uglistlsn[UGLISTLEN]; /* current read position for all the ungoto's. Not going to make any friends with this one. */ @@ -431,6 +432,7 @@ void dotgoto(CtdlIPC *ipc, char *towhere, int display_name, int fromungoto) } safestrncpy(room_name, room->RRname, ROOMNAMELEN); room_flags = room->RRflags; + room_flags = room->RRflags2; from_floor = curr_floor; curr_floor = room->RRfloor; diff --git a/citadel/citadel.h b/citadel/citadel.h index fbbbd44af..4a993c1b9 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -47,7 +47,7 @@ extern "C" { * usually more strict because you're not really supposed to dump/load and * upgrade at the same time. */ -#define REV_LEVEL 706 /* This version */ +#define REV_LEVEL 707 /* This version */ #define REV_MIN 591 /* Oldest compatible database */ #define EXPORT_REV_MIN 706 /* Oldest compatible export files */ diff --git a/citadel/citadel.nsi b/citadel/citadel.nsi index 3a8590d58..2b3a257ef 100644 --- a/citadel/citadel.nsi +++ b/citadel/citadel.nsi @@ -4,7 +4,7 @@ !include "${NSISDIR}\Contrib\Modern UI\System.nsh" !define MUI_PRODUCT "Citadel" -!define MUI_VERSION "7.06" +!define MUI_VERSION "7.07" !define MUI_WELCOMEPAGE !define MUI_LICENSEPAGE !define MUI_COMPONENTSPAGE @@ -18,7 +18,7 @@ ;!define MUI_ICON "${NSISDIR}\Contrib\Icons\modern-install.ico" ;!define MUI_UNICON "${NSISDIR}\Contrib\Icons\modern-uninstall.ico" -OutFile "citadel-7.06.exe" +OutFile "citadel-7.07.exe" BGGradient off LangString DESC_Citadel ${LANG_ENGLISH} "Citadel client and core libraries (required)" diff --git a/citadel/citadel_ipc.c b/citadel/citadel_ipc.c index 9b9500267..af0fbb40e 100644 --- a/citadel/citadel_ipc.c +++ b/citadel/citadel_ipc.c @@ -408,6 +408,7 @@ int CtdlIPCGotoRoom(CtdlIPC *ipc, const char *room, const char *passwd, rret[0]->RRaide = extract_int(cret, 8); rret[0]->RRnewmail = extract_long(cret, 9); rret[0]->RRfloor = extract_int(cret, 10); + rret[0]->RRflags2 = extract_int(cret, 14); } else { free(*rret); *rret = NULL; diff --git a/citadel/citadel_ipc.h b/citadel/citadel_ipc.h index d16689e20..6d748d8e5 100644 --- a/citadel/citadel_ipc.h +++ b/citadel/citadel_ipc.h @@ -93,6 +93,7 @@ struct ctdlipcroom { long RRtotal; /* Total number of messages in room */ char RRinfoupdated; /* Nonzero if info was updated */ unsigned RRflags; /* Various flags (see LKRN) */ + unsigned RRflags2; /* Various flags (see LKRN) */ long RRhighest; /* Highest message number in room */ long RRlastread; /* Highest message user has read */ char RRismailbox; /* Is this room a mailbox room? */ diff --git a/citadel/configure.ac b/citadel/configure.ac index 8d5cab7e6..d8de6d92d 100644 --- a/citadel/configure.ac +++ b/citadel/configure.ac @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. dnl $Id$ AC_PREREQ(2.52) -AC_INIT([Citadel], [7.06], [http://www.citadel.org/]) +AC_INIT([Citadel], [7.07], [http://www.citadel.org/]) AC_REVISION([$Revision$]) AC_CONFIG_SRCDIR([citserver.c]) AC_PREFIX_DEFAULT(/usr/local/citadel) diff --git a/citadel/ipcdef.h b/citadel/ipcdef.h index e3f8a374b..968be0134 100644 --- a/citadel/ipcdef.h +++ b/citadel/ipcdef.h @@ -55,6 +55,7 @@ extern "C" { #define QR2_SYSTEM 1 /* System room; hide by default */ #define QR2_SELFLIST 2 /* Self-service mailing list mgmt */ +#define QR2_COLLABDEL 4 /* Anyone who can post can delete */ #define US_NEEDVALID 1 /* User needs to be validated */ #define US_EXTEDIT 2 /* Always use external editor */ diff --git a/citadel/messages.c b/citadel/messages.c index d26508ea5..481d76075 100644 --- a/citadel/messages.c +++ b/citadel/messages.c @@ -71,6 +71,7 @@ int num_msgs; char rc_alt_semantics; extern char room_name[]; extern unsigned room_flags; +extern unsigned room_flags2; extern long highest_msg_read; extern char temp[]; extern char temp2[]; @@ -1652,9 +1653,10 @@ RMSGREAD: scr_flush(); /* space key same as */ if (e == 32) e = 'n'; /* del/move for aides only */ - if ((!is_room_aide) - && ((room_flags & QR_MAILBOX) == - 0)) { + if ( (!is_room_aide) + && ((room_flags & QR_MAILBOX) == 0) + && ((room_flags2 & QR2_COLLABDEL) == 0) + ) { if ((e == 'd') || (e == 'm')) e = 0; } @@ -1742,8 +1744,10 @@ RMSGREAD: scr_flush(); " N Next (continue with next message)\n" " Y My Next (continue with next message you authored)\n" " B Back (go back to previous message)\n"); - if ((is_room_aide) - || (room_flags & QR_MAILBOX)) { + if ( (is_room_aide) + || (room_flags & QR_MAILBOX) + || (room_flags2 & QR2_COLLABDEL) + ) { scr_printf(" D Delete this message\n" " M Move message to another room\n"); } diff --git a/citadel/room_ops.c b/citadel/room_ops.c index 8174dc978..ffe2078f9 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -44,7 +44,7 @@ struct floor *floorcache[MAXFLOORS]; /* - * Generic routine for determining user access to rooms + * Retrieve access control information for any user/room pair */ void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf, int *result, int *view) @@ -131,6 +131,15 @@ void CtdlRoomAccess(struct ctdlroom *roombuf, struct ctdluser *userbuf, retval = retval | UA_POSTALLOWED; } + /* If "collaborative deletion" is active for this room, any user who can post + * is also allowed to delete + */ + if (CC->room.QRflags2 & QR2_COLLABDEL) { + if (retval & UA_POSTALLOWED) { + retval = retval | UA_DELETEALLOWED; + } + } + } /* Check to see if the user has forgotten this room */ @@ -919,7 +928,7 @@ void usergoto(char *where, int display_result, int transiently, CC->curr_view = (int)vbuf.v_view; if (display_result) { - cprintf("%d%c%s|%d|%d|%d|%d|%ld|%ld|%d|%d|%d|%d|%d|%d|%d|\n", + cprintf("%d%c%s|%d|%d|%d|%d|%ld|%ld|%d|%d|%d|%d|%d|%d|%d|%d|\n", CIT_OK, CtdlCheckExpress(), truncated_roomname, (int)new_messages, @@ -934,7 +943,8 @@ void usergoto(char *where, int display_result, int transiently, (int)CC->room.QRfloor, (int)vbuf.v_view, (int)CC->room.QRdefaultview, - (int)is_trash + (int)is_trash, + (int)CC->room.QRflags2 ); } } diff --git a/citadel/rooms.c b/citadel/rooms.c index c7b239080..034e3be91 100644 --- a/citadel/rooms.c +++ b/citadel/rooms.c @@ -568,10 +568,13 @@ void editthisroom(CtdlIPC *ipc) "Preferred users only", QR_PREFONLY); attr->QRflags = set_room_attr(ipc, attr->QRflags, "Read-only room", QR_READONLY); - attr->QRflags = set_room_attr(ipc, attr->QRflags, - "Directory room", QR_DIRECTORY); + attr->QRflags2 = set_room_attr(ipc, attr->QRflags2, + "Allow message deletion by anyone who can post", + QR2_COLLABDEL); attr->QRflags = set_room_attr(ipc, attr->QRflags, "Permanent room", QR_PERMANENT); + attr->QRflags = set_room_attr(ipc, attr->QRflags, + "Directory room", QR_DIRECTORY); if (attr->QRflags & QR_DIRECTORY) { strprompt("Directory name", attr->QRdirname, 14); attr->QRflags = @@ -597,7 +600,7 @@ void editthisroom(CtdlIPC *ipc) "Ask users whether to make messages anonymous", QR_ANONOPT); } - attr->QRorder = intprompt("Listing order", attr->QRorder, 1, 127); + attr->QRorder = intprompt("Listing order", attr->QRorder, 0, 127); /* Ask about the room aide */ do { -- 2.39.2