From 9306d732027781d6e6cbcc02f6fc5e1765a88bf7 Mon Sep 17 00:00:00 2001 From: Kirill Volinsky Date: Sun, 21 Oct 2012 10:31:17 +0000 Subject: added first and last names git-svn-id: http://svn.miranda-ng.org/main/trunk@2012 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Skype/src/skype_contacts.cpp | 28 ++++++++++++++++++++++++++++ protocols/Skype/src/skype_proto.h | 1 + 2 files changed, 29 insertions(+) (limited to 'protocols/Skype') diff --git a/protocols/Skype/src/skype_contacts.cpp b/protocols/Skype/src/skype_contacts.cpp index 43560ca93d..2353bbd004 100644 --- a/protocols/Skype/src/skype_contacts.cpp +++ b/protocols/Skype/src/skype_contacts.cpp @@ -261,6 +261,30 @@ void CSkypeProto::UpdateContactTimezone(HANDLE hContact, CContact::Ref contact) this->DeleteSetting(hContact, "TimeZone"); } +void CSkypeProto::UpdateFullName(HANDLE hContact, CContact::Ref contact) +{ + SEString data; + contact->GetPropFullname(data); + wchar_t* fullname = ::mir_utf8decodeW((const char*)data); + if (wcscmp(fullname, L"") == 0) + { + this->DeleteSetting(hContact, "FirstName"); + this->DeleteSetting(hContact, "LastName"); + } + else + { + wchar_t* last = _tcstok(fullname, L" "); + wchar_t* first = _tcstok(NULL, L" "); + if (first == NULL) + { + first = L""; + } + this->SetSettingString(hContact, "LastName", last); + this->SetSettingString(hContact, "FirstName", first); + } + ::mir_free(fullname); +} + void CSkypeProto::UpdateContactProfile(HANDLE hContact, CContact::Ref contact) { uint newTS = 0; @@ -281,6 +305,7 @@ void CSkypeProto::UpdateContactProfile(HANDLE hContact, CContact::Ref contact) this->UpdateContactOfficePhone(hContact, contact); this->UpdateContactState(hContact, contact); this->UpdateContactTimezone(hContact, contact); + this->UpdateFullName(hContact, contact); this->SetSettingDword(hContact, "ProfileTS", newTS); } @@ -383,6 +408,9 @@ void CSkypeProto::OnContactChanged(CContact::Ref contact, int prop) case CContact::P_TIMEZONE: this->UpdateContactTimezone(hContact, contact); break; + case CContact::P_FULLNAME: + this->UpdateFullName(hContact, contact); + break; } } else diff --git a/protocols/Skype/src/skype_proto.h b/protocols/Skype/src/skype_proto.h index 295f1fcbf7..9edd4283c6 100644 --- a/protocols/Skype/src/skype_proto.h +++ b/protocols/Skype/src/skype_proto.h @@ -142,6 +142,7 @@ protected: void UpdateContactStatusMessage(HANDLE hContact, CContact::Ref contact); void UpdateContactTimezone(HANDLE hContact, CContact::Ref contact); void UpdateContactProfile(HANDLE hContact, CContact::Ref contact); + void UpdateFullName(HANDLE hContact, CContact::Ref contact); void OnSearchCompleted(HANDLE hSearch); void OnContactFinded(HANDLE hSearch, CContact::Ref contact); -- cgit v1.2.3