diff options
Diffstat (limited to 'protocols/VKontakte/src/vk_proto.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_proto.cpp | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index a73b2e8267..a1b13558ad 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -453,113 +453,6 @@ DWORD_PTR CVkProto::GetCaps(int type, MCONTACT) //////////////////////////////////////////////////////////////////////////////
-int CVkProto::RecvMsg(MCONTACT hContact, PROTORECVEVENT *pre)
-{
- debugLogA("CVkProto::RecvMsg");
- Proto_RecvMessage(hContact, pre);
- return 0;
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
-void CVkProto::SendMsgAck(void *param)
-{
- debugLogA("CVkProto::SendMsgAck");
- TFakeAckParams *ack = (TFakeAckParams*)param;
- Sleep(100);
- ProtoBroadcastAck(ack->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)ack->msgid, 0);
- delete ack;
-}
-
-int CVkProto::SendMsg(MCONTACT hContact, int flags, const char *msg)
-{
- debugLogA("CVkProto::SendMsg");
- if (!IsOnline())
- return 0;
- LONG userID = getDword(hContact, "ID", -1);
- if (userID == -1 || userID == VK_FEED_USER) {
- ForkThread(&CVkProto::SendMsgAck, new TFakeAckParams(hContact, 0));
- return 0;
- }
-
- ptrA szMsg;
- if (flags & PREF_UTF)
- szMsg = mir_strdup(msg);
- else if (flags & PREF_UNICODE)
- szMsg = mir_utf8encodeW((wchar_t*)&msg[mir_strlen(msg)+1]);
- 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)
- << 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;
-}
-
-void CVkProto::OnSendMessage(NETLIBHTTPREQUEST *reply, AsyncHttpRequest *pReq)
-{
- int iResult = ACKRESULT_FAILED;
- if (pReq->pUserInfo == NULL) {
- debugLogA("CVkProto::OnSendMessage failed! (pUserInfo == NULL)");
- return;
- }
- CVkSendMsgParam *param = (CVkSendMsgParam*)pReq->pUserInfo;
-
- debugLogA("CVkProto::OnSendMessage %d", reply->resultCode);
- if (reply->resultCode == 200) {
- JSONROOT pRoot;
- JSONNODE *pResponse = CheckJsonResponse(pReq, reply, pRoot);
- if (pResponse != NULL) {
- UINT mid = json_as_int(pResponse);
- if (param->iMsgID != -1)
- m_sendIds.insert((HANDLE)mid);
- if (mid > getDword(param->hContact, "lastmsgid", 0))
- setDword(param->hContact, "lastmsgid", mid);
- if (m_iMarkMessageReadOn >= markOnReply)
- MarkMessagesRead(param->hContact);
- iResult = ACKRESULT_SUCCESS;
- }
- }
-
- if (param->iMsgID == -1) {
- CVkFileUploadParam *fup = (CVkFileUploadParam *)param->iCount;
- ProtoBroadcastAck(fup->hContact, ACKTYPE_FILE, iResult, (HANDLE)fup, 0);
- if (!pReq->bNeedsRestart)
- delete fup;
- return;
- }
- else if (m_bServerDelivery)
- ProtoBroadcastAck(param->hContact, ACKTYPE_MESSAGE, iResult, HANDLE(param->iMsgID), 0);
- if (!pReq->bNeedsRestart) {
- delete param;
- pReq->pUserInfo = NULL;
- }
-}
-
-//////////////////////////////////////////////////////////////////////////////
-
int CVkProto::OnEvent(PROTOEVENTTYPE event, WPARAM wParam, LPARAM lParam)
{
switch (event) {
|