summaryrefslogtreecommitdiff
path: root/protocols/VKontakte/src/vk_thread.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-02-01 11:09:55 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-02-01 11:09:55 +0000
commit359b8eada7a52483c0447fd9cdbfc09517022668 (patch)
tree658283da9c133c1c2e2e30317e39ae8a4304ee78 /protocols/VKontakte/src/vk_thread.cpp
parentf648e8aba5e2580aa1da0f80f9626f89d465d778 (diff)
VK: fix for going offline while protocol is online
git-svn-id: http://svn.miranda-ng.org/main/trunk@7984 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/VKontakte/src/vk_thread.cpp')
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/protocols/VKontakte/src/vk_thread.cpp b/protocols/VKontakte/src/vk_thread.cpp
index eb7e1a5344..99a790d206 100644
--- a/protocols/VKontakte/src/vk_thread.cpp
+++ b/protocols/VKontakte/src/vk_thread.cpp
@@ -44,13 +44,25 @@ static VOID CALLBACK TimerProc(HWND, UINT, UINT_PTR pObject, DWORD)
ppro->SetServerStatus(ppro->m_iStatus);
}
+static void CALLBACK VKSetTimer(void *pObject)
+{
+ CVkProto *ppro = (CVkProto*)pObject;
+ ppro->m_timer = SetTimer(NULL, (UINT_PTR)ppro, 870000, TimerProc);
+}
+
+static void CALLBACK VKUnsetTimer(void *pObject)
+{
+ CVkProto *ppro = (CVkProto*)pObject;
+ KillTimer(NULL, ppro->m_timer);
+}
+
void CVkProto::OnLoggedIn()
{
m_bOnline = true;
SetServerStatus(m_iDesiredStatus);
// initialize online timer
- m_timer = SetTimer(NULL, (UINT_PTR)this, 870000, TimerProc);
+ CallFunctionAsync(VKSetTimer, this);
}
void CVkProto::OnLoggedOut()
@@ -63,7 +75,7 @@ void CVkProto::OnLoggedOut()
ProtoBroadcastAck(NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)m_iStatus, ID_STATUS_OFFLINE);
m_iStatus = m_iDesiredStatus = ID_STATUS_OFFLINE;
- KillTimer(NULL, m_timer);
+ CallFunctionAsync(VKUnsetTimer, this);
SetAllContactStatuses(ID_STATUS_OFFLINE);
m_chats.destroy();
}