From b62cf5e6c96ca7a64c184b6218c18eb045142a7b Mon Sep 17 00:00:00 2001 From: Eric Mullins Date: Thu, 15 Oct 2009 07:18:42 -0600 Subject: [PATCH] Fixed joiner detection, allowing it to work with timeseal When timeseal's buffer fills in the middle of the continuation sequence, detection fails, and the lines aren't joined. As a result of this fix, measures intended to bypass joining are no longer needed, so I removed them. These utilize server vars when available to prevent splitting. --- backend.c | 71 ++++++++++++++++++++++++++++++++++++++++++++---------------- 1 files changed, 52 insertions(+), 19 deletions(-) mode change 100644 => 100755 backend.c diff --git a/backend.c b/backend.c old mode 100644 new mode 100755 index 9e1bf62..0bbe876 --- a/backend.c +++ b/backend.c @@ -2022,7 +2022,8 @@ static int loggedOn = FALSE; int gs_gamenum; char gs_kind[MSG_SIZ]; static char player1Name[128] = ""; -static char player2Name[128] = ""; +static char player2Name[128] = ""; +static char cont_seq[] = "\n\\ "; static int player1Rating = -1; static int player2Rating = -1; /*----------------------------*/ @@ -2054,7 +2055,9 @@ read_from_ics(isr, closure, data, count, error) static char buf[BUF_SIZE + 1]; static int firstTime = TRUE, intfSet = FALSE; static ColorClass prevColor = ColorNormal; - static int savingComment = FALSE; + static int savingComment = FALSE; + static int cmatch = 0; // continuation sequence match + char *bp; char str[500]; int i, oldi; int buf_len; @@ -2085,19 +2088,53 @@ read_from_ics(isr, closure, data, count, error) buf[i] = buf[leftover_start + i]; } - /* Copy in new characters, removing nulls and \r's */ - buf_len = leftover_len; - for (i = 0; i < count; i++) { - if (data[i] != NULLCHAR && data[i] != '\r') - buf[buf_len++] = data[i]; - if(!appData.noJoin && buf_len >= 5 && buf[buf_len-5]=='\n' && buf[buf_len-4]=='\\' && - buf[buf_len-3]==' ' && buf[buf_len-2]==' ' && buf[buf_len-1]==' ') { - buf_len -= 5; // [HGM] ICS: join continuation line of Lasker 2.2.3 server with previous - if(buf_len == 0 || buf[buf_len-1] != ' ') - buf[buf_len++] = ' '; // add space (assumes ICS does not break lines within word) - } - } - + /* copy new characters into the buffer */ + bp = buf + leftover_len; + buf_len=leftover_len; + for (i=0; i