summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--protocols/VKontakte/src/vk_proto.h3
-rw-r--r--protocols/VKontakte/src/vk_thread.cpp16
2 files changed, 16 insertions, 3 deletions
diff --git a/protocols/VKontakte/src/vk_proto.h b/protocols/VKontakte/src/vk_proto.h
index 9d104387e2..b4906e97d5 100644
--- a/protocols/VKontakte/src/vk_proto.h
+++ b/protocols/VKontakte/src/vk_proto.h
@@ -214,6 +214,8 @@ struct CVkProto : public PROTO<CVkProto>
__forceinline LPCTSTR getGroup() const { return m_defaultGroup; }
__forceinline void setGroup(LPCTSTR grp) { m_defaultGroup = mir_tstrdup(grp); }
+ UINT_PTR m_timer;
+
private:
friend struct AsyncHttpRequest;
@@ -271,7 +273,6 @@ private:
LONG m_myUserId;
ptrA m_szAccessToken;
ptrT m_defaultGroup;
- UINT_PTR m_timer;
ptrA m_pollingServer, m_pollingKey, m_pollingTs;
HANDLE m_pollingConn, m_hPollingThread;
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();
}