+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
};
-/* 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...
*/
#
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
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))
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");
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;
+ }
}
}
+
}
#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);
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)
{
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-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));
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,
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));