* Added a fourth color mode in the client: "user" which turns color
authorArt Cancro <ajc@citadel.org>
Sat, 21 Nov 1998 21:54:42 +0000 (21:54 +0000)
committerArt Cancro <ajc@citadel.org>
Sat, 21 Nov 1998 21:54:42 +0000 (21:54 +0000)
          on or off according to a per-user flag stored on the server.  Added
          server-side support for this too, of course.

citadel/ChangeLog
citadel/citadel.h
citadel/citadel.rc
citadel/commands.c
citadel/ipcdef.h
citadel/routines.c
citadel/user_ops.c

index 7110fc75f210635b9ba1dbc9b7673189f3665169..8e575a83378a51ffff787011427ffaffca855f63 100644 (file)
@@ -1,3 +1,8 @@
+Sat Nov 21 16:53:30 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+       * Added a fourth color mode in the client: "user" which turns color
+         on or off according to a per-user flag stored on the server.  Added
+         server-side support for this too, of course.
+
 Fri Nov 20 20:29:07 EST 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * setup.c: removed all prompts that can be configured from within the
          client in order to simplify the setup procedure
index ef8cf236f3883affe88e2d56f298000250793036..8bd90561888d08dea694f322d6b53b47b83f444a 100644 (file)
@@ -110,10 +110,6 @@ struct usersupp {                  /* User record                      */
        };
 
 
-/* this is a mask for all of the bits the user is allowed to change */
-#define US_USER_SET    (US_LASTOLD | US_EXPERT | US_UNLISTED | \
-                       US_NOPROMPT | US_DISAPPEAR | US_PAGINATOR | US_FLOORS)
-
 /****************************************************************************
  * This is the control record for the message base... 
  */
index 667d43c334f60f3faad127ecf6e5f9e330bccb9f..4fc8457ff7e17cf487af6c9667064fb774632f8e 100644 (file)
@@ -32,11 +32,11 @@ editor=/usr/local/bin/simped
 #
 local_screen_dimensions=0
 
-# ANSI_COLOR should be set to "on" "off" or "auto" to control the use of
+# ANSI_COLOR should be set to on/off/auto/user to control the use of
 # color on the screen.  If it is set to "auto" then an autodetect will be
-# attempted.
+# attempted.  If it is set to "user" then it's a user-configurable option.
 #
-ansi_color=auto
+ansi_color=user
 
 # If DISPLAY_MESSAGE_NUMBERS is set to 1, then messages will be displayed
 # with their message numbers in the header.  This is ugly but some
index 6262901d48d432423d3d38b403461634580a7a21..e30a34399407266d28b40bc413c2103f5eb762a8 100644 (file)
@@ -411,6 +411,8 @@ void load_command_set(void) {
                        rc_ansi_color = 1;
                if (!strncasecmp(&buf[11], "auto", 4)) 
                        rc_ansi_color = 2;      /* autodetect */
+               if (!strncasecmp(&buf[11], "user", 4)) 
+                       rc_ansi_color = 3;      /* user config */
                }
 
            if (!struncmp(buf,"username=",9))
@@ -577,6 +579,12 @@ int getcmd(char *argbuf)
        int this_lazy_cmd;
        struct citcmd *cptr;
 
+       /* Switch color support on or off if we're in user mode */
+       if (rc_ansi_color == 3) {
+               if (userflags & US_COLOR) enable_color = 1;
+               else enable_color = 0;
+               }
+
        /* if we're running in idiot mode, display a cute little menu */
        IFNEXPERT formout("mainmenu");
 
@@ -942,32 +950,35 @@ void look_for_ansi(void) {
        else if (rc_ansi_color == 1) {
                enable_color = 1;
                }
+       else if (rc_ansi_color == 2) {
 
-       /* otherwise, do the auto-detect */
+               /* otherwise, do the auto-detect */
 
-       strcpy(abuf, "");
-
-       time(&now);
-       if ( (now - AnsiDetect) < 2 ) sleep(1);
+               strcpy(abuf, "");
 
-       do {
-               FD_ZERO(&rfds);
-               FD_SET(0,&rfds);
-               tv.tv_sec = 0;
-               tv.tv_usec = 1;
-
-               select(1, &rfds, NULL, NULL, &tv);
-               if (FD_ISSET(0, &rfds)) {
-                       abuf[strlen(abuf)+1] = 0;
-                       read(0, &abuf[strlen(abuf)], 1);
-                       }
+               time(&now);
+               if ( (now - AnsiDetect) < 2 ) sleep(1);
 
-               } while (FD_ISSET(0, &rfds));
+               do {
+                       FD_ZERO(&rfds);
+                       FD_SET(0,&rfds);
+                       tv.tv_sec = 0;
+                       tv.tv_usec = 1;
 
-       for (a=0; a<strlen(abuf); ++a) {
-               if ( (abuf[a] == 27) && (abuf[a+1] == '[')
-                  && (abuf[a+2] == '?') ) {
-                       enable_color = 1;
+                       select(1, &rfds, NULL, NULL, &tv);
+                       if (FD_ISSET(0, &rfds)) {
+                               abuf[strlen(abuf)+1] = 0;
+                               read(0, &abuf[strlen(abuf)], 1);
+                               }
+       
+                       } while (FD_ISSET(0, &rfds));
+       
+               for (a=0; a<strlen(abuf); ++a) {
+                       if ( (abuf[a] == 27) && (abuf[a+1] == '[')
+                       && (abuf[a+2] == '?') ) {
+                               enable_color = 1;
+                               }
                        }
                }
+
        }
index 9e597250d71a0ed45106722e65505695d1f04f2c..406275c1bb678f0cad1daa2971cfcb800d118d04 100644 (file)
@@ -68,8 +68,10 @@ struct CtdlServInfo {
 #define US_PAGINATOR   2048            /* Pause after each screen of text  */
 #define US_INTERNET    4096            /* UUCP/Internet mail privileges    */
 #define US_FLOORS      8192            /* User wants to see floors         */
+#define US_COLOR       16384           /* User wants ANSI color support    */
 #define US_USER_SET    (US_LASTOLD | US_EXPERT | US_UNLISTED | \
-                       US_NOPROMPT | US_DISAPPEAR | US_PAGINATOR | US_FLOORS)
+                       US_NOPROMPT | US_DISAPPEAR | US_PAGINATOR | \
+                       US_FLOORS | US_COLOR )
 
 void serv_puts(char *buf);
 void serv_gets(char *buf);
index 2cea59f5ae56f42dc9508a8a6fc2c298e7f7dffd..08051a136baf0f95e65cf4f73fc9521b045ca150 100644 (file)
@@ -41,6 +41,7 @@ extern char *axdefs[7];
 extern char sigcaught;
 extern struct CtdlServInfo serv_info;
 extern char rc_floor_mode;
+extern int rc_ansi_color;
 
 int struncmp(char *lstr, char *rstr, int len)
 {
@@ -273,6 +274,10 @@ void enter_config(int mode)
          flags = set_attr(flags,
                "View rooms by floor",US_FLOORS);
          }
+        if (rc_ansi_color == 3) {
+         flags = set_attr(flags,
+               "Enable color support",US_COLOR);
+         }
         }
 
        if (mode==2) {
index 6bffa6f3dc0ae7a68b4f97dfb8f2446f6de58250..45462e65202240d7ed4856bf93b7146ee33ad613 100644 (file)
@@ -109,18 +109,19 @@ void lputuser(struct usersupp *usbuf, char *name) {
  * Index-generating function used by Ctdl[Get|Set]Relationship
  */
 int GenerateRelationshipIndex( char *IndexBuf,
-                               struct usersupp *rel_user,
-                               struct quickroom *rel_room) {
+                               long RoomID,
+                               long RoomGen,
+                               long UserID) {
 
        struct {
-               long RoomID;
-               long RoomGen;
-               long UserID;
+               long iRoomID;
+               long iRoomGen;
+               long iUserID;
                } TheIndex;
 
-       TheIndex.RoomID = rel_room->QRnumber;
-       TheIndex.RoomGen = rel_room->QRgen;
-       TheIndex.UserID = rel_user->usernum;
+       TheIndex.iRoomID = RoomID;
+       TheIndex.iRoomGen = RoomGen;
+       TheIndex.iUserID = UserID;
 
        memcpy(IndexBuf, &TheIndex, sizeof(TheIndex));
        return(sizeof(TheIndex));
@@ -144,7 +145,10 @@ void CtdlSetRelationship(struct visit *newvisit,
         newvisit->v_usernum = rel_user->usernum;
 
        /* Generate an index */
-       IndexLen = GenerateRelationshipIndex(IndexBuf, rel_user, rel_room);
+       IndexLen = GenerateRelationshipIndex(IndexBuf,
+               rel_room->QRnumber,
+               rel_room->QRgen,
+               rel_user->usernum);
 
        /* Store the record */
        cdb_store(CDB_VISIT, IndexBuf, IndexLen,
@@ -164,7 +168,10 @@ void CtdlGetRelationship(struct visit *vbuf,
        struct cdbdata *cdbvisit;
 
        /* Generate an index */
-       IndexLen = GenerateRelationshipIndex(IndexBuf, rel_user, rel_room);
+       IndexLen = GenerateRelationshipIndex(IndexBuf,
+               rel_room->QRnumber,
+               rel_room->QRgen,
+               rel_user->usernum);
 
        /* Clear out the buffer */
        bzero(vbuf, sizeof(struct visit));