]> code.citadel.org Git - citadel.git/commitdiff
serv_chat.c: notify user of number of participants upon entering chat
authorArt Cancro <ajc@citadel.org>
Sun, 25 Apr 1999 16:44:39 +0000 (16:44 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 25 Apr 1999 16:44:39 +0000 (16:44 +0000)
citadel/ChangeLog
citadel/serv_chat.c

index d4de7ebedd524fd9e06871aa39dec840e7fe6a4c..22d3a1126a4563781c7995e851aa1b1ab5189265 100644 (file)
@@ -1,3 +1,6 @@
+Sun Apr 25 12:44:08 EDT 1999 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
+       * serv_chat.c: notify user of number of participants upon entering chat
+
 Wed Apr 21 22:23:13 EDT 1999 Art Cancro <ajc@uncnsrd.mt-kisco.ny.us>
        * aidepost.c: add -r flag to allow posting to rooms other than Aide>
        * serv_expire.c: now posts transcripts of all auto-purged rooms/users
index 38b393e314394eb6b42b1fb35b258278d5f2380f..6122062d9cc35c7f363ec283c64d3ea2fb2602ed 100644 (file)
@@ -164,19 +164,26 @@ t_context *find_context(char **unstr)
 }
 
 /*
- * List users in chat.  Setting allflag to 1 also lists users elsewhere.
+ * List users in chat.
+ * allflag ==  0 = list users in chat
+ *             1 = list users in chat, followed by users not in chat
+ *             2 = display count only
  */
 
 void do_chat_listing(int allflag)
 {
        struct CitContext *ccptr;
+       int count = 0;
 
-       cprintf(":|\n:| Users currently in chat:\n");
+       if ((allflag == 0) || (allflag == 1))
+               cprintf(":|\n:| Users currently in chat:\n");
        begin_critical_section(S_SESSION_TABLE);
        for (ccptr = ContextList; ccptr != NULL; ccptr = ccptr->next) {
+               if (!strcasecmp(ccptr->cs_room, "<chat>")) ++count;
                if ((!strcasecmp(ccptr->cs_room, "<chat>"))
                    && ((ccptr->cs_flags & CS_STEALTH) == 0)) {
-                       cprintf(":| %-25s <%s>\n", (ccptr->fake_username[0]) ? ccptr->fake_username : ccptr->curr_user, ccptr->chat_room);
+                       if ((allflag == 0) || (allflag == 1))
+                               cprintf(":| %-25s <%s>\n", (ccptr->fake_username[0]) ? ccptr->fake_username : ccptr->curr_user, ccptr->chat_room);
                }
        }
 
@@ -190,6 +197,14 @@ void do_chat_listing(int allflag)
                }
        }
        end_critical_section(S_SESSION_TABLE);
+
+       if (allflag == 2) {
+               if (count > 1) 
+                       cprintf(":|There are %d users here.\n", count);
+               else
+                       cprintf(":|Note: you are the only one here.\n");
+       }
+
        cprintf(":|\n");
 }
 
@@ -224,6 +239,8 @@ void cmd_chat(char *argbuf)
        }
        strcpy(cmdbuf, "");
 
+       do_chat_listing(2);
+
        while (1) {
                int ok_cmd;