]> code.citadel.org Git - citadel.git/commitdiff
* room_ops.c: Added is_noneditable() function to replace all of the
authorArt Cancro <ajc@citadel.org>
Thu, 8 Oct 1998 19:36:10 +0000 (19:36 +0000)
committerArt Cancro <ajc@citadel.org>
Thu, 8 Oct 1998 19:36:10 +0000 (19:36 +0000)
          duplicated code present in all functions which edit room parameters.

citadel/ChangeLog
citadel/room_ops.c

index 908e422b149fe34a42294c309a76ca383e787a20..9e988bdd6e472adc0a8b62e176e6e505944d97ca 100644 (file)
@@ -1,3 +1,7 @@
+Thu Oct  8 15:34:45 EDT 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+       * room_ops.c: Added is_noneditable() function to replace all of the
+         duplicated code present in all functions which edit room parameters.
+
 1998-10-08 Nathan Bryant <bryant@cs.usm.maine.edu>
        * lots of warning fixes; builds with -std1 on dec unix
        * aidepost.c, citadel.h, citmail.c, file_ops.c, msgbase.c, netmailer.c,
index 28595541ba8fd92c3e6101de92ab07d9a944bcdd..9c972887b4d3e3312095207581fa3dae58941944 100644 (file)
@@ -375,7 +375,16 @@ int sort_msglist(long listptrs[], int oldcount)
        return(numitems);
        }
 
+
+
+/*
+ * Determine whether a given room is one of the base non-editable rooms
+ */
+int is_noneditable(struct quickroom *qrbuf) {
+       if (!strcasecmp(qrbuf->QRname, BASEROOM)) return(0);
+       else if (!strcasecmp(qrbuf->QRname, AIDEROOM)) return(0);
+       elsereturn(1);
+       }
 
 /* 
  * cmd_lrms()   -  List all accessible rooms, known or forgotten
@@ -811,8 +820,7 @@ void cmd_getr(void) {
                return;
                }
 
-       if ( (!strcasecmp(CC->quickroom.QRname, BASEROOM))
-            || (!strcasecmp(CC->quickroom.QRname, AIDEROOM)) ) {
+       if (is_noneditable(&CC->quickroom)) {
                cprintf("%d Can't edit this room.\n",ERROR+NOT_HERE);
                return;
                }
@@ -847,8 +855,7 @@ void cmd_setr(char *args) {
                return;
                }
 
-       if ( (!strcasecmp(CC->quickroom.QRname, BASEROOM))
-            || (!strcasecmp(CC->quickroom.QRname, AIDEROOM)) ) {
+       if (is_noneditable(&CC->quickroom)) {
                cprintf("%d Can't edit this room.\n",ERROR+NOT_HERE);
                return;
                }
@@ -927,8 +934,7 @@ void cmd_geta(void) {
                return;
                }
 
-       if ( (!strcasecmp(CC->quickroom.QRname, BASEROOM))
-            || (!strcasecmp(CC->quickroom.QRname, AIDEROOM)) ) {
+       if (is_noneditable(&CC->quickroom)) {
                cprintf("%d Can't edit this room.\n",ERROR+NOT_HERE);
                return;
                }
@@ -1097,8 +1103,7 @@ void cmd_kill(char *argbuf) {
                return;
                }
 
-       if ( (!strcasecmp(CC->quickroom.QRname, BASEROOM))
-            || (!strcasecmp(CC->quickroom.QRname, AIDEROOM)) ) {
+       if (is_noneditable(&CC->quickroom)) {
                cprintf("%d Can't edit this room.\n",ERROR+NOT_HERE);
                return;
                }