summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/vk_proto.cpp
diff options
context:
space:
mode:
authorSergey Bolhovskoy <elzorfox@ya.ru>2014-10-14 08:28:52 +0000
committerSergey Bolhovskoy <elzorfox@ya.ru>2014-10-14 08:28:52 +0000
commitdc1aa5930ea3ef174f1e47385e301c2415bea259 (patch)
tree8be84ab91b85ac3a3ce000c1261270bbd68df9be /protocols/VKontakte/src/vk_proto.cpp
parent840091c772b27f97043bede8ee6416cb6c157f0d (diff)
VKontakte:
sticker support part 2 (sending stickers) – complete git-svn-id: http://svn.miranda-ng.org/main/trunk@10779 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_proto.cpp')
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp16
1 files changed, 15 insertions, 1 deletions
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp
index 47edff6722..5270c99f2e 100644
--- a/protocols/VKontakte/src/vk_proto.cpp
+++ b/protocols/VKontakte/src/vk_proto.cpp
@@ -343,17 +343,31 @@ int CVkProto::SendMsg(MCONTACT hContact, int flags, const char *msg)
else
szMsg = mir_utf8encode(msg);
+ int StickerId = 0;
+ ptrA retMsg(GetStickerId(szMsg, StickerId));
+
ULONG msgId = ::InterlockedIncrement(&m_msgId);
AsyncHttpRequest *pReq = new AsyncHttpRequest(this, REQUEST_POST, "/method/messages.send.json", true, &CVkProto::OnSendMessage)
<< INT_PARAM("user_id", userID)
- << CHAR_PARAM("message", szMsg)
<< VER_API;
+
+ if (StickerId != 0)
+ pReq << INT_PARAM("sticker_id", StickerId);
+ else
+ pReq << CHAR_PARAM("message", szMsg);
+
pReq->AddHeader("Content-Type", "application/x-www-form-urlencoded");
pReq->pUserInfo = new CVkSendMsgParam(hContact, msgId);
Push(pReq);
if (!m_bServerDelivery)
ForkThread(&CVkProto::SendMsgAck, new TFakeAckParams(hContact, msgId));
+
+ if (retMsg){
+ int _flags = flags | PREF_UTF;
+ Sleep(330);
+ SendMsg(hContact, _flags, retMsg);
+ }
return msgId;
}