summaryrefslogtreecommitdiff
path: root/protocols/VKontakte
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-10-23 21:04:33 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-10-23 21:04:33 +0000
commit02c5b3e97608972a9aa6638bb73b31a4c6bddcfd (patch)
tree8fe733220a509b4f644043795de0bf72abc0d74a /protocols/VKontakte
parent6fd143b5c2f6e5d0c05657a9f7e8fe081a2447e2 (diff)
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
Diffstat (limited to 'protocols/VKontakte')
-rw-r--r--protocols/VKontakte/src/vk_proto.cpp4
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp6
2 files changed, 8 insertions, 2 deletions
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, &param);
+ }
+ else if (iStatus != ID_STATUS_INVISIBLE) {
HttpParam param = { "access_token", m_szAccessToken };
PushAsyncHttpRequest(REQUEST_GET, "/method/account.setOnline.json", true, &CVkProto::OnReceiveSmth, 1, &param);
}