From a30fb6fef82ac275152edbce32bec7a4886cb66e Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sat, 21 Nov 1998 21:54:42 +0000 Subject: [PATCH] * 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. --- citadel/ChangeLog | 5 +++++ citadel/citadel.h | 4 ---- citadel/citadel.rc | 6 +++--- citadel/commands.c | 53 ++++++++++++++++++++++++++++------------------ citadel/ipcdef.h | 4 +++- citadel/routines.c | 5 +++++ citadel/user_ops.c | 27 ++++++++++++++--------- 7 files changed, 65 insertions(+), 39 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index 7110fc75f..8e575a833 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,3 +1,8 @@ +Sat Nov 21 16:53:30 EST 1998 Art Cancro + * 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 * setup.c: removed all prompts that can be configured from within the client in order to simplify the setup procedure diff --git a/citadel/citadel.h b/citadel/citadel.h index ef8cf236f..8bd905618 100644 --- a/citadel/citadel.h +++ b/citadel/citadel.h @@ -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... */ diff --git a/citadel/citadel.rc b/citadel/citadel.rc index 667d43c33..4fc8457ff 100644 --- a/citadel/citadel.rc +++ b/citadel/citadel.rc @@ -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 diff --git a/citadel/commands.c b/citadel/commands.c index 6262901d4..e30a34399 100644 --- a/citadel/commands.c +++ b/citadel/commands.c @@ -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; aQRnumber; - 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)); -- 2.39.2