From 1cf2cb0ef6b92f64101abeda12fc9359e3f4b85a Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 14 Aug 2002 20:21:52 +0000 Subject: [PATCH] * Extend GETR/SETR to allow twiddling of bits in the QRflags2 bucket * New flag and config options to allow/disallow self-service list subscription and unsubscription to a room --- citadel/ChangeLog | 6 ++++++ citadel/ipcdef.h | 1 + citadel/room_ops.c | 17 +++++++++++++---- citadel/rooms.c | 11 +++++++++-- citadel/serv_listsub.c | 14 ++++++++++++++ citadel/techdoc/session.txt | 8 +++++++- 6 files changed, 50 insertions(+), 7 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index fa26bbb96..0f32fc0aa 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,9 @@ $Log$ + Revision 591.93 2002/08/14 20:21:52 ajc + * Extend GETR/SETR to allow twiddling of bits in the QRflags2 bucket + * New flag and config options to allow/disallow self-service list subscription + and unsubscription to a room + Revision 591.92 2002/08/14 02:36:05 ajc * WebCit list subscription integration @@ -3904,3 +3909,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import + diff --git a/citadel/ipcdef.h b/citadel/ipcdef.h index ba54081d0..9451f0fbd 100644 --- a/citadel/ipcdef.h +++ b/citadel/ipcdef.h @@ -59,6 +59,7 @@ struct CtdlServInfo { #define QR_MAILBOX 16384 /* Set if this is a private mailbox */ #define QR2_SYSTEM 1 /* System room; hide by default */ +#define QR2_SELFLIST 2 /* Self-service mailing list mgmt */ #define US_NEEDVALID 1 /* User needs to be validated */ #define US_PERM 4 /* Permanent user */ diff --git a/citadel/room_ops.c b/citadel/room_ops.c index e4efd211f..eb80025e8 100644 --- a/citadel/room_ops.c +++ b/citadel/room_ops.c @@ -497,10 +497,12 @@ void list_roomname(struct quickroom *qrbuf) } /* ...and now the other parameters */ - cprintf("|%u|%d|%d\n", + cprintf("|%u|%d|%d|%d\n", qrbuf->QRflags, (int) qrbuf->QRfloor, - (int) qrbuf->QRorder); + (int) qrbuf->QRorder, + (int) qrbuf->QRflags2 + ); } @@ -1005,7 +1007,7 @@ void cmd_getr(void) if (CtdlAccessCheck(ac_room_aide)) return; getroom(&CC->quickroom, CC->quickroom.QRname); - cprintf("%d%c%s|%s|%s|%d|%d|%d|%d\n", + cprintf("%d%c%s|%s|%s|%d|%d|%d|%d|%d|\n", CIT_OK, CtdlCheckExpress(), @@ -1022,7 +1024,9 @@ void cmd_getr(void) (int) CC->quickroom.QRfloor, (int) CC->quickroom.QRorder, - CC->quickroom.QRdefaultview); + CC->quickroom.QRdefaultview, + CC->quickroom.QRflags2 + ); } @@ -1222,6 +1226,11 @@ void cmd_setr(char *args) CC->quickroom.QRdefaultview = extract_int(args, 7); } + /* Second set of flags */ + if (num_parms(args) >= 9) { + CC->quickroom.QRflags2 = extract_int(args, 8); + } + /* Misc. flags */ CC->quickroom.QRflags = (extract_int(args, 3) | QR_INUSE); /* Clean up a client boo-boo: if the client set the room to diff --git a/citadel/rooms.c b/citadel/rooms.c index a19a89b17..7f6263420 100644 --- a/citadel/rooms.c +++ b/citadel/rooms.c @@ -387,11 +387,13 @@ void editthisroom(void) char rpass[10]; char rdir[15]; unsigned rflags; + unsigned rflags2; int rbump; char raide[32]; char buf[SIZ]; int rfloor; int rorder; + int rview; int expire_mode = 0; int expire_value = 0; int r; /* IPC response code */ @@ -410,6 +412,8 @@ void editthisroom(void) rflags = extract_int(&buf[4], 3); rfloor = extract_int(&buf[4], 4); rorder = extract_int(&buf[4], 5); + rview = extract_int(&buf[4], 6); + rflags2 = extract_int(&buf[4], 7); rbump = 0; /* Fetch the name of the current room aide */ @@ -489,6 +493,9 @@ void editthisroom(void) set_room_attr(rflags, "Visible directory", QR_VISDIR); } rflags = set_room_attr(rflags, "Network shared room", QR_NETWORK); + rflags2 = set_room_attr(rflags2, + "Self-service list subscribe/unsubscribe", + QR2_SELFLIST); rflags = set_room_attr(rflags, "Automatically make all messages anonymous", QR_ANONONLY); @@ -556,9 +563,9 @@ void editthisroom(void) r = CtdlIPCSetMessageExpirationPolicy(0, expire_mode, expire_value, buf); - snprintf(buf, sizeof buf, "SETR %s|%s|%s|%d|%d|%d|%d", + snprintf(buf, sizeof buf, "SETR %s|%s|%s|%d|%d|%d|%d|%d|%d", rname, rpass, rdir, rflags, rbump, rfloor, - rorder); + rorder, rview, rflags2); serv_puts(buf); serv_gets(buf); scr_printf("%s\n", &buf[4]); diff --git a/citadel/serv_listsub.c b/citadel/serv_listsub.c index 7a4cfaba7..bd84d6069 100644 --- a/citadel/serv_listsub.c +++ b/citadel/serv_listsub.c @@ -94,6 +94,13 @@ void do_subscribe(char *room, char *email, char *subtype, char *webpage) { return; } + if ((qrbuf.QRflags2 & QR2_SELFLIST) == 0) { + cprintf("%d '%s' " + "does not accept subscribe/unsubscribe requests.\n", + ERROR+HIGHER_ACCESS_REQUIRED, qrbuf.QRname); + return; + } + listsub_generate_token(token); begin_critical_section(S_NETCONFIGS); @@ -159,6 +166,13 @@ void do_confirm(char *room, char *token) { return; } + if ((qrbuf.QRflags2 & QR2_SELFLIST) == 0) { + cprintf("%d '%s' " + "does not accept subscribe/unsubscribe requests.\n", + ERROR+HIGHER_ACCESS_REQUIRED, qrbuf.QRname); + return; + } + begin_critical_section(S_NETCONFIGS); assoc_file_name(filename, sizeof filename, &qrbuf, "netconfigs"); ncfp = fopen(filename, "r+"); diff --git a/citadel/techdoc/session.txt b/citadel/techdoc/session.txt index ad0629daa..7fabd9f9b 100644 --- a/citadel/techdoc/session.txt +++ b/citadel/techdoc/session.txt @@ -238,7 +238,11 @@ by the '|' symbol, and then a number that may contain the following bits: #define QR_NETWORK 2048 /* Shared network room */ #define QR_PREFONLY 4096 /* Preferred status needed to enter */ #define QR_READONLY 8192 /* Aide status required to post */ - + + Then it returns another '|' symbol, followed by a second set of bits comprised +of the following: +#define QR2_SYSTEM 1 /* System room; hide by default */ +#define QR2_SELFLIST 2 /* Self-service mailing list mgmt */ Other bits may be defined in the future. The listing terminates, as with all listings, with "000" on a line by itself. @@ -671,6 +675,7 @@ and the room aide associated with the current room, can access this command. 4. The floor number on which the room resides 5. The room listing order 6. The default view for the room (see views.txt) + 7. A second set of flags (bits) associated with the room SETR (SET Room attributes) @@ -686,6 +691,7 @@ should be passed the following arguments: 5. The floor number on which the room should reside 6. The room listing order 7. The default view for the room (see views.txt) + 8. A second set of flags (buts) associated with the room *Important: You should always use GETR to retrieve the current attributes of the room, then change what you want to change, and then use SETR to write it -- 2.39.2