From 02c5b3e97608972a9aa6638bb73b31a4c6bddcfd Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 23 Oct 2013 21:04:33 +0000 Subject: VK: forcing server offline status when going offline locally git-svn-id: http://svn.miranda-ng.org/main/trunk@6605 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/VKontakte/src/vk_proto.cpp | 4 +++- protocols/VKontakte/src/vk_thread.cpp | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) (limited to 'protocols/VKontakte/src') diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index f112ccd4fc..0f671aaa6d 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -183,8 +183,10 @@ int CVkProto::SetStatus(int iNewStatus) m_iDesiredStatus = iNewStatus; if (iNewStatus == ID_STATUS_OFFLINE) { - if ( IsOnline()) + if ( IsOnline()) { + SetServerStatus(ID_STATUS_OFFLINE); ShutdownSession(); + } m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE; ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)oldStatus, m_iStatus); diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 2d71e576c2..bb0bbb844b 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -73,7 +73,11 @@ void CVkProto::OnLoggedOut() int CVkProto::SetServerStatus(int iStatus) { - if (iStatus != ID_STATUS_OFFLINE && iStatus != ID_STATUS_INVISIBLE) { + if (iStatus == ID_STATUS_OFFLINE) { + HttpParam param = { "access_token", m_szAccessToken }; + PushAsyncHttpRequest(REQUEST_GET, "/method/account.setOffline.json", true, &CVkProto::OnReceiveSmth, 1, ¶m); + } + else if (iStatus != ID_STATUS_INVISIBLE) { HttpParam param = { "access_token", m_szAccessToken }; PushAsyncHttpRequest(REQUEST_GET, "/method/account.setOnline.json", true, &CVkProto::OnReceiveSmth, 1, ¶m); } -- cgit v1.2.3