summaryrefslogtreecommitdiff
path: root/protocols/SkypeWeb/src/skype_timers.cpp
blob: ddc72aaa1b128981b22b0aa70c47e92b2247debd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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;
}