Send continuation lines to chat box they belong to
authorH.G. Muller <h.g.muller@hccnet.nl>
Thu, 4 Feb 2010 22:33:50 +0000 (23:33 +0100)
committerH.G. Muller <h.g.muller@hccnet.nl>
Fri, 5 Feb 2010 17:56:44 +0000 (18:56 +0100)
The variable savingComment is used as a kludge to remember where the
comment should go (i.e. which chatbox, or elsewhere), so that when a
continuation line is matched, chatPartner (which was reset at EOL) can
be restored to its original value. Also put space after handle of talker
in channel Chat Windows

backend.c

index cc58afe..fe325db 100644 (file)
--- a/backend.c
+++ b/backend.c
@@ -2493,14 +2493,14 @@ read_from_ics(isr, closure, data, count, error)
                if(channel >= 0) // channel broadcast; look if there is a chatbox for this channel
                for(p=0; p<MAX_CHAT; p++) {
                    if(channel == atoi(chatPartner[p])) {
-                   talker[0] = '['; strcat(talker, "]");
+                   talker[0] = '['; strcat(talker, "] ");
                    chattingPartner = p; break;
                    }
                } 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])) {
-                       talker[0] = '['; strcat(talker, "]");
+                       talker[0] = '['; strcat(talker, "] ");
                        chattingPartner = p; break;
                    }
                }
@@ -2512,7 +2512,7 @@ read_from_ics(isr, closure, data, count, error)
                if(chattingPartner<0) i = oldi; else {
                    started = STARTED_COMMENT;
                    parse_pos = 0; parse[0] = NULLCHAR;
-                   savingComment = TRUE;
+                   savingComment = 3 + chattingPartner; // counts as TRUE
                    suppressKibitz = TRUE;
                }
            } // [HGM] chat: end of patch
@@ -2707,6 +2707,8 @@ read_from_ics(isr, closure, data, count, error)
                    memcpy(parse, &buf[oldi], parse_pos);
                    parse[parse_pos] = NULLCHAR;
                    started = STARTED_COMMENT;
+                   if(savingComment >= 3) // [HGM] chat: continuation of line for chat box
+                       chattingPartner = savingComment - 3; // kludge to remember the box
                } else {
                    started = STARTED_CHATTER;
                }