summaryrefslogtreecommitdiff
path: root/protocols
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2024-09-12 16:51:46 +0300
committerGeorge Hazan <george.hazan@gmail.com>2024-09-12 16:51:46 +0300
commit66142639448faf340baed0ac857240eb66f9fae2 (patch)
tree2ccb2c11817632c4bcdb632109cf59d1a24dacec /protocols
parent17d302b3e3317004df70481f1a8a588701388def (diff)
fixes #4651 (NewStory+tabSRMM: Форматирование текста по-разному работает в приватах и чатах)
Diffstat (limited to 'protocols')
-rw-r--r--protocols/Discord/src/groupchat.cpp1
-rw-r--r--protocols/Facebook/src/groupchats.cpp7
-rw-r--r--protocols/Facebook/src/server.cpp1
-rw-r--r--protocols/IRCG/src/channelList.cpp3
-rw-r--r--protocols/IRCG/src/commandmonitor.cpp14
-rw-r--r--protocols/IRCG/src/input.cpp2
-rw-r--r--protocols/IRCG/src/ircproto.cpp1
-rw-r--r--protocols/IRCG/src/output.cpp3
-rw-r--r--protocols/IRCG/src/services.cpp104
-rw-r--r--protocols/IRCG/src/stdafx.h16
-rw-r--r--protocols/IRCG/src/tools.cpp75
-rw-r--r--protocols/JabberG/src/jabber_chat.cpp4
-rw-r--r--protocols/JabberG/src/jabber_groupchat.cpp1
-rw-r--r--protocols/MinecraftDynmap/src/chat.cpp6
-rw-r--r--protocols/SkypeWeb/src/skype_chatrooms.cpp7
-rw-r--r--protocols/Telegram/src/groupchat.cpp1
-rw-r--r--protocols/Twitter/src/chat.cpp2
-rw-r--r--protocols/VKontakte/src/vk_chats.cpp3
-rw-r--r--protocols/VKontakte/src/vk_feed.cpp1
-rw-r--r--protocols/WhatsApp/src/chats.cpp1
20 files changed, 90 insertions, 163 deletions
diff --git a/protocols/Discord/src/groupchat.cpp b/protocols/Discord/src/groupchat.cpp
index 60d9a52329..b9376e1404 100644
--- a/protocols/Discord/src/groupchat.cpp
+++ b/protocols/Discord/src/groupchat.cpp
@@ -370,7 +370,6 @@ int CDiscordProto::GroupchatEventHook(WPARAM, LPARAM lParam)
}
}
- Chat_UnescapeTags(wszText.GetBuffer());
SendMsg(si->hContact, (si->pDlg) ? si->pDlg->m_hQuoteEvent : 0, T2Utf(wszText));
}
break;
diff --git a/protocols/Facebook/src/groupchats.cpp b/protocols/Facebook/src/groupchats.cpp
index adf0ab06b5..b185026215 100644
--- a/protocols/Facebook/src/groupchats.cpp
+++ b/protocols/Facebook/src/groupchats.cpp
@@ -161,15 +161,12 @@ int FacebookProto::GroupchatEventHook(WPARAM, LPARAM lParam)
break;
if (m_bOnline) {
- wchar_t *wszText = NEWWSTR_ALLOCA(gch->ptszText);
- Chat_UnescapeTags(wszText);
-
- int mid = SendMsg(si->hContact, 0, T2Utf(wszText));
+ int mid = SendMsg(si->hContact, 0, T2Utf(gch->ptszText));
mir_cslock lck(m_csOwnMessages);
for (auto &msg : arOwnMessages)
if (msg->reqId == mid)
- msg->wszText = wszText;
+ msg->wszText = gch->ptszText;
}
break;
diff --git a/protocols/Facebook/src/server.cpp b/protocols/Facebook/src/server.cpp
index b45e644ce7..4a22f18132 100644
--- a/protocols/Facebook/src/server.cpp
+++ b/protocols/Facebook/src/server.cpp
@@ -969,7 +969,6 @@ bool FacebookProto::CheckOwnMessage(FacebookUser *pUser, __int64 offlineId, cons
if (pUser->bIsChat) {
CMStringW wszId(FORMAT, L"%lld", m_uid);
- tmp.wszText.Replace(L"%", L"%%");
wchar_t userId[100];
_i64tow_s(pUser->id, userId, _countof(userId), 10);
diff --git a/protocols/IRCG/src/channelList.cpp b/protocols/IRCG/src/channelList.cpp
index c2de0eaa10..3669b9e942 100644
--- a/protocols/IRCG/src/channelList.cpp
+++ b/protocols/IRCG/src/channelList.cpp
@@ -293,8 +293,9 @@ public:
wszTopic.Delete(0, iEnd);
}
+ wszTopic = DoColorCodes(wszTopic);
lvItem.iSubItem = 3;
- lvItem.pszText = DoColorCodes(wszTopic, TRUE, FALSE);
+ lvItem.pszText = wszTopic.GetBuffer();
m_list.SetItem(&lvItem);
int percent = 100;
diff --git a/protocols/IRCG/src/commandmonitor.cpp b/protocols/IRCG/src/commandmonitor.cpp
index 28350171b2..4daf29d855 100644
--- a/protocols/IRCG/src/commandmonitor.cpp
+++ b/protocols/IRCG/src/commandmonitor.cpp
@@ -221,7 +221,7 @@ int CIrcProto::AddOutgoingMessageToDB(MCONTACT hContact, const wchar_t *msg)
if (m_iStatus == ID_STATUS_OFFLINE || m_iStatus == ID_STATUS_CONNECTING)
return 0;
- CMStringW S = DoColorCodes(msg, TRUE, FALSE);
+ CMStringW S = DoColorCodes(msg);
DBEVENTINFO dbei = {};
dbei.szModule = m_szModuleName;
@@ -682,7 +682,7 @@ bool CIrcProto::OnIrc_PRIVMSG(const CIrcMessage *pmsg)
bool bIsChannel = IsChannel(pmsg->parameters[0]);
if (pmsg->m_bIncoming && !bIsChannel) {
- mess = DoColorCodes(mess, TRUE, FALSE);
+ mess = DoColorCodes(mess);
CONTACT user = { pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, false, false, false };
@@ -772,8 +772,6 @@ bool CIrcProto::IsCTCP(const CIrcMessage *pmsg)
if (IsChannel(pmsg->parameters[0])) {
if (mess.GetLength() > 1) {
mess.Delete(0, 1);
- if (!pmsg->m_bIncoming)
- mess.Replace(L"%%", L"%");
DoEvent(GC_EVENT_ACTION, pmsg->parameters[0], pmsg->m_bIncoming ? pmsg->prefix.sNick : m_info.sNick, mess, nullptr, nullptr, NULL, true, pmsg->m_bIncoming ? false : true);
}
@@ -1173,7 +1171,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage *pmsg)
CONTACT user = { pmsg->prefix.sNick, pmsg->prefix.sUser, pmsg->prefix.sHost, false, false, false };
MCONTACT hContact = CList_FindContact(&user);
if (hContact)
- setWString(hContact, "MirVer", DoColorCodes(GetWordAddress(mess, 1), TRUE, FALSE));
+ setWString(hContact, "MirVer", DoColorCodes(GetWordAddress(mess, 1)));
}
// if the whois window is visible and the ctcp reply belongs to the user in it, then show the reply in the whois window
@@ -1182,7 +1180,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage *pmsg)
if (mir_wstrcmpi(szTemp, pmsg->prefix.sNick) == 0) {
if (pmsg->m_bIncoming && (command == L"version" || command == L"userinfo" || command == L"time")) {
SetActiveWindow(m_whoisDlg->GetHwnd());
- m_whoisDlg->m_Reply.SetText(DoColorCodes(GetWordAddress(mess, 1), TRUE, FALSE));
+ m_whoisDlg->m_Reply.SetText(DoColorCodes(GetWordAddress(mess, 1)));
return true;
}
if (pmsg->m_bIncoming && command == L"ping") {
@@ -1194,7 +1192,7 @@ bool CIrcProto::IsCTCP(const CIrcMessage *pmsg)
else
mir_snwprintf(szTmp, TranslateT("%u seconds"), s);
- m_whoisDlg->m_Reply.SetText(DoColorCodes(szTmp, TRUE, FALSE));
+ m_whoisDlg->m_Reply.SetText(DoColorCodes(szTmp));
return true;
}
}
@@ -1742,7 +1740,7 @@ bool CIrcProto::OnIrc_ERROR(const CIrcMessage *pmsg)
if (pmsg->m_bIncoming && !m_disableErrorPopups && m_iDesiredStatus != ID_STATUS_OFFLINE) {
CMStringW S;
if (pmsg->parameters.getCount() > 0)
- S = DoColorCodes(pmsg->parameters[0], TRUE, FALSE);
+ S = DoColorCodes(pmsg->parameters[0]);
else
S = TranslateT("Unknown");
Clist_TrayNotifyW(m_szModuleName, TranslateT("IRC error"), S, NIIF_ERROR, 15000);
diff --git a/protocols/IRCG/src/input.cpp b/protocols/IRCG/src/input.cpp
index 4245d8764f..1030a67043 100644
--- a/protocols/IRCG/src/input.cpp
+++ b/protocols/IRCG/src/input.cpp
@@ -490,7 +490,6 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo
return true;
CMStringW S = L"/ME " + DoIdentifiers(GetWordAddress(text, 1), window);
- S.Replace(L"%", L"%%");
Chat_SendUserMessage(m_szModuleName, S);
return true;
}
@@ -500,7 +499,6 @@ BOOL CIrcProto::DoHardcodedCommand(CMStringW text, wchar_t *window, MCONTACT hCo
return true;
CMStringW S = DoIdentifiers(GetWordAddress(text, 1), window);
- S.Replace(L"%", L"%%");
Chat_SendUserMessage(m_szModuleName, S);
return true;
}
diff --git a/protocols/IRCG/src/ircproto.cpp b/protocols/IRCG/src/ircproto.cpp
index 8d8c4bd23f..05a2001da9 100644
--- a/protocols/IRCG/src/ircproto.cpp
+++ b/protocols/IRCG/src/ircproto.cpp
@@ -516,7 +516,6 @@ HANDLE CIrcProto::SendFile(MCONTACT hContact, const wchar_t*, wchar_t** ppszFile
// need to make sure that %'s are doubled to avoid having chat interpret as color codes
CMStringW sFileCorrect = dci->sFile;
- sFileCorrect.Replace(L"%", L"%%");
// is it an reverse filetransfer (receiver acts as server)
if (dci->bReverse) {
diff --git a/protocols/IRCG/src/output.cpp b/protocols/IRCG/src/output.cpp
index be429f5571..0c43081131 100644
--- a/protocols/IRCG/src/output.cpp
+++ b/protocols/IRCG/src/output.cpp
@@ -109,9 +109,6 @@ BOOL CIrcProto::ShowMessage(const CIrcMessage* pmsg)
{
CMStringW mess = FormatOutput(pmsg);
- if (!pmsg->m_bIncoming)
- mess.Replace(L"%%", L"%");
-
int iTemp = _wtoi(pmsg->sCommand);
//To active window
diff --git a/protocols/IRCG/src/services.cpp b/protocols/IRCG/src/services.cpp
index 2fccbe141d..ab45a31c83 100644
--- a/protocols/IRCG/src/services.cpp
+++ b/protocols/IRCG/src/services.cpp
@@ -352,76 +352,64 @@ static wchar_t* DoPrintColor(wchar_t *pDest, int iFG, int iBG)
return pDest;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static void DoChatFormatting(CMStringW &wszText)
{
int iFG = -1, iBG = -1;
wchar_t InsertThis[50];
+ CMStringW tmp;
- for (int i = 0; i < wszText.GetLength(); i++) {
- if (wszText[i] != '%')
+ for (const wchar_t *p = wszText; *p; p++) {
+ if (*p != '[') {
+ tmp.AppendChar(*p);
continue;
+ }
- switch (wszText[i + 1]) {
- case 'B':
- case 'b':
- wszText.Delete(i, 2);
- wszText.Insert(i, irc::BOLD);
- break;
- case 'I':
- case 'i':
- wszText.Delete(i, 2);
- wszText.Insert(i, irc::ITALICS);
- break;
- case 'U':
- case 'u':
- wszText.Delete(i, 2);
- wszText.Insert(i, irc::UNDERLINE);
- break;
-
- case 'c':
- wszText.Delete(i, 2);
- iFG = _wtoi(wszText.GetString() + i);
- wszText.Delete(i, (iFG < 10) ? 1 : 2);
-
- iFG = (iFG < 0 || iFG >= _countof(mapSrmm2irc)) ? -1 : mapSrmm2irc[iFG];
- wszText.Insert(i, DoPrintColor(InsertThis, iFG, iBG));
- break;
+ p++;
+ bool bEnable = true;
+ if (*p == '/') {
+ p++;
+ bEnable = false;
+ }
- case 'C':
- if (wszText[i + 2] == '%' && wszText[i + 3] == 'F') {
- wszText.Delete(i, 4);
- iBG = -1;
- }
- else wszText.Delete(i, 2);
+ if (!wcsncmp(p, L"b]", 2)) {
+ tmp.AppendChar(irc::BOLD);
+ p++;
+ }
+ else if (!wcsncmp(p, L"i]", 2)) {
+ tmp.AppendChar(irc::ITALICS);
+ p++;
+ }
+ else if (!wcsncmp(p, L"u]", 2)) {
+ tmp.AppendChar(irc::UNDERLINE);
+ p++;
+ }
+ else if (!wcsncmp(p, L"color=", 6)) {
+ if (1 != swscanf(p + 6, L"%08X", &iFG))
+ iFG = -1;
+ tmp.Append(DoPrintColor(InsertThis, iFG, iBG));
+ p = wcschr(p, ']');
+ }
+ else if (!wcsncmp(p, L"color]", 6) && !bEnable) {
iFG = -1;
- wszText.Insert(i, DoPrintColor(InsertThis, iFG, iBG));
- break;
-
- case 'f':
- wszText.Delete(i, 2);
- iBG = _wtoi(wszText.GetString() + i);
- wszText.Delete(i, (iBG < 10) ? 1 : 2);
-
- iBG = (iBG < 0 || iBG >= _countof(mapSrmm2irc)) ? -1 : mapSrmm2irc[iBG];
- wszText.Insert(i, DoPrintColor(InsertThis, iFG, iBG));
- break;
-
- case 'F':
- wszText.Delete(i, 2);
+ tmp.Append(DoPrintColor(InsertThis, iFG, iBG));
+ p += 6;
+ }
+ else if (!wcsncmp(p, L"bkcolor=", 8)) {
+ if (1 != swscanf(p + 6, L"%08X", &iBG))
+ iBG = -1;
+ tmp.Append(DoPrintColor(InsertThis, iFG, iBG));
+ p = wcschr(p, ']');
+ }
+ else if (!wcsncmp(p, L"bkcolor]", 8) && !bEnable) {
iBG = -1;
- wszText.Insert(i, DoPrintColor(InsertThis, iFG, iBG));
- break;
-
- case '%':
- wszText.Delete(i, 1);
- i++;
- break;
-
- default:
- wszText.Delete(i, 2);
- break;
+ tmp.Append(DoPrintColor(InsertThis, iFG, iBG));
+ p += 8;
}
+ else tmp.AppendChar('['); // sometimes a banana is just a banana
}
+ wszText = tmp;
}
int __cdecl CIrcProto::GCEventHook(WPARAM, LPARAM lParam)
diff --git a/protocols/IRCG/src/stdafx.h b/protocols/IRCG/src/stdafx.h
index f83906cfcd..04751ac5eb 100644
--- a/protocols/IRCG/src/stdafx.h
+++ b/protocols/IRCG/src/stdafx.h
@@ -207,14 +207,14 @@ void UninitContactMenus(void);
void InitIcons(void);
// tools.cpp
-int __stdcall WCCmp(const wchar_t* wild, const wchar_t* string);
-char* __stdcall IrcLoadFile(wchar_t * szPath);
-CMStringW __stdcall GetWord(const wchar_t* text, int index);
-const wchar_t* __stdcall GetWordAddress(const wchar_t* text, int index);
-void __stdcall RemoveLinebreaks(CMStringW& Message);
-wchar_t* __stdcall DoColorCodes(const wchar_t* text, bool bStrip, bool bReplacePercent);
-
-CMStringA __stdcall GetWord(const char* text, int index);
+int WCCmp(const wchar_t* wild, const wchar_t* string);
+char* IrcLoadFile(wchar_t * szPath);
+CMStringW GetWord(const wchar_t* text, int index);
+const wchar_t* GetWordAddress(const wchar_t* text, int index);
+void RemoveLinebreaks(CMStringW& Message);
+CMStringW DoColorCodes(const wchar_t* text, bool bStrip = true);
+
+CMStringA GetWord(const char* text, int index);
__forceinline const wchar_t* s2null(const CMStringW &str)
{
diff --git a/protocols/IRCG/src/tools.cpp b/protocols/IRCG/src/tools.cpp
index f32a001092..6e71adfc53 100644
--- a/protocols/IRCG/src/tools.cpp
+++ b/protocols/IRCG/src/tools.cpp
@@ -274,60 +274,43 @@ static const wchar_t* DoEnterNumber(const wchar_t *text, int &res)
return text;
}
-wchar_t* __stdcall DoColorCodes(const wchar_t *text, bool bStrip, bool bReplacePercent)
+CMStringW DoColorCodes(const wchar_t *text, bool bStrip)
{
- static wchar_t szTemp[4000]; szTemp[0] = 0;
- wchar_t* p = szTemp;
+ CMStringW ret;
bool bBold = false;
bool bUnderline = false;
bool bItalics = false;
- int iFG = -1, iBG = -1;
-
+ int iFG = -1, iBG = -1, numColors = 0;
+ COLORREF *pClrTable = Srmm_GetColorTable(&numColors);
+
if (!text)
- return szTemp;
+ return ret;
while (*text != 0) {
switch (*text) {
- case '%': // escape
- *p++ = '%';
- if (bReplacePercent)
- *p++ = '%';
- text++;
- break;
-
case irc::BOLD:
- if (!bStrip) {
- *p++ = '%';
- *p++ = bBold ? 'B' : 'b';
- }
bBold = !bBold;
+ if (!bStrip)
+ ret.Append(bBold ? L"[b]" : L"[/b]");
text++;
break;
case irc::RESET:
- if (!bStrip) {
- *p++ = '%';
- *p++ = 'r';
- }
bUnderline = bItalics = bBold = false;
text++;
break;
case irc::ITALICS:
- if (!bStrip) {
- *p++ = '%';
- *p++ = bItalics ? 'I' : 'i';
- }
bItalics = !bItalics;
+ if (!bStrip)
+ ret.Append(bItalics ? L"[i]" : L"[/i]");
text++;
break;
case irc::UNDERLINE:
- if (!bStrip) {
- *p++ = '%';
- *p++ = bUnderline ? 'U' : 'u';
- }
bUnderline = !bUnderline;
+ if (!bStrip)
+ ret.Append(bUnderline ? L"[u]" : L"[/u]");
text++;
break;
@@ -343,41 +326,29 @@ wchar_t* __stdcall DoColorCodes(const wchar_t *text, bool bStrip, bool bReplaceP
// create tag for chat.dll
if (!bStrip) {
- wchar_t buf[10];
if (iFG != iOldFG) {
- *p++ = '%';
if (iFG == -1)
- *p++ = 'C';
- else {
- *p++ = 'c';
- mir_snwprintf(buf, L"%02u", iFG);
- *p++ = buf[0];
- *p++ = buf[1];
- }
+ ret.Append(L"[/color]");
+ else if (iFG < numColors)
+ ret.Append(L"[color=%08X]", pClrTable[iFG]);
}
if (iBG != iOldBG) {
- *p++ = '%';
- if (iBG == -1)
- *p++ = 'F';
- else {
- *p++ = 'f';
- mir_snwprintf(buf, L"%02u", iBG);
- *p++ = buf[0];
- *p++ = buf[1];
- }
+ if (iFG == -1)
+ ret.Append(L"[/bkcolor]");
+ else if (iFG < numColors)
+ ret.Append(L"[bkcolor=%08X]", pClrTable[iFG]);
}
}
break;
default:
- *p++ = *text++;
+ ret.AppendChar(*text++);
break;
}
}
- *p = 0;
- return szTemp;
+ return ret;
}
INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t *pszWindow, const wchar_t *pszNick,
@@ -389,7 +360,7 @@ INT_PTR CIrcProto::DoEvent(int iEvent, const wchar_t *pszWindow, const wchar_t *
CMStringW sText;
if (pszText)
- sText = DoColorCodes(pszText, FALSE, TRUE);
+ sText = DoColorCodes(pszText, false);
GCEVENT gce = {};
if (pszWindow)
@@ -537,7 +508,7 @@ int CIrcProto::SetChannelSBText(CMStringW sWindow, CHANNELINFO *wi)
}
if (wi->pszTopic)
sTemp += wi->pszTopic;
- sTemp = DoColorCodes(sTemp, TRUE, FALSE);
+ sTemp = DoColorCodes(sTemp);
Chat_SetStatusbarText(Chat_Find(sWindow, m_szModuleName), sTemp);
return 0;
}
diff --git a/protocols/JabberG/src/jabber_chat.cpp b/protocols/JabberG/src/jabber_chat.cpp
index 622cad1869..b68edc5c81 100644
--- a/protocols/JabberG/src/jabber_chat.cpp
+++ b/protocols/JabberG/src/jabber_chat.cpp
@@ -224,8 +224,6 @@ void CJabberProto::GcLogShowInformation(JABBER_LIST_ITEM *item, pResourceStatus
}
if (!buf.IsEmpty()) {
- buf.Replace("%", "%%");
-
GCEVENT gce = { item->si, GC_EVENT_INFORMATION };
gce.dwFlags = GCEF_UTF8 + GCEF_ADDTOLOG;
gce.pszNick.a = gce.pszUID.a = user->m_szResourceName;
@@ -966,7 +964,6 @@ static void sttNickListHook(CJabberProto *ppro, JABBER_LIST_ITEM *item, GCHOOK*
buf.Format("%s%s%s", szMessage.get(), him->m_szResourceName.get(), p + 2);
}
else buf = szMessage;
- buf.Replace("%%", "%");
ppro->m_ThreadInfo->send(
XmlNode("message") << XATTR("to", item->jid) << XATTR("type", "groupchat")
@@ -1345,7 +1342,6 @@ int CJabberProto::JabberGcEventHook(WPARAM, LPARAM lParam)
case GC_USER_MESSAGE:
if (gch->ptszText && mir_wstrlen(gch->ptszText) > 0) {
rtrimw(gch->ptszText);
- Chat_UnescapeTags(gch->ptszText);
SendMsg(item->hContact, 0, T2Utf(gch->ptszText));
}
break;
diff --git a/protocols/JabberG/src/jabber_groupchat.cpp b/protocols/JabberG/src/jabber_groupchat.cpp
index 9f8343379f..47ee405834 100644
--- a/protocols/JabberG/src/jabber_groupchat.cpp
+++ b/protocols/JabberG/src/jabber_groupchat.cpp
@@ -1059,7 +1059,6 @@ void CJabberProto::GroupchatProcessMessage(const TiXmlElement *node)
else nick = nullptr;
CMStringA szText(msgText);
- szText.Replace("%", "%%");
szText += imgLink;
gce.dwFlags = GCEF_UTF8;
diff --git a/protocols/MinecraftDynmap/src/chat.cpp b/protocols/MinecraftDynmap/src/chat.cpp
index f0c3122634..ef3943e2c8 100644
--- a/protocols/MinecraftDynmap/src/chat.cpp
+++ b/protocols/MinecraftDynmap/src/chat.cpp
@@ -24,13 +24,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void MinecraftDynmapProto::UpdateChat(const char *name, const char *message, const time_t timestamp, bool addtolog)
{
// replace % to %% to not interfere with chat color codes
- CMStringA szMessage(message);
- szMessage.Replace("%", "%%");
-
GCEVENT gce = {m_si, GC_EVENT_MESSAGE };
gce.dwFlags = GCEF_UTF8;
gce.time = timestamp;
- gce.pszText.a = szMessage.c_str();
+ gce.pszText.a = message;
if (name == NULL) {
gce.iType = GC_EVENT_INFORMATION;
@@ -56,7 +53,6 @@ int MinecraftDynmapProto::OnChatEvent(WPARAM, LPARAM lParam)
case GC_USER_MESSAGE:
{
CMStringA szText(ptrA(mir_utf8encodeW(hook->ptszText)));
- szText.Replace("%%", "%");
if (szText.IsEmpty())
break;
diff --git a/protocols/SkypeWeb/src/skype_chatrooms.cpp b/protocols/SkypeWeb/src/skype_chatrooms.cpp
index 4df199e3f0..0a64587ece 100644
--- a/protocols/SkypeWeb/src/skype_chatrooms.cpp
+++ b/protocols/SkypeWeb/src/skype_chatrooms.cpp
@@ -328,12 +328,9 @@ void CSkypeProto::SendChatMessage(SESSION_INFO *si, const wchar_t *tszMessage)
if (!IsOnline())
return;
- wchar_t *buf = NEWWSTR_ALLOCA(tszMessage);
- rtrimw(buf);
- Chat_UnescapeTags(buf);
-
T2Utf chat_id(si->ptszID);
- ptrA szMessage(mir_utf8encodeW(buf));
+ ptrA szMessage(mir_utf8encodeW(tszMessage));
+ rtrim(szMessage);
if (strncmp(szMessage, "/me ", 4) == 0)
PushRequest(new SendChatActionRequest(chat_id, time(0), szMessage));
diff --git a/protocols/Telegram/src/groupchat.cpp b/protocols/Telegram/src/groupchat.cpp
index fddb95809b..a591e1ae80 100644
--- a/protocols/Telegram/src/groupchat.cpp
+++ b/protocols/Telegram/src/groupchat.cpp
@@ -203,7 +203,6 @@ int CTelegramProto::GcEventHook(WPARAM, LPARAM lParam)
case GC_USER_MESSAGE:
if (gch->ptszText && mir_wstrlen(gch->ptszText) > 0) {
rtrimw(gch->ptszText);
- Chat_UnescapeTags(gch->ptszText);
if (auto *pUser = FindUser(userId)) {
TD::int53 replyId = 0;
if (auto *pDlg = gch->si->pDlg) {
diff --git a/protocols/Twitter/src/chat.cpp b/protocols/Twitter/src/chat.cpp
index 6f463c7f20..83ca3ffbd2 100644
--- a/protocols/Twitter/src/chat.cpp
+++ b/protocols/Twitter/src/chat.cpp
@@ -24,7 +24,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void CTwitterProto::UpdateChat(const twitter_user &update)
{
CMStringA chatText = update.status.text.c_str();
- chatText.Replace("%", "%%");
GCEVENT gce = { m_si, GC_EVENT_MESSAGE };
gce.dwFlags = GCEF_UTF8 + GCEF_ADDTOLOG;
@@ -54,7 +53,6 @@ int CTwitterProto::OnChatOutgoing(WPARAM, LPARAM lParam)
debugLogW(L"**Chat - Outgoing message: %s", hook->ptszText);
{
CMStringA tweet(T2Utf(hook->ptszText).get());
- tweet.Replace("%%", "%"); // the chat plugin will turn "%" into "%%", so we have to change it back :/
char *varTweet = mir_strdup(tweet.c_str());
ForkThread(&CTwitterProto::SendTweetWorker, varTweet);
diff --git a/protocols/VKontakte/src/vk_chats.cpp b/protocols/VKontakte/src/vk_chats.cpp
index 709465dda5..68ada0350f 100644
--- a/protocols/VKontakte/src/vk_chats.cpp
+++ b/protocols/VKontakte/src/vk_chats.cpp
@@ -521,8 +521,6 @@ void CVkProto::AppendChatConversationMessage(VKUserID_t iChatId, const JSONNode&
wszBody.AppendFormat(L": %s (%s)", TranslateT("chat action not supported"), wszAction.c_str());
}
- wszBody.Replace(L"%", L"%%");
-
if (vkChatInfo->m_bHistoryRead) {
AppendChatMessage(vkChatInfo, iMessageId, iReplyMsgId, iUserId, tMsgTime, wszBody, bIsHistory, bIsAction);
}
@@ -657,7 +655,6 @@ int CVkProto::OnChatEvent(WPARAM, LPARAM lParam)
if (IsOnline() && mir_wstrlen(gch->ptszText) > 0) {
ptrW pwszBuf(mir_wstrdup(gch->ptszText));
rtrimw(pwszBuf);
- Chat_UnescapeTags(pwszBuf);
SendMsg(cc->m_si->hContact, gch->si->pDlg ? gch->si->pDlg->m_hQuoteEvent : 0, T2Utf(pwszBuf));
}
break;
diff --git a/protocols/VKontakte/src/vk_feed.cpp b/protocols/VKontakte/src/vk_feed.cpp
index c45519c54b..f1646c6a78 100644
--- a/protocols/VKontakte/src/vk_feed.cpp
+++ b/protocols/VKontakte/src/vk_feed.cpp
@@ -315,7 +315,6 @@ CMStringW CVkProto::GetVkFeedback(const JSONNode &jnFeedback, VKObjType vkFeedba
if (iUserId) {
vkUser = GetVkUserInfo(iUserId, vkUsers);
CMStringW wszText(jnFeedback["text"].as_mstring());
- wszText.Replace(L"%", L"%%");
wszRes.AppendFormat(wszFormat, SetBBCString(vkUser->m_wszUserNick, m_vkOptions.BBCForNews(), vkbbcUrl, vkUser->m_wszLink).c_str(), ClearFormatNick(wszText).c_str());
}
diff --git a/protocols/WhatsApp/src/chats.cpp b/protocols/WhatsApp/src/chats.cpp
index 031fbaf677..16d8be872d 100644
--- a/protocols/WhatsApp/src/chats.cpp
+++ b/protocols/WhatsApp/src/chats.cpp
@@ -144,7 +144,6 @@ int WhatsAppProto::GcEventHook(WPARAM, LPARAM lParam)
case GC_USER_MESSAGE:
if (gch->ptszText && mir_wstrlen(gch->ptszText) > 0) {
rtrimw(gch->ptszText);
- Chat_UnescapeTags(gch->ptszText);
SendTextMessage(pUser->szId, T2Utf(gch->ptszText));
}
break;