From 8ed1a9382f88102f1a77a392a4ec43e60647e7e9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 13 Nov 2017 21:46:58 +0300 Subject: fixes (#1010) tabsrmm group chat colors regression (#1010) --- plugins/TabSRMM/src/msgdlgutils.cpp | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) (limited to 'plugins/TabSRMM/src/msgdlgutils.cpp') diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 21924f7c9a..267374f850 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -885,17 +885,23 @@ BOOL CTabBaseDlg::DoRtfToTags(CMStringW &pszText) const if (iCol > 0) { if (!isChat()) res.AppendFormat((iInd >= 0) ? (bInsideColor ? L"[/color][color=%s]" : L"[color=%s]") : (bInsideColor ? L"[/color]" : L""), Utils::rtf_clrs[iInd].szName); - // else - // res.AppendFormat((iInd >= 0) ? L"%%c%02u" : L"%%C", iInd); + else { + MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule); + if (mi && mi->bColor) + res.AppendFormat((iInd >= 0) ? L"%%c%u" : L"%%C", iInd); + } } bInsideColor = iInd >= 0; } - else if (!wcsncmp(p, L"\\highlight", 10)) { //background color - /* if (isChat()) { - int iInd = RtfColorToIndex(iNumColors, pIndex, _wtoi(p + 10)); - res.AppendFormat((iInd >= 0) ? L"%%f%02u" : L"%%F", iInd); - } */ + else if (!wcsncmp(p, L"\\highlight", 10)) { // background color + if (isChat()) { + MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule); + if (mi && mi->bBkgColor) { + int iInd = RtfColorToIndex(iNumColors, pIndex, _wtoi(p + 10)); + res.AppendFormat((iInd >= 0) ? L"%%f%u" : L"%%F", iInd); + } + } } else if (!wcsncmp(p, L"\\line", 5)) { // soft line break; res.AppendChar('\n'); @@ -980,6 +986,13 @@ BOOL CTabBaseDlg::DoRtfToTags(CMStringW &pszText) const p++; break; + case '%': // double % for stupid chat engine + if (isChat()) + res.Append(L"%%"); + else + res.AppendChar(*p++); + break; + default: // other text that should not be touched res.AppendChar(*p++); break; -- cgit v1.2.3