From 5c726c0fc290dcbc8a89c34573856b7b46b24d41 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Wed, 15 Mar 2000 03:04:54 +0000 Subject: [PATCH] * Added DEXP server command to disable incoming express messages. * uiet mode client side command to set/clear DEXP mode. * nown rooms list displays through the paginator. --- citadel/ChangeLog | 6 +++- citadel/citadel.c | 4 +++ citadel/citadel.rc | 1 + citadel/client_chat.c | 29 ++++++++++++++++++ citadel/client_chat.h | 1 + citadel/rooms.c | 20 +++++++++++++ citadel/serv_chat.c | 59 ++++++++++++++++++++++++++++--------- citadel/server.h | 1 + citadel/techdoc/session.txt | 18 +++++++++-- 9 files changed, 121 insertions(+), 18 deletions(-) diff --git a/citadel/ChangeLog b/citadel/ChangeLog index d9729533d..c0be7e97d 100644 --- a/citadel/ChangeLog +++ b/citadel/ChangeLog @@ -1,4 +1,9 @@ $Log$ +Revision 1.488 2000/03/15 03:04:51 ajc +* Added DEXP server command to disable incoming express messages. +* uiet mode client side command to set/clear DEXP mode. +* nown rooms list displays through the paginator. + Revision 1.487 2000/03/12 00:21:35 ajc * Removed the semi-broken "chat room" functionality in the chat system, and replaced it with direct mapping to the actual Citadel room the user is in. @@ -1734,4 +1739,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant Fri Jul 10 1998 Art Cancro * Initial CVS import - diff --git a/citadel/citadel.c b/citadel/citadel.c index 01bcb05c7..550a4688b 100644 --- a/citadel/citadel.c +++ b/citadel/citadel.c @@ -1263,6 +1263,10 @@ GSTA: termn8 = 0; check_message_base(); break; + case 84: + quiet_mode(); + break; + case 50: enter_config(2); break; diff --git a/citadel/citadel.rc b/citadel/citadel.rc index c439f5d88..197a02156 100644 --- a/citadel/citadel.rc +++ b/citadel/citadel.rc @@ -150,6 +150,7 @@ cmd=19,0,&.,list &Zapped rooms cmd=52,0,&.,&Skip ^r^c goto: cmd=56,0,&Page a user cmd=58,0,&Mail +cmd=84,0,&Quiet mode # # We implement both <.G>oto and ump commands which do the same thing, in # order to please a wider audience of users. Remove one if you want to. diff --git a/citadel/client_chat.c b/citadel/client_chat.c index e38f64976..a5a2f4589 100644 --- a/citadel/client_chat.c +++ b/citadel/client_chat.c @@ -273,3 +273,32 @@ void page_user() { + +void quiet_mode(void) { + int qstate; + char buf[256]; + + serv_puts("DEXP 2"); + serv_gets(buf); + if (buf[0]!='2') { + printf("%s\n", &buf[4]); + return; + } + qstate = atoi(&buf[4]); + if (qstate == 0) qstate = 1; + else qstate = 0; + sprintf(buf, "DEXP %d", qstate); + serv_puts(buf); + serv_gets(buf); + if (buf[0]!='2') { + printf("%s\n", &buf[4]); + return; + } + qstate = atoi(&buf[4]); + if (qstate) { + printf("Quiet mode enabled (no other users may page you)\n"); + } + else { + printf("Quiet mode disabled (other users may page you)\n"); + } +} diff --git a/citadel/client_chat.h b/citadel/client_chat.h index 5add246ff..4832b8357 100644 --- a/citadel/client_chat.h +++ b/citadel/client_chat.h @@ -1,3 +1,4 @@ /* $Id$ */ void chatmode(void); void page_user(void); +void quiet_mode(void); diff --git a/citadel/rooms.c b/citadel/rooms.c index 0f334ebab..cf317fba1 100644 --- a/citadel/rooms.c +++ b/citadel/rooms.c @@ -41,6 +41,7 @@ void progress(long int curr, long int cmax); int pattern(char *search, char *patn); int file_checksum(char *filename); int nukedir(char *dirname); +int checkpagin(int lp, int pagin, int height); extern unsigned room_flags; extern char room_name[]; @@ -63,6 +64,8 @@ extern char ugname[]; extern char floorlist[128][256]; +int knlinecount; + void load_floorlist(void) { int a; @@ -100,7 +103,14 @@ void room_tree_list(struct roomlisting *rp) { strcpy(rmname, rp->rlname); f = rp->rlflags; if ((c + strlen(rmname) + 4) > screenwidth) { + + /* line break, check the paginator */ printf("\n"); + knlinecount = knlinecount + 1; + knlinecount = checkpagin(knlinecount, + ((userflags & US_PAGINATOR) ? 1 : 0), + screenheight); + c = 1; } if (f & QR_MAILBOX) { @@ -229,41 +239,51 @@ void knrooms(int kn_floor_mode) int a; load_floorlist(); + knlinecount = 0; if (kn_floor_mode == 0) { color(BRIGHT_CYAN); printf("\n Rooms with unread messages:\n"); + knlinecount = knlinecount + 2; listrms("LKRN"); color(BRIGHT_CYAN); printf("\n\n No unseen messages in:\n"); + knlinecount = knlinecount + 3; listrms("LKRO"); printf("\n"); + knlinecount = knlinecount + 1; } if (kn_floor_mode == 1) { color(BRIGHT_CYAN); printf("\n Rooms with unread messages on %s:\n", floorlist[(int)curr_floor]); + knlinecount = knlinecount + 2; sprintf(buf,"LKRN %d",curr_floor); listrms(buf); color(BRIGHT_CYAN); printf("\n\n Rooms with no new messages on %s:\n", floorlist[(int)curr_floor]); + knlinecount = knlinecount + 3; sprintf(buf,"LKRO %d",curr_floor); listrms(buf); color(BRIGHT_CYAN); printf("\n\n Other floors:\n"); + knlinecount = knlinecount + 3; list_other_floors(); printf("\n"); + knlinecount = knlinecount + 1; } if (kn_floor_mode == 2) { for (a=0; a<128; ++a) if (floorlist[a][0]!=0) { color(BRIGHT_CYAN); printf("\n Rooms on %s:\n",floorlist[a]); + knlinecount = knlinecount + 2; sprintf(buf,"LKRA %d",a); listrms(buf); printf("\n"); + knlinecount = knlinecount + 1; } } diff --git a/citadel/serv_chat.c b/citadel/serv_chat.c index 6d428a18b..bfa19201e 100644 --- a/citadel/serv_chat.c +++ b/citadel/serv_chat.c @@ -38,17 +38,6 @@ extern struct CitContext *ContextList; -char *Dynamic_Module_Init(void) -{ - CtdlRegisterProtoHook(cmd_chat, "CHAT", "Begin real-time chat"); - CtdlRegisterProtoHook(cmd_pexp, "PEXP", "Poll for express messages"); - CtdlRegisterProtoHook(cmd_gexp, "GEXP", "Get express messages"); - CtdlRegisterProtoHook(cmd_sexp, "SEXP", "Send an express message"); - CtdlRegisterSessionHook(delete_express_messages, EVT_STOP); - CtdlRegisterXmsgHook(send_express_message, XMSG_PRI_LOCAL); - return "$Id$"; -} - void allwrite(char *cmdbuf, int flag, char *username) { FILE *fp; @@ -485,8 +474,10 @@ int send_express_message(char *lun, char *x_user, char *x_msg) else un = ccptr->usersupp.fullname; - if ((!strcasecmp(un, x_user)) - || (!strcasecmp(x_user, "broadcast"))) { + if ( ((!strcasecmp(un, x_user)) + || (!strcasecmp(x_user, "broadcast"))) + && ((ccptr->disable_exp == 0) + || (CC->usersupp.axlevel >= 6)) ) { if (do_send) { newmsg = (struct ExpressMessage *) mallok(sizeof (struct ExpressMessage)); @@ -558,7 +549,9 @@ void cmd_sexp(char *argbuf) if (!strcmp(x_msg, "-")) { message_sent = PerformXmsgHooks(lun, x_user, ""); if (message_sent == 0) { - cprintf("%d No user '%s' logged in.\n", ERROR, x_user); + cprintf("%d '%s' is not logged in " + "or is not accepting pages.\n", + ERROR, x_user); return; } cprintf("%d Transmit message (will deliver to %d users)\n", @@ -595,3 +588,41 @@ void cmd_sexp(char *argbuf) } } + + + +/* + * Enter or exit paging-disabled mode + */ +void cmd_dexp(char *argbuf) +{ + int new_state; + + if (!CC->logged_in) { + cprintf("%d Not logged in.\n",ERROR+NOT_LOGGED_IN); + return; + } + + new_state = extract_int(argbuf, 0); + if ((new_state == 0) || (new_state == 1)) { + CC->disable_exp = new_state; + } + cprintf("%d %d\n", OK, CC->disable_exp); + } + + + + + +char *Dynamic_Module_Init(void) +{ + CtdlRegisterProtoHook(cmd_chat, "CHAT", "Begin real-time chat"); + CtdlRegisterProtoHook(cmd_pexp, "PEXP", "Poll for express messages"); + CtdlRegisterProtoHook(cmd_gexp, "GEXP", "Get express messages"); + CtdlRegisterProtoHook(cmd_sexp, "SEXP", "Send an express message"); + CtdlRegisterProtoHook(cmd_dexp, "DEXP", "Disable express messages"); + CtdlRegisterSessionHook(delete_express_messages, EVT_STOP); + CtdlRegisterXmsgHook(send_express_message, XMSG_PRI_LOCAL); + return "$Id$"; +} + diff --git a/citadel/server.h b/citadel/server.h index e265e5564..a5a321a07 100644 --- a/citadel/server.h +++ b/citadel/server.h @@ -97,6 +97,7 @@ struct CitContext { /* A linked list of all express messages sent to us. */ struct ExpressMessage *FirstExpressMessage; + int disable_exp; /* Set to 1 to disable incoming pages */ /* Masquerade... */ char fake_username[32]; /* Fake username */ diff --git a/citadel/techdoc/session.txt b/citadel/techdoc/session.txt index 8b5845d3b..d2a8c5352 100644 --- a/citadel/techdoc/session.txt +++ b/citadel/techdoc/session.txt @@ -1499,9 +1499,10 @@ the client program should expect the connection to be immediately broken. 0 to respectively set or clear the flag. When the "scheduled shutdown" flag is set, the server will be shut down when there are no longer any users logged in. Any value other than 0 or 1 will not change the flag, only report its state. -No users will be kicked off the system, and in fact the server is still available -for new connections. The command returns ERROR if it fails; otherwise, it -returns OK followed by a number representing the current state of the flag. +No users will be kicked off the system, and in fact the server is still +available for new connections. The command returns ERROR if it fails; +otherwise, it returns OK followed by a number representing the current state +of the flag. EMSG (Enter a system MeSsaGe) @@ -1787,4 +1788,15 @@ and statuses. Verify, via the long way, that all message referenmce counts are correct. If the user has permission to do this then LISTING_FOLLOWS is returned, followed by a transcript of the run. Otherwise ERROR is returned. + + + DEXP (Disable EXPress messages) + DEXP sets or clears the "disable express messages" flag. Pass this command a +1 or 0 to respectively set or clear the flag. When the "disable express +messages" flag is set, no one except Aides may send the user express messages. +Any value other than 0 or 1 will not change the flag, only report its state. +The command returns ERROR if it fails; otherwise, it returns OK followed by a +number representing the current state of the flag. + + -- 2.39.2