summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skypekit/skypekit.cpp
blob: d06f5059696623c16df5804c3543f4036f1204f6 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "skypekit.h"

CSkype::CSkype(int num_threads) : Skype(num_threads)
{
	this->proto = NULL;
	this->onMessagedCallback = NULL;
}

CAccount* CSkype::newAccount(int oid) 
{ 
	return new CAccount(oid, this); 
}

CContactGroup* CSkype::newContactGroup(int oid)
{ 
	return new CContactGroup(oid, this); 
}

CContact* CSkype::newContact(int oid) 
{ 
	return new CContact(oid, this); 
}

CConversation* CSkype::newConversation(int oid) 
{ 
	return new CConversation(oid, this); 
}

CParticipant* CSkype::newParticipant(int oid) 
{ 
	return new CParticipant(oid, this); 
}

CMessage* CSkype::newMessage(int oid) 
{ 
	return new CMessage(oid, this); 
}

CTransfer* CSkype::newTransfer(int oid) 
{ 
	return new CTransfer(oid, this); 
}

CContactSearch* CSkype::newContactSearch(int oid)
{
	return new CContactSearch(oid, this);
}

bool CSkype::CreateConferenceWithConsumers(ConversationRef &conference, const SEStringList &identities)
{
	if (this->CreateConference(conference))
	{
		conference->SetOption(CConversation::P_OPT_JOINING_ENABLED, true);
		conference->SetOption(CConversation::P_OPT_ENTRY_LEVEL_RANK, CParticipant::WRITER);
		conference->SetOption(CConversation::P_OPT_DISCLOSE_HISTORY, 1);
		conference->AddConsumers(identities);

		return true;
	}

	return false;
}

void CSkype::SetOnMessageCallback(OnMessaged callback, CSkypeProto* proto)
{
	this->proto = proto;
	this->onMessagedCallback = callback;
}

void CSkype::OnMessage (
	const MessageRef & message,
	const bool & changesInboxTimestamp,
	const MessageRef & supersedesHistoryMessage,
	const ConversationRef & conversation)
{
	if (this->proto && this->onMessagedCallback)
		(proto->*onMessagedCallback)(conversation, message);
}