]> code.citadel.org Git - citadel.git/commitdiff
* curses client: use the status line as "input" line in chat mode
authorMichael Hampton <io_error@uncensored.citadel.org>
Sun, 20 Jan 2002 08:03:44 +0000 (08:03 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Sun, 20 Jan 2002 08:03:44 +0000 (08:03 +0000)
citadel/ChangeLog
citadel/client_chat.c
citadel/ipc_c_tcp.c
citadel/screen.c

index 39f9543313a2eacacab2b8615a5560ba0774c2d4..227db862de45c8ca85b902f1139d566b7ba08269 100644 (file)
@@ -1,4 +1,7 @@
  $Log$
+ Revision 590.79  2002/01/20 08:03:43  error
+ * curses client: use the status line as "input" line in chat mode
+
  Revision 590.78  2002/01/20 07:43:07  error
  * serv_chat.c: Server no longer crashes when CHATLOG can't be opened
 
@@ -3209,4 +3212,3 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import 
-
index 57b0ba2aa09456c2bef52a6d33c12a6bcf82a99e..c90fecfc0811c9f5312a6ce07aff1347987f328e 100644 (file)
@@ -85,12 +85,13 @@ void chatmode(void)
        strcpy(buf, "");
        strcpy(wbuf, "");
        color(BRIGHT_YELLOW);
-       scr_printf("> ");
+       sln_printf_if("\n");
+       sln_printf("> ");
        send_complete_line = 0;
        recv_complete_line = 0;
 
        while (1) {
-               fflush(stdout);
+               sln_flush();
                FD_ZERO(&rfds);
                FD_SET(0, &rfds);
                FD_SET(getsockfd(), &rfds);
@@ -110,16 +111,16 @@ void chatmode(void)
                        goto RCL;
                }
                if (FD_ISSET(0, &rfds)) {
-                       ch = inkey();
+                       ch = scr_getc();
                        if ((ch == 10) || (ch == 13)) {
                                send_complete_line = 1;
                        } else if ((ch == 8) || (ch == 127)) {
                                if (strlen(wbuf) > 0) {
                                        wbuf[strlen(wbuf) - 1] = 0;
-                                       scr_printf("%c %c", 8, 8);
+                                       sln_printf("%c %c", 8, 8);
                                }
                        } else {
-                               putc(ch, stdout);
+                               sln_putc(ch);
                                wbuf[strlen(wbuf) + 1] = 0;
                                wbuf[strlen(wbuf)] = ch;
                        }
@@ -151,15 +152,13 @@ void chatmode(void)
                        }
                }
                if (recv_complete_line) {
-                       scr_printf("\r%79s\r", "");
+                       sln_printf("\r%79s\r", "");
                        if (!strcmp(buf, "000")) {
                                color(BRIGHT_WHITE);
-                               scr_printf("Exiting chat mode\n");
-
-                               scr_flush();
+                               sln_printf("\rExiting chat mode\n");
+                               sln_flush();
                                set_keepalives(KA_YES);
 
-
                                /* Some users complained about the client and server
                                 * losing protocol synchronization when exiting chat.
                                 * This little dialog forces everything to be
@@ -201,15 +200,16 @@ void chatmode(void)
                                        while (strlen(buf) < 79)
                                                strcat(buf, " ");
                                        if (strcmp(c_user, last_user)) {
-                                               scr_printf("\r%79s\n", "");
+                                               sln_printf("\r%79s\n", "");
                                                strcpy(last_user, c_user);
                                        }
                                        scr_printf("\r%s\n", buf);
-                                       fflush(stdout);
+                                       scr_flush();
                                }
                        }
                        color(BRIGHT_YELLOW);
-                       scr_printf("> %s", wbuf);
+                       sln_printf("\r> %s", wbuf);
+                       sln_flush();
                        recv_complete_line = 0;
                        strcpy(buf, "");
                }
index f1d2226a0b6fcd432c208dbbd72ae6058d88f9ec..9c326f580a88743ea91ce1ac2ccf3d9e0417a86a 100644 (file)
@@ -67,6 +67,9 @@ extern int ssl_is_connected;
 
 
 void connection_died(void) {
+#ifdef CIT_CLIENT
+       screen_delete();
+#endif
        err_printf("\rYour connection to this Citadel server is broken.\n"
                        "Please re-connect and log in again.\n");
        logoff(3);
index eec5666cc74b48f1dad15bc7b6771273868ae514..374210a4f9b716d9f18bbfa6a24435d2e2332f36 100644 (file)
@@ -171,10 +171,6 @@ int scr_printf(char *fmt, ...)
 #ifdef HAVE_CURSES_H
        if (mainwindow) {
                retval = _vwprintw(mainwindow, fmt, ap);
-               /*
-               if (fmt[strlen(fmt) - 1] == '\n')
-                       wrefresh(mainwindow);
-               */
        } else
 #endif
                retval = vprintf(fmt, ap);
@@ -226,8 +222,10 @@ int sln_printf(char *fmt, ...)
                        if (*i == '\r' || *i == '\n')
                                wclrtoeol(statuswindow);
                        sln_putc(*i);
-                       if (*i == '\r' || *i == '\n')
+                       if (*i == '\r' || *i == '\n') {
+                               wrefresh(statuswindow);
                                mvwinch(statuswindow, 0, 0);
+                       }
                }
        } else
 #endif
@@ -256,8 +254,10 @@ int sln_printf_if(char *fmt, ...)
                        if (*i == '\r' || *i == '\n')
                                wclrtoeol(statuswindow);
                        sln_putc(*i);
-                       if (*i == '\r' || *i == '\n')
+                       if (*i == '\r' || *i == '\n') {
+                               wrefresh(statuswindow);
                                mvwinch(statuswindow, 0, 0);
+                       }
                }
        }
        va_end(ap);
@@ -410,7 +410,7 @@ void windows_new(void)
                statuswindow = newwin(1, x, y - 1, 0);
                wbkgdset(statuswindow, COLOR_PAIR(17));
                werase(statuswindow);
-               immedok(statuswindow, TRUE);
+               immedok(statuswindow, FALSE);
                leaveok(statuswindow, FALSE);
                scrollok(statuswindow, FALSE);
                wrefresh(statuswindow);