diff options
author | George Hazan <ghazan@miranda.im> | 2017-11-14 21:47:54 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-11-14 21:47:54 +0300 |
commit | 854f47adb115f3d03d6a64543178e84877acb0b4 (patch) | |
tree | d65fba3dbc59fc89b2b974634894a8057f1be9b1 /plugins | |
parent | c41a2ded243576506476ccbe1a28625b8918674d (diff) |
fixes #1030 (fix for passing BIU buttons to IRC channels in tabSRMM)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/TabSRMM/src/msgdlgutils.cpp | 55 |
1 files changed, 36 insertions, 19 deletions
diff --git a/plugins/TabSRMM/src/msgdlgutils.cpp b/plugins/TabSRMM/src/msgdlgutils.cpp index 267374f850..cbafe51bb0 100644 --- a/plugins/TabSRMM/src/msgdlgutils.cpp +++ b/plugins/TabSRMM/src/msgdlgutils.cpp @@ -862,6 +862,8 @@ BOOL CTabBaseDlg::DoRtfToTags(CMStringW &pszText) const }
else idx += 5;
+ MODULEINFO *mi = (isChat()) ? pci->MM_FindModule(m_si->pszModule) : nullptr;
+
bool bInsideColor = false, bInsideUl = false;
CMStringW res;
@@ -883,20 +885,17 @@ BOOL CTabBaseDlg::DoRtfToTags(CMStringW &pszText) const int iInd = RtfColorToIndex(iNumColors, pIndex, iCol);
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 {
- MODULEINFO *mi = pci->MM_FindModule(m_si->pszModule);
+ if (isChat()) {
if (mi && mi->bColor)
res.AppendFormat((iInd >= 0) ? L"%%c%u" : L"%%C", iInd);
}
+ else res.AppendFormat((iInd >= 0) ? (bInsideColor ? L"[/color][color=%s]" : L"[color=%s]") : (bInsideColor ? L"[/color]" : L""), Utils::rtf_clrs[iInd].szName);
}
bInsideColor = iInd >= 0;
}
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);
@@ -928,28 +927,46 @@ BOOL CTabBaseDlg::DoRtfToTags(CMStringW &pszText) const res.AppendChar(0x2019);
}
else if (!wcsncmp(p, L"\\b", 2)) { //bold
- if (!(lf.lfWeight == FW_BOLD)) // only allow bold if the font itself isn't a bold one, otherwise just strip it..
- if (m_SendFormat)
- res.Append((p[2] != '0') ? L"[b]" : L"[/b]");
+ if (isChat()) {
+ if (mi && mi->bBold)
+ 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..
+ if (m_SendFormat)
+ res.Append((p[2] != '0') ? L"[b]" : L"[/b]");
+ }
}
else if (!wcsncmp(p, L"\\i", 2)) { // italics
- if (!lf.lfItalic && m_SendFormat)
- res.Append((p[2] != '0') ? L"[i]" : L"[/i]");
+ if (isChat()) {
+ if (mi && mi->bItalics)
+ res.Append((p[2] != '0') ? L"%i" : L"%I");
+ }
+ else {
+ if (!lf.lfItalic && m_SendFormat)
+ res.Append((p[2] != '0') ? L"[i]" : L"[/i]");
+ }
}
else if (!wcsncmp(p, L"\\strike", 7)) { // strike-out
if (!lf.lfStrikeOut && m_SendFormat)
res.Append((p[7] != '0') ? L"[s]" : L"[/s]");
}
else if (!wcsncmp(p, L"\\ul", 3)) { // underlined
- if (!lf.lfUnderline && m_SendFormat) {
- if (p[3] == 0 || wcschr(tszRtfBreaks, p[3])) {
- res.Append(L"[u]");
- bInsideUl = true;
- }
- else if (!wcsncmp(p + 3, L"none", 4)) {
- if (bInsideUl)
- res.Append(L"[/u]");
- bInsideUl = false;
+ if (isChat()) {
+ if (mi && mi->bUnderline)
+ res.Append((p[3] != '0') ? L"%u" : L"%U");
+ }
+ else {
+ if (!lf.lfUnderline && m_SendFormat) {
+ if (p[3] == 0 || wcschr(tszRtfBreaks, p[3])) {
+ res.Append(L"[u]");
+ bInsideUl = true;
+ }
+ else if (!wcsncmp(p + 3, L"none", 4)) {
+ if (bInsideUl)
+ res.Append(L"[/u]");
+ bInsideUl = false;
+ }
}
}
}
|