diff options
author | George Hazan <george.hazan@gmail.com> | 2013-10-13 09:15:49 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-10-13 09:15:49 +0000 |
commit | b245e6b6c7111c34302d73ccef60ebef8f248ce4 (patch) | |
tree | 1ac732c7290539d2f85efba6e904f0abb11a5fa0 /protocols/VKontakte/src/vk_thread.cpp | |
parent | 06976a2f446e21dd5189bdb253ec4f80602738f8 (diff) |
- fixed multiple working thread creation;
- set contacts to offline upon disconnect
git-svn-id: http://svn.miranda-ng.org/main/trunk@6479 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_thread.cpp')
-rw-r--r-- | protocols/VKontakte/src/vk_thread.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp index 71b572e903..373233f3b6 100644 --- a/protocols/VKontakte/src/vk_thread.cpp +++ b/protocols/VKontakte/src/vk_thread.cpp @@ -55,19 +55,20 @@ void CVkProto::OnLoggedIn() HttpParam param = { "access_token", m_szAccessToken };
PushAsyncHttpRequest(REQUEST_GET, "/method/getUserInfoEx.json", true, &CVkProto::OnReceiveMyInfo, 1, ¶m);
-
- SetAllContactStatuses(ID_STATUS_OFFLINE);
}
void CVkProto::OnLoggedOut()
{
- m_hWorkerThread = 0;
m_bOnline = false;
+ if (m_pollingConn)
+ CallService(MS_NETLIB_SHUTDOWN, (WPARAM)m_pollingConn, 0);
+
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)m_iStatus, ID_STATUS_OFFLINE);
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
KillTimer(NULL, m_timer);
+ SetAllContactStatuses(ID_STATUS_OFFLINE);
}
int CVkProto::SetServerStatus(int iStatus)
@@ -509,13 +510,20 @@ int CVkProto::PollServer() else retVal = 0;
}
+ m_pollingConn = reply->nlc;
+
CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)reply);
return retVal;
}
void CVkProto::PollingThread(void*)
{
+ debugLogA("CVkProto::PollingThread: entering");
+
while (!m_bTerminated)
if (PollServer() == -1)
break;
+
+ m_pollingConn = 0;
+ debugLogA("CVkProto::PollingThread: leaving");
}
|