summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_timers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/SkypeWeb/src/skype_timers.cpp')
-rw-r--r--protocols/SkypeWeb/src/skype_timers.cpp39
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;
+}