From f972259d059e76876530e95a7d7b4919aa7e7128 Mon Sep 17 00:00:00 2001 From: leecher1337 Date: Mon, 1 Aug 2016 23:43:49 +0000 Subject: MSN: Filter some control charaxters in text that MSN protocol doesn't seem to like. git-svn-id: http://svn.miranda-ng.org/main/trunk@17153 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/MSN/src/msn_misc.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'protocols/MSN/src/msn_misc.cpp') diff --git a/protocols/MSN/src/msn_misc.cpp b/protocols/MSN/src/msn_misc.cpp index 7fa82d51e8..82808220e3 100644 --- a/protocols/MSN/src/msn_misc.cpp +++ b/protocols/MSN/src/msn_misc.cpp @@ -483,6 +483,9 @@ int ThreadData::sendMessage(int, const char *email, int netId, const char *parMs if (!proto->getString("Nick", &dbv)) pszNick = dbv.pszVal; + CMStringA msgClean; + + for (BYTE *p = (BYTE*)parMsg; *p; p++) if (*p >= 0x20 || (*p>=0x09 && *p<=0x0D)) msgClean.AppendChar(*p); buf.AppendFormat( "Messaging: 2.0\r\n" "Client-Message-ID: %llu\r\n" @@ -490,11 +493,11 @@ int ThreadData::sendMessage(int, const char *email, int netId, const char *parMs "IM-Display-Name: %s\r\n" "Content-Type: %s\r\n" "Content-Length: %d\r\n", - msgid, pszMsgType, pszNick, pszContType, mir_strlen(parMsg)); + msgid, pszMsgType, pszNick, pszContType, msgClean.GetLength()); if (*tFontName) buf.AppendFormat("X-MMS-IM-Format: FN=%s; EF=%s; CO=%x; CS=0; PF=31%s\r\n", tFontName, tFontStyle, tFontColor, (parFlags & MSG_RTL) ? ";RL=1" : ""); - buf.AppendFormat("\r\n%s", parMsg); + buf.AppendFormat("\r\n%s", msgClean); if (pszNick!=proto->MyOptions.szEmail) db_free(&dbv); parMsg = buf; -- cgit v1.2.3