]> code.citadel.org Git - citadel.git/commitdiff
* Added DEXP server command to disable incoming express messages.
authorArt Cancro <ajc@citadel.org>
Wed, 15 Mar 2000 03:04:54 +0000 (03:04 +0000)
committerArt Cancro <ajc@citadel.org>
Wed, 15 Mar 2000 03:04:54 +0000 (03:04 +0000)
* <Q>uiet mode client side command to set/clear DEXP mode.
* <K>nown rooms list displays through the paginator.

citadel/ChangeLog
citadel/citadel.c
citadel/citadel.rc
citadel/client_chat.c
citadel/client_chat.h
citadel/rooms.c
citadel/serv_chat.c
citadel/server.h
citadel/techdoc/session.txt

index d9729533ddb5a7f64a77ac71c9f96a36e74b713a..c0be7e97d2c4e4141c500cbbb1dbdd878bc940f5 100644 (file)
@@ -1,4 +1,9 @@
 $Log$
+Revision 1.488  2000/03/15 03:04:51  ajc
+* Added DEXP server command to disable incoming express messages.
+* <Q>uiet mode client side command to set/clear DEXP mode.
+* <K>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 <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * Initial CVS import 
-
index 01bcb05c74a21821cee64fcf17db5494248cc521..550a4688b08203eb8013e162732a8b71f0765f84 100644 (file)
@@ -1263,6 +1263,10 @@ GSTA:    termn8 = 0;
                                check_message_base();
                                break;
 
+                       case 84:
+                               quiet_mode();
+                               break;
+
                        case 50:
                                enter_config(2);
                                break;
index c439f5d881f9a6297d084988d0f4ce60e5fbe0ee..197a02156e3ae43be3fced8f6b59bf588af333a6 100644 (file)
@@ -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 <J>ump commands which do the same thing, in
 # order to please a wider audience of users.  Remove one if you want to.
index e38f64976dda657557cd9539509a035ce58a288a..a5a2f45898531e91b27f4d8d1f1601789d2b88c7 100644 (file)
@@ -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");
+       }
+}
index 5add246ff9b048a84defac5bbbb2894eea75276a..4832b835705b0551d9448aac8f3fa8b83b2c6e56 100644 (file)
@@ -1,3 +1,4 @@
 /* $Id$ */
 void chatmode(void);
 void page_user(void);
+void quiet_mode(void);
index 0f334ebabfaa79e45b51dceb4b701255552a5a24..cf317fba1663c0bb9d8e176803d7d1198b906929 100644 (file)
@@ -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;
                        }
                }
        
index 6d428a18b5a7e68fa667fe45ba61980fd92081a1..bfa19201e69746a1bb0764d41b9918432323bccb 100644 (file)
@@ -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$";
+}
+
index e265e5564e7011eda4c790adeb7df01b9d671aee..a5a321a078905b49209854731b1b550baafc78ea 100644 (file)
@@ -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 <bc>                */
index 8b5845d3b52a977e4a74208fee2f65d2766e4223..d2a8c535208bef3ba5aaba195c7f12b3c8068418 100644 (file)
@@ -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.