summaryrefslogtreecommitdiff
path: root/protocols/Omegle/src/chat.cpp
diff options
context:
space:
mode:
authorRobert Pösel <robyer@seznam.cz>2014-07-30 23:29:59 +0000
committerRobert Pösel <robyer@seznam.cz>2014-07-30 23:29:59 +0000
commit3bdff57b5868e9d333f61297021f7943ed160500 (patch)
treea2514a7aafecf82d7900371a8550769d6f0bf7af /protocols/Omegle/src/chat.cpp
parent548bcad3fa31c55c33200c3516a5a537ca5e3f0d (diff)
Omegle: Fix sending and receiving % in chats
git-svn-id: http://svn.miranda-ng.org/main/trunk@10002 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/Omegle/src/chat.cpp')
-rw-r--r--protocols/Omegle/src/chat.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/protocols/Omegle/src/chat.cpp b/protocols/Omegle/src/chat.cpp
index 007a8cbd38..cf98c66a32 100644
--- a/protocols/Omegle/src/chat.cpp
+++ b/protocols/Omegle/src/chat.cpp
@@ -23,10 +23,14 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
void OmegleProto::UpdateChat(const TCHAR *name, const TCHAR *message, bool addtolog)
{
+ // replace % to %% to not interfere with chat color codes
+ std::tstring smessage = message;
+ utils::text::treplace_all(&smessage, _T("%"), _T("%%"));
+
GCDEST gcd = { m_szModuleName, m_tszUserName, GC_EVENT_MESSAGE };
GCEVENT gce = { sizeof(gce), &gcd };
gce.time = ::time(NULL);
- gce.ptszText = message;
+ gce.ptszText = smessage.c_str();
if (name == NULL) {
gcd.iType = GC_EVENT_INFORMATION;
@@ -56,6 +60,9 @@ int OmegleProto::OnChatEvent(WPARAM wParam,LPARAM lParam)
{
std::string text = mir_t2a_cp(hook->ptszText,CP_UTF8);
+ // replace %% back to %, because chat automatically does this to sent messages
+ utils::text::replace_all(&text, "%%", "%");
+
if (text.empty())
break;