summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skype_instances.cpp
blob: 5232bd7cc89f02e091a34d62d1165e73ad13f45a (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
#include "skype_proto.h"

LIST<CSkypeProto> CSkypeProto::instanceList(1, CSkypeProto::CompareProtos);

int CSkypeProto::CompareProtos(const CSkypeProto *p1, const CSkypeProto *p2)
{
	return wcscmp(p1->m_tszUserName, p2->m_tszUserName);
}

CSkypeProto* CSkypeProto::InitSkypeProto(const char* protoName, const wchar_t* userName)
{
	if (CSkypeProto::instanceList.getCount() > 0) 
	{
		CSkypeProto::ShowNotification(
			::TranslateT("SkypeKit will only permit you to login to one account at a time.\n"
						 L"Adding multiple instances of SkypeKit is prohibited in the licence "
						 L"agreement and standard distribution terms."),
			MB_ICONWARNING);
		return NULL;
	}

	CSkypeProto *ppro = new CSkypeProto(protoName, userName);
	CSkypeProto::instanceList.insert(ppro);

	return ppro;
}

int CSkypeProto::UninitSkypeProto(CSkypeProto* ppro)
{
	CSkypeProto::instanceList.remove(ppro);
	delete ppro;

	return 0;
}