summaryrefslogtreecommitdiff
path: root/protocols/Skype/src/skypekit/contact.cpp
blob: 07104e8dd751404aaf74e2160d82bfe630c1eb5e (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
#include "..\skype.h"
#include "contact.h"

CContact::CContact(unsigned int oid, CSkypeProto* _ppro) :
	Contact(oid, _ppro),
	proto(_ppro)
{
}

SEString CContact::GetSid()
{
	SEString result;
	CContact::AVAILABILITY availability;
	this->GetPropAvailability(availability);
	if (availability == CContact::SKYPEOUT)
		this->GetPropPstnnumber(result);
	else
		this->GetPropSkypename(result);
	return result;
}

SEString CContact::GetNick()
{
	SEString result;
	CContact::AVAILABILITY availability;
	this->GetPropAvailability(availability);
	if (availability == CContact::SKYPEOUT)
		this->GetPropPstnnumber(result);
	else
		this->GetPropFullname(result);
	return result;
}

bool CContact::GetFullname(SEString &firstName, SEString &lastName)
{
	SEString fullname;
	this->GetPropFullname(fullname);
	int pos = fullname.find(" ");
	if (pos != -1)
	{
		firstName = fullname.substr(0, pos - 1);
		lastName = fullname.right((int)fullname.size() - pos - 1);
	} else
		firstName = fullname;
	
	return true;
}

void CContact::OnChange(int prop)
{
	proto->OnContactChanged(this->ref(), prop);
}