Allow WB Chat Box to be dedicated to shouts and 'it'
authorH.G. Muller <h.g.muller@hccnet.nl>
Wed, 10 Feb 2010 09:55:51 +0000 (10:55 +0100)
committerArun Persaud <arun@nubati.net>
Sun, 21 Feb 2010 00:35:02 +0000 (16:35 -0800)
By putting 'shouts' in the handle field, a chat window will capture all
shouts and c-shouts, and send messages typed into it as shouts.
The bracketing of the shouter name now indicates the type of shout.
The handle for WHISPER Chat Boxes has been changed to 'whispers', to
make it easier to pop them up by clicking the console.

backend.c
winboard/wchat.c

index c33c164..206676d 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -2740,6 +2740,9 @@ read_from_ics(isr, closure, data, count, error)
            channel = -1;
            if(started == STARTED_NONE && (looking_at(buf, &i, "* tells you:") || looking_at(buf, &i, "* says:") || 
                                           looking_at(buf, &i, "* whispers:") ||
+                                          looking_at(buf, &i, "* shouts:") ||
+                                          looking_at(buf, &i, "* c-shouts:") ||
+                                          looking_at(buf, &i, "--> * ") ||
                                           looking_at(buf, &i, "*(*):") && (sscanf(star_match[1], "%d", &channel),1) ||
                                           looking_at(buf, &i, "*(*)(*):") && (sscanf(star_match[2], "%d", &channel),1) ||
                                           looking_at(buf, &i, "*(*)(*)(*):") && (sscanf(star_match[3], "%d", &channel),1) ||
@@ -2757,10 +2760,19 @@ read_from_ics(isr, closure, data, count, error)
                } else
                if(buf[i-3] == 'r') // whisper; look if there is a WHISPER chatbox
                for(p=0; p<MAX_CHAT; p++) {
-                   if(!strcmp("WHISPER", chatPartner[p])) {
+                   if(!strcmp("whispers", chatPartner[p])) {
                        talker[0] = '['; strcat(talker, "] ");
                        chattingPartner = p; break;
                    }
+               } else
+               if(buf[i-3] == 't' || buf[oldi+2] == '>') // shout, c-shout or it; look if there is a 'shouts' chatbox
+               for(p=0; p<MAX_CHAT; p++) {
+                   if(!strcmp("shouts", chatPartner[p])) {
+                       if(buf[oldi+2] == '>') { talker[0] = '<'; strcat(talker, "> "); }
+                       else if(buf[i-8] == '-') { talker[0] = '('; strcat(talker, ") "); }
+                       else { talker[0] = '['; strcat(talker, "] "); }
+                       chattingPartner = p; break;
+                   }
                }
                if(chattingPartner<0) // if not, look if there is a chatbox for this indivdual
                for(p=0; p<MAX_CHAT; p++) if(!StrCaseCmp(talker+1, chatPartner[p])) {
index 3b90b2c..ac75819 100644 (file)
@@ -285,8 +285,10 @@ LRESULT CALLBACK ChatProc( HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam
            SetDlgItemText(hDlg, OPT_ChatInput, "");\r
            // from here on it could be back-end\r
            SaveInHistory(mess);\r
-           if(!strcmp("WHISPER", chatPartner[partner]))\r
+           if(!strcmp("whispers", chatPartner[partner]))\r
                sprintf(buf, "whisper %s\n", mess); // WHISPER box uses "whisper" to send\r
+           else if(!strcmp("shouts", chatPartner[partner]))\r
+               sprintf(buf, "shout %s\n", mess); // SHOUT box uses "shout" to send\r
            else {\r
                if(!atoi(chatPartner[partner])) {\r
                    sprintf(buf, "> %s\r\n", mess); // echo only tells to handle, not channel\r