* Extend GETR/SETR to allow twiddling of bits in the QRflags2 bucket
authorArt Cancro <ajc@citadel.org>
Wed, 14 Aug 2002 20:21:52 +0000 (20:21 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 14 Aug 2002 20:21:52 +0000 (20:21 +0000)
* New flag and config options to allow/disallow self-service list subscription
  and unsubscription to a room

citadel/ChangeLog
citadel/ipcdef.h
citadel/room_ops.c
citadel/rooms.c
citadel/serv_listsub.c
citadel/techdoc/session.txt

index fa26bbb9685ad6e834323d290a977c3585365c41..0f32fc0aa9b83f50aee8fe89e5ab47f07d7ed3ea 100644 (file)
@@ -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 <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index ba54081d0153b720cd5edce5ab680c8b3015bd95..9451f0fbd7d3362695ceb9baedb471b95cb84fef 100644 (file)
@@ -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                   */
index e4efd211f8f289d671411b80c5e182591083fd69..eb80025e8cea9a7a599f6c2c7235b1e1f3d67f5d 100644 (file)
@@ -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
index a19a89b174c41ea0576e0592a41272ce42b17ddb..7f62634202dcb08910daf33df142064adb80577a 100644 (file)
@@ -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]);
index 7a4cfaba71355b1d5466a966286e2b6d1690f1ba..bd84d60692f54e0616385cebc04b31e981e7d642 100644 (file)
@@ -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+");
index ad0629daa14d6c6c0720ff699b140e8425023291..7fabd9f9b1ea3ce9b18db1139b1e694adacb9acb 100644 (file)
@@ -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