diff options
author | George Hazan <george.hazan@gmail.com> | 2024-09-11 14:40:05 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-09-11 14:40:05 +0300 |
commit | 2c2c6484dc2eb7b3da52f9054435dc680f64b132 (patch) | |
tree | 687f2dba4be771b26d2fa97ceb4b99cadf5dc163 /plugins/TabSRMM | |
parent | 61325c65c5b8549fbc05144ba533fe60ddd7853b (diff) |
fixes #4650 (Окно сообщений: кнопки форматирования текста работают в приватах, но не в групчатах)
Diffstat (limited to 'plugins/TabSRMM')
-rw-r--r-- | plugins/TabSRMM/src/msgdlgother.cpp | 45 |
1 files changed, 17 insertions, 28 deletions
diff --git a/plugins/TabSRMM/src/msgdlgother.cpp b/plugins/TabSRMM/src/msgdlgother.cpp index f74673c8dd..e229888c22 100644 --- a/plugins/TabSRMM/src/msgdlgother.cpp +++ b/plugins/TabSRMM/src/msgdlgother.cpp @@ -260,8 +260,6 @@ BOOL CMsgDialog::DoRtfToTags(CMStringW &pszText) const }
else idx += 5;
- MODULEINFO *mi = (isChat()) ? m_si->pMI : nullptr;
-
bool bInsideColor = false, bInsideUl = false;
CMStringW res;
@@ -284,14 +282,12 @@ BOOL CMsgDialog::DoRtfToTags(CMStringW &pszText) const if (iCol > 0) {
if (isChat()) {
- if (mi && mi->bColor) {
- if (iInd >= 0) {
- if (!(res.IsEmpty() && m_pContainer->m_theme.fontColors[MSGFONTID_MESSAGEAREA] == pColors[iInd]))
- res.AppendFormat(L"%%c%u", iInd);
- }
- else if (!res.IsEmpty())
- res.Append(L"%%C");
+ if (iInd >= 0) {
+ if (!(res.IsEmpty() && m_pContainer->m_theme.fontColors[MSGFONTID_MESSAGEAREA] == pColors[iInd]))
+ res.AppendFormat(L"%%c%u", iInd);
}
+ else if (!res.IsEmpty())
+ res.Append(L"%%C");
}
else res.AppendFormat((iInd >= 0) ? (bInsideColor ? L"[/color][color=%s]" : L"[color=%s]") : (bInsideColor ? L"[/color]" : L""), Utils::rtf_clrs[iInd].szName);
}
@@ -300,16 +296,14 @@ BOOL CMsgDialog::DoRtfToTags(CMStringW &pszText) const }
else if (!wcsncmp(p, L"\\highlight", 10)) { // background color
if (isChat()) {
- if (mi && mi->bBkgColor) {
- int iInd = RtfColorToIndex(iNumColors, pIndex, _wtoi(p + 10));
- if (iInd >= 0) {
- // if the entry field is empty & the color passed is the back color, skip it
- if (!(res.IsEmpty() && m_pContainer->m_theme.inputbg == pColors[iInd]))
- res.AppendFormat(L"%%f%u", iInd);
- }
- else if (!res.IsEmpty())
- res.AppendFormat(L"%%F");
+ int iInd = RtfColorToIndex(iNumColors, pIndex, _wtoi(p + 10));
+ if (iInd >= 0) {
+ // if the entry field is empty & the color passed is the back color, skip it
+ if (!(res.IsEmpty() && m_pContainer->m_theme.inputbg == pColors[iInd]))
+ res.AppendFormat(L"%%f%u", iInd);
}
+ else if (!res.IsEmpty())
+ res.AppendFormat(L"%%F");
}
}
else if (!wcsncmp(p, L"\\line", 5)) { // soft line break;
@@ -338,8 +332,7 @@ BOOL CMsgDialog::DoRtfToTags(CMStringW &pszText) const }
else if (!wcsncmp(p, L"\\b", 2)) { //bold
if (isChat()) {
- if (mi && mi->bBold)
- res.Append((p[2] != '0') ? L"%b" : L"%B");
+ res.Append((p[2] != '0') ? L"%b" : L"%B");
}
else {
if (!(lf.lfWeight == FW_BOLD)) // only allow bold if the font itself isn't a bold one, otherwise just strip it..
@@ -349,13 +342,10 @@ BOOL CMsgDialog::DoRtfToTags(CMStringW &pszText) const }
else if (!wcsncmp(p, L"\\i", 2)) { // italics
if (isChat()) {
- if (mi && mi->bItalics)
- res.Append((p[2] != '0') ? L"%i" : L"%I");
- }
- else {
- if (!lf.lfItalic && m_bSendFormat)
- res.Append((p[2] != '0') ? L"[i]" : L"[/i]");
+ res.Append((p[2] != '0') ? L"%i" : L"%I");
}
+ else if (!lf.lfItalic && m_bSendFormat)
+ res.Append((p[2] != '0') ? L"[i]" : L"[/i]");
}
else if (!wcsncmp(p, L"\\strike", 7)) { // strike-out
if (!lf.lfStrikeOut && m_bSendFormat)
@@ -363,8 +353,7 @@ BOOL CMsgDialog::DoRtfToTags(CMStringW &pszText) const }
else if (!wcsncmp(p, L"\\ul", 3)) { // underlined
if (isChat()) {
- if (mi && mi->bUnderline)
- res.Append((p[3] != '0') ? L"%u" : L"%U");
+ res.Append((p[3] != '0') ? L"%u" : L"%U");
}
else {
if (!lf.lfUnderline && m_bSendFormat) {
|