From: H.G. Muller Date: Wed, 5 Feb 2014 22:08:50 +0000 (+0100) Subject: Write broadcasts also to private chatbox of talker X-Git-Url: http://winboard.nl/cgi-bin?a=commitdiff_plain;h=2a3c9c39186720b6b735ddd7bbe9aff2cfc2dddf;p=xboard.git Write broadcasts also to private chatbox of talker The shouts or channel chatboxes capture messages first, but if a private chat with the talker is opened, it now goes there too. Prefixed with the type of broadcast. --- diff --git a/backend.c b/backend.c index 3039944..b95ff6a 100644 --- a/backend.c +++ b/backend.c @@ -2830,7 +2830,7 @@ read_from_ics (InputSourceRef isr, VOIDSTAR closure, char *data, int count, int int backup; /* [DM] For zippy color lines */ char *p; char talker[MSG_SIZ]; // [HGM] chat - int channel; + int channel, collective=0; connectionAlive = TRUE; // [HGM] alive: I think, therefore I am... @@ -3072,6 +3072,15 @@ read_from_ics (InputSourceRef isr, VOIDSTAR closure, char *data, int count, int char mess[MSG_SIZ]; snprintf(mess, MSG_SIZ, "%s%s", talker, parse); OutputChatMessage(chattingPartner, mess); + if(collective) { // broadcasted talk also goes to private chatbox of talker + int p; + talker[strlen(talker+1)-1] = NULLCHAR; // strip closing delimiter + for(p=0; p= 0) // channel broadcast; look if there is a chatbox for this channel for(p=0; p= '0' && chatPartner[p][0] <= '9' && channel == atoi(chatPartner[p])) { talker[0] = '['; strcat(talker, "] "); Colorize(channel == 1 ? ColorChannel1 : ColorChannel, FALSE); + collective = 1; chattingPartner = p; break; } } else @@ -3303,6 +3313,7 @@ read_from_ics (InputSourceRef isr, VOIDSTAR closure, char *data, int count, int for(p=0; p') { talker[0] = '<'; strcat(talker, "> "); Colorize(ColorShout, FALSE); } else if(buf[i-8] == '-') { talker[0] = '('; strcat(talker, ") "); Colorize(ColorSShout, FALSE); } else { talker[0] = '['; strcat(talker, "] "); Colorize(ColorShout, FALSE); } + collective = 1; chattingPartner = p; break; } }