From fc01bc54eb7362ce10e6535d7937973f9d069785 Mon Sep 17 00:00:00 2001 From: H.G.Muller Date: Sat, 1 Jun 2019 15:58:01 +0200 Subject: [PATCH] Fix echoing of ICS commands in ICS/Chat window The ICS output pane did not show the commands submitted to the ICS by typing in the input field. Now it does, but to prevent the password from being shown this is made dependent on the value of 'remoteEchoOption'. Which, to this end, had to be made an external variable shared through backend.h. --- backend.c | 3 ++- backend.h | 1 + dialogs.c | 6 ++++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/backend.c b/backend.c index 0050f11..da93d18 100644 --- a/backend.c +++ b/backend.c @@ -2844,6 +2844,8 @@ SeekGraphClick (ClickType click, int x, int y, int moving) return TRUE; } +int remoteEchoOption = FALSE; /* telnet ECHO option */ + void read_from_ics (InputSourceRef isr, VOIDSTAR closure, char *data, int count, int error) { @@ -2977,7 +2979,6 @@ read_from_ics (InputSourceRef isr, VOIDSTAR closure, char *data, int count, int telnet server that will try to keep WILL ECHO on permanently. */ if (buf_len - i >= 3 && (unsigned char) buf[i] == TN_IAC) { - static int remoteEchoOption = FALSE; /* telnet ECHO option */ unsigned char option; oldi = i; switch ((unsigned char) buf[++i]) { diff --git a/backend.h b/backend.h index 2fbae11..d9392c4 100644 --- a/backend.h +++ b/backend.h @@ -411,6 +411,7 @@ typedef struct { extern ChessProgramStats_Move pvInfoList[MAX_MOVES]; extern Boolean shuffleOpenings; extern ChessProgramStats programStats; +extern int remoteEchoOption; extern int opponentKibitzes; // used by wengineo.c extern int errorExitStatus; extern char *recentEngines; diff --git a/dialogs.c b/dialogs.c index c1d0930..421e938 100644 --- a/dialogs.c +++ b/dialogs.c @@ -2181,8 +2181,10 @@ ChatOK (int n) // from here on it could be back-end if(line[strlen(line)-1] == '\n') line[strlen(line)-1] = NULLCHAR; SaveInHistory(line); - if(hidden || !*chatPartner[activePartner]) snprintf(buf, MSG_SIZ, "%s\n", line); else // command for ICS - if(!strcmp("whispers", chatPartner[activePartner])) + if(hidden || !*chatPartner[activePartner]) { // command for ICS + snprintf(buf, MSG_SIZ, "%s\n", line); + if(!remoteEchoOption) ConsoleWrite(buf, strlen(buf)); + } else if(!strcmp("whispers", chatPartner[activePartner])) snprintf(buf, MSG_SIZ, "whisper %s\n", line); // WHISPER box uses "whisper" to send else if(!strcmp("shouts", chatPartner[activePartner])) snprintf(buf, MSG_SIZ, "shout %s\n", line); // SHOUT box uses "shout" to send -- 1.7.0.4