From 6927078455e017dac4b274e5aaee99ed9ce93109 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Thu, 24 Oct 2024 15:44:14 +0300 Subject: =?UTF-8?q?fixes=20#4754=20(IRC:=20bb-=D1=82=D0=B5=D0=B3=D0=B8=20?= =?UTF-8?q?=D0=B2=20=D1=87=D0=B0=D1=82=D0=B5=20=D1=81=20=D0=BE=D0=B1=D1=80?= =?UTF-8?q?=D0=B5=D0=B7=D0=B0=D0=BD=D0=BD=D1=8B=D0=BC=D0=B8=20=D1=81=D1=82?= =?UTF-8?q?=D0=B8=D0=BB=D1=8F=D0=BC=D0=B8)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/mir_app/src/chat_loginfo.cpp | 80 ++++++++++++++-------------------------- 1 file changed, 28 insertions(+), 52 deletions(-) (limited to 'src') diff --git a/src/mir_app/src/chat_loginfo.cpp b/src/mir_app/src/chat_loginfo.cpp index 1c05f5ecb8..e46c2eedc7 100644 --- a/src/mir_app/src/chat_loginfo.cpp +++ b/src/mir_app/src/chat_loginfo.cpp @@ -84,7 +84,7 @@ int LOGINFO::getIcon() const return 0; } -void LOGINFO::write(RtfChatLogStreamData *streamData, bool /*simpleMode*/, CMStringA &str, const wchar_t *line) const +void LOGINFO::write(RtfChatLogStreamData *streamData, bool simpleMode, CMStringA &str, const wchar_t *line) const { CMStringA buf; @@ -96,62 +96,38 @@ void LOGINFO::write(RtfChatLogStreamData *streamData, bool /*simpleMode*/, CMStr else if (*line == '\n') { buf.Append("\\line "); } - /* - else if (*line == '%' && !simpleMode) { - switch (*++line) { - case 'c': - case 'f': - if (g_Settings->bStripFormat || streamData->bStripFormat) - line += 2; - - else if (line[1] != '\0' && line[2] != '\0') { - wchar_t szTemp3[3], c = *line; - int col; - szTemp3[0] = line[1]; - szTemp3[1] = line[2]; - szTemp3[2] = '\0'; - line += 2; - - col = _wtoi(szTemp3); - col += (OPTIONS_FONTCOUNT + 1); - buf.AppendFormat((c == 'c') ? "\\cf%u " : "\\highlight%u ", col); - } - break; - case 'C': - case 'F': - if (!g_Settings->bStripFormat && !streamData->bStripFormat) { - int j = bIsHighlighted ? 16 : getIndex(); - if (*line == 'C') - buf.AppendFormat("\\cf%u ", j + 1); - else - buf.AppendFormat("\\highlight0 "); - } - break; - case 'b': - case 'u': - case 'i': + else if (*line == '[' && !simpleMode) { + line++; + bool bEnable = true; + if (*line == '/') { + line++; + bEnable = false; + } + + if (!wcsncmp(line, L"color", 5) || !wcsncmp(line, L"bkcolor", 7)) + line = wcschr(line, ']'); + else if (!wcsncmp(line, L"b]", 2)) { + line++; if (!streamData->bStripFormat) - buf.AppendFormat((*line == 'u') ? "\\%cl " : "\\%c ", *line); - break; - - case 'B': - case 'U': - case 'I': + buf.Append(bEnable ? "\\b" : "\\b0"); + } + else if (!wcsncmp(line, L"i]", 2)) { + line++; if (!streamData->bStripFormat) - buf.AppendFormat((*line == 'U') ? "\\%cl0 " : "\\%c0 ", tolower(*line)); - break; - - case 'r': + buf.Append(bEnable ? "\\i" : "\\i0"); + } + else if (!wcsncmp(line, L"s]", 2)) { + line++; if (!streamData->bStripFormat) - buf.AppendFormat("%s ", Log_SetStyle(getIndex())); - break; - - default: - buf.AppendChar('%'); - break; + buf.Append(bEnable ? "\\s" : "\\s0"); + } + else if (!wcsncmp(line, L"u]", 2)) { + line++; + if (!streamData->bStripFormat) + buf.Append(bEnable ? "\\ul" : "\\ul0"); } + else buf.AppendChar('['); } - */ else if (*line == '\t' && !streamData->bStripFormat) { buf.Append("\\tab "); } -- cgit v1.2.3