X-Git-Url: http://winboard.nl/cgi-bin?a=blobdiff_plain;f=backend.c;h=2f7ee57d472bb087c1f2a9a0bde0a8f618b9f720;hb=8513cfa6820a37f1053708a2f0a5eeedcc7fc9a7;hp=a24a0f87de347f89b5baa4e30526ea28b6529787;hpb=59d1333eb463402beb7ef0e0606d99245eda8af4;p=xboard.git diff --git a/backend.c b/backend.c index a24a0f8..2f7ee57 100644 --- a/backend.c +++ b/backend.c @@ -2161,7 +2161,8 @@ read_from_ics(isr, closure, data, count, error) } buf[buf_len] = NULLCHAR; - next_out = leftover_len; +// next_out = leftover_len; // [HGM] should we set this to 0, and not print it in advance? + next_out = 0; leftover_start = 0; i = 0; @@ -2316,16 +2317,16 @@ read_from_ics(isr, closure, data, count, error) if(!suppressKibitz) // [HGM] kibitz AppendComment(forwardMostMove, StripHighlight(parse)); else { // [HGM kibitz: divert memorized engine kibitz to engine-output window - int nrDigit = 0, nrAlph = 0, i; + int nrDigit = 0, nrAlph = 0, j; if(parse_pos > MSG_SIZ - 30) // defuse unreasonably long input { parse_pos = MSG_SIZ-30; parse[parse_pos - 1] = '\n'; } parse[parse_pos] = NULLCHAR; // try to be smart: if it does not look like search info, it should go to // ICS interaction window after all, not to engine-output window. - for(i=0; i= '0' && parse[i] <= '9'); - nrAlph += (parse[i] >= 'a' && parse[i] <= 'z'); - nrAlph += (parse[i] >= 'A' && parse[i] <= 'Z'); + for(j=0; j= '0' && parse[j] <= '9'); + nrAlph += (parse[j] >= 'a' && parse[j] <= 'z'); + nrAlph += (parse[j] >= 'A' && parse[j] <= 'Z'); } if(nrAlph < 9*nrDigit) { // if more than 10% digit we assume search info int depth=0; float score; @@ -2335,6 +2336,7 @@ read_from_ics(isr, closure, data, count, error) pvInfoList[forwardMostMove-1].score = 100*score; } OutputKibitz(suppressKibitz, parse); + next_out = i+1; // [HGM] suppress printing in ICS window } else { char tmp[MSG_SIZ]; sprintf(tmp, _("your opponent kibitzes: %s"), parse); @@ -2343,7 +2345,7 @@ read_from_ics(isr, closure, data, count, error) } started = STARTED_NONE; } else { - /* Don't match patterns against characters in chatter */ + /* Don't match patterns against characters in comment */ i++; continue; } @@ -2443,9 +2445,13 @@ read_from_ics(isr, closure, data, count, error) } continue; } else - if(looking_at(buf, &i, "kibitzed to")) { // suppress the acknowledgements of our own autoKibitz - started = STARTED_CHATTER; - suppressKibitz = TRUE; + if(looking_at(buf, &i, "kibitzed to *\n") && atoi(star_match[0])) { + // suppress the acknowledgements of our own autoKibitz + char *p; + if(p = strchr(star_match[0], ' ')) p[1] = NULLCHAR; // clip off "players)" on FICS + SendToPlayer(star_match[0], strlen(star_match[0])); + looking_at(buf, &i, "*% "); // eat prompt + next_out = i; } } // [HGM] kibitz: end of patch @@ -2847,7 +2853,9 @@ read_from_ics(isr, closure, data, count, error) if (looking_at(buf, &i, "% ") || ((started == STARTED_MOVES || started == STARTED_MOVES_NOHIDE) && looking_at(buf, &i, "}*"))) { char *bookHit = NULL; // [HGM] book + if(suppressKibitz) next_out = i; savingComment = FALSE; + suppressKibitz = 0; switch (started) { case STARTED_MOVES: case STARTED_MOVES_NOHIDE: @@ -3274,6 +3282,7 @@ read_from_ics(isr, closure, data, count, error) while(looking_at(buf, &i, "\n")); // [HGM] skip empty lines if (looking_at(buf, &i, "*% ")) { savingComment = FALSE; + suppressKibitz = 0; } } next_out = i; @@ -3343,6 +3352,7 @@ read_from_ics(isr, closure, data, count, error) if (looking_at(buf, &i, "*% ")) { if(strchr(star_match[0], 7)) SendToPlayer("\007", 1); // Bell(); // FICS fuses bell for next board with prompt in zh captures savingComment = FALSE; + suppressKibitz = 0; } next_out = i; } @@ -3352,12 +3362,13 @@ read_from_ics(isr, closure, data, count, error) i++; /* skip unparsed character and loop back */ } - if (started != STARTED_MOVES && started != STARTED_BOARD && !suppressKibitz && // [HGM] kibitz suppress printing in ICS interaction window - started != STARTED_HOLDINGS && i > next_out) { - SendToPlayer(&buf[next_out], i - next_out); + if (started != STARTED_MOVES && started != STARTED_BOARD && !suppressKibitz && // [HGM] kibitz +// started != STARTED_HOLDINGS && i > next_out) { // [HGM] should we compare to leftover_start in stead of i? +// SendToPlayer(&buf[next_out], i - next_out); + started != STARTED_HOLDINGS && leftover_start > next_out) { + SendToPlayer(&buf[next_out], leftover_start - next_out); next_out = i; } - suppressKibitz = FALSE; // [HGM] kibitz: has done its duty in if-statement above leftover_len = buf_len - leftover_start; /* if buffer ends with something we couldn't parse,