From 2d8ae354688e1a0cd015cd5e6563bfc9b21e0be4 Mon Sep 17 00:00:00 2001 From: Sergey Bolhovskoy Date: Wed, 7 Jan 2015 12:46:19 +0000 Subject: VKontakte: rework stickers sending process (path by alitor, edited) git-svn-id: http://svn.miranda-ng.org/main/trunk@11786 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/misc.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'protocols/VKontakte/src/misc.cpp') diff --git a/protocols/VKontakte/src/misc.cpp b/protocols/VKontakte/src/misc.cpp index 8df5807b8c..617da0c5eb 100644 --- a/protocols/VKontakte/src/misc.cpp +++ b/protocols/VKontakte/src/misc.cpp @@ -620,19 +620,25 @@ void CVkProto::SetSrmmReadStatus(MCONTACT hContact) char* CVkProto::GetStickerId(const char* Msg, int &stickerid) { + stickerid = 0; + char* retMsg = NULL; + int iRes = 0; char HeadMsg[32] = { 0 }; - char* retMsg = NULL; - iRes = sscanf(Msg, "[sticker:%d]", &stickerid); + const char * tmpMsg = strstr(Msg, "[sticker:"); + if (tmpMsg) + iRes = sscanf(tmpMsg, "[sticker:%d]", &stickerid); if (iRes == 1) { mir_snprintf(HeadMsg, SIZEOF(HeadMsg), "[sticker:%d]", stickerid); size_t retLen = mir_strlen(HeadMsg); - if (retLen < mir_strlen(Msg)) - retMsg = mir_strdup(&Msg[retLen]); - return retMsg; + if (retLen < mir_strlen(Msg)) { + CMStringA szMsg(Msg, mir_strlen(Msg) - mir_strlen(tmpMsg)); + szMsg.Append(&tmpMsg[retLen]); + retMsg = mir_strdup(szMsg.GetBuffer()); + } } - stickerid = 0; - return NULL; + + return retMsg; } int CVkProto::OnDbSettingChanged(WPARAM hContact, LPARAM lParam) -- cgit v1.2.3