diff options
author | MikalaiR <nikolay.romanovich@narod.ru> | 2015-07-30 11:48:24 +0000 |
---|---|---|
committer | MikalaiR <nikolay.romanovich@narod.ru> | 2015-07-30 11:48:24 +0000 |
commit | 6adf63a8d746ad357a3bbfedebd2281080241f19 (patch) | |
tree | 80a7972d1bfa83d25e36a985e60681a8b42ed1fa /protocols/SkypeWeb/src/skype_timers.cpp | |
parent | 1271802f514d41e8e06df7714d1f1e4a430b417b (diff) |
SkypeWeb: refactoring
git-svn-id: http://svn.miranda-ng.org/main/trunk@14758 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_timers.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_timers.cpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/protocols/SkypeWeb/src/skype_timers.cpp b/protocols/SkypeWeb/src/skype_timers.cpp new file mode 100644 index 0000000000..ddc72aaa1b --- /dev/null +++ b/protocols/SkypeWeb/src/skype_timers.cpp @@ -0,0 +1,39 @@ +#include "stdafx.h"
+
+mir_cs CSkypeProto::timerLock;
+mir_cs CSkypeProto::accountsLock;
+
+void CSkypeProto::ProcessTimer()
+{
+ if (IsOnline())
+ {
+ PushRequest(new GetContactListRequest(m_szTokenSecret), &CSkypeProto::LoadContactList);
+ SendPresence(false);
+ if (!m_hTrouterThread)
+ SendRequest(new CreateTrouterRequest(), &CSkypeProto::OnCreateTrouter);
+ }
+}
+
+void CALLBACK CSkypeProto::TimerProc(HWND, UINT, UINT_PTR, DWORD)
+{
+ mir_cslock lck(accountsLock);
+ for (int i = 0; i < Accounts.getCount(); i++)
+ {
+ Accounts[i]->ProcessTimer();
+ }
+}
+
+void CSkypeProto::SkypeSetTimer(void*)
+{
+ mir_cslock lck(timerLock);
+ if (!m_timer)
+ m_timer = SetTimer(NULL, 0, 600000, TimerProc);
+}
+
+void CSkypeProto::SkypeUnsetTimer(void*)
+{
+ mir_cslock lck(timerLock);
+ if (m_timer && Accounts.getCount() == 0)
+ KillTimer(NULL, m_timer);
+ m_timer = 0;
+}
|