From f74c738cdfd9c7a49ab6918610ea71bf03d27af1 Mon Sep 17 00:00:00 2001 From: stskeeps Date: Sun, 20 May 2001 15:57:43 +0000 Subject: [PATCH] . --- src/win32/Win32GUI.c | 59 ++++++-------------------------------------- 1 file changed, 7 insertions(+), 52 deletions(-) diff --git a/src/win32/Win32GUI.c b/src/win32/Win32GUI.c index 4e3c3b016..4c4ab2f98 100644 --- a/src/win32/Win32GUI.c +++ b/src/win32/Win32GUI.c @@ -739,20 +739,23 @@ LRESULT CALLBACK StatusDLG(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam return (FALSE); } + + /* Parse bold and underline codes, also change { and } to RTF safe \{ and \} * (c) 2001 codemastr & McSkaf */ + static char *ParseCodes(char *buffer) { static char tmp[512], out[512]; - int i = 0, j = 0, hascomma = 0, bold = 0, underline = 0, reverse = 0, firstcolordigit; + int i = 0, j = 0, hascomma = 0, bold = 0, underline = 0, reverse = 0; bzero((char *)out, sizeof(out)); memcpy(tmp, buffer, 512); while (tmp[i]) { - if (tmp[i] == '\26') { + if (tmp[i] == '\022') { reverse = ~reverse; if (reverse) { strcat(out, "\\cf1\\highlight16 "); @@ -765,56 +768,8 @@ static char *ParseCodes(char *buffer) ++i; continue; } - if (tmp[i] == '\3') { - strcat(out,"\\cf"); - j += 3; - ++i; - firstcolordigit = 1; - while (isdigit(tmp[i])) - { - if (firstcolordigit) - { - // need to reverse black and white color numbers - // mirc uses 0=white, 1=black but rtf is just the opposite - if (tmp[i] == '0') - tmp[i] = '1'; - else if (tmp[i] == '1' && !isdigit(tmp[i+1])) - tmp[i] = '0'; - } - firstcolordigit = 0; - out[j++] = tmp[i++]; - } - // look for background color - if (tmp[i] == ',') - { - // prepare for background color - strcat(out, "\\highlight"); - j += 10; - ++i; - firstcolordigit = 1; - while (isdigit(tmp[i])) - { - if (firstcolordigit) - { - // need to reverse black and white color numbers - // mirc uses 0=white, 1=black but for background colors - // rtf uses 0=off (white), 1=white so our color table - // specifies color number 16 as black. - if (tmp[i] == '0') // white - tmp[i] = '1'; - else if (tmp[i] == '1' && !isdigit(tmp[i+1])) // black - { - tmp[i] = '6'; - out[j++] = '1'; - } - } - firstcolordigit = 0; - out[j++] = tmp[i++]; - } - } - out[j++] = ' '; - continue; - } + + if (tmp[i] == '\037' || tmp[i] == '\031') { if (!underline) { strcat(out,"\\ul ");