use xtell for talking to handles, but tell for talking into a channel.
[xboard.git] / winboard / wchat.c
index 0fd5e08..fbf3e15 100644 (file)
@@ -32,8 +32,8 @@
 #include <dlgs.h>\r
 \r
 #include "common.h"\r
-#include "winboard.h"\r
 #include "frontend.h"\r
+#include "winboard.h"\r
 #include "backend.h"\r
 \r
 #include "wsnap.h"\r
@@ -99,9 +99,7 @@ static void ResizeWindowControls( HWND hDlg )
     int clientHeight;\r
     int maxControlWidth;\r
     int buttonWidth, buttonHeight;\r
-#if 0\r
-}\r
-#else\r
+\r
     /* Initialize variables */\r
     GetClientRect( hDlg, &rc );\r
 \r
@@ -121,7 +119,6 @@ static void ResizeWindowControls( HWND hDlg )
 //    InvalidateRect( GetDlgItem(hDlg,IDC_EngineMemo1), NULL, FALSE );\r
 //    InvalidateRect( GetDlgItem(hDlg,IDC_EngineMemo2), NULL, FALSE );\r
 }\r
-#endif\r
 \r
 // front end. Actual printing of PV lines into the output field\r
 static void InsertIntoMemo( HANDLE hDlg, char * text )\r
@@ -177,11 +174,16 @@ LRESULT CALLBACK ChatProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
            GetDlgItemText(hDlg, OPT_ChatInput, mess, MSG_SIZ);\r
            SetDlgItemText(hDlg, OPT_ChatInput, "");\r
            // from here on it could be back-end\r
-           if(strcmp("WHISPER", chatPartner[partner])) {\r
-               sprintf(buf, "> %s\n", mess); // echo only tells, not whispers\r
+           if(!strcmp("WHISPER", chatPartner[partner]))\r
+               sprintf(buf, "whisper %s\n", mess); // WHISPER box uses "whisper" to send\r
+           else {\r
+               if(!atoi(chatPartner[partner])) {\r
+                   sprintf(buf, "> %s\n", mess); // echo only tells to handle, not channel\r
                InsertIntoMemo(hDlg, buf);\r
+               sprintf(buf, "xtell %s %s\n", chatPartner[partner], mess);\r
+               } else\r
                sprintf(buf, "tell %s %s\n", chatPartner[partner], mess);\r
-           } else sprintf(buf, "whisper %s\n", mess); // SAY box uses "say" to send\r
+           }\r
            SendToICS(buf);\r
            break;\r
 \r