]> code.citadel.org Git - citadel.git/blobdiff - citadel/client_chat.c
* Make stealth mode available to all users
[citadel.git] / citadel / client_chat.c
index 482bcdc265dd2ac0a0056df5e35c346389a1b6c2..b5d867fe41753a6b139e1bfc851f93684ea93f46 100644 (file)
@@ -111,7 +111,7 @@ void chatmode(void)
                        goto RCL;
                }
                if (FD_ISSET(0, &rfds)) {
-                       ch = scr_getc();
+                       ch = scr_getc(SCR_BLOCK);
                        if ((ch == 10) || (ch == 13)) {
                                send_complete_line = 1;
                        } else if ((ch == 8) || (ch == 127)) {
@@ -314,3 +314,35 @@ void quiet_mode(void)
                scr_printf("Quiet mode disabled (other users may page you)\n");
        }
 }
+
+
+void stealth_mode(void)
+{
+       int qstate;
+       char buf[SIZ];
+
+       serv_puts("STEL 2");
+       serv_gets(buf);
+       if (buf[0] != '2') {
+               scr_printf("%s\n", &buf[4]);
+               return;
+       }
+       qstate = atoi(&buf[4]);
+       if (qstate == 0)
+               qstate = 1;
+       else
+               qstate = 0;
+       snprintf(buf, sizeof buf, "STEL %d", qstate);
+       serv_puts(buf);
+       serv_gets(buf);
+       if (buf[0] != '2') {
+               scr_printf("%s\n", &buf[4]);
+               return;
+       }
+       qstate = atoi(&buf[4]);
+       if (qstate) {
+               scr_printf("Stealth mode enabled (you are invisible)\n");
+       } else {
+               scr_printf("Stealth mode disabled (you are listed as online)\n");
+       }
+}