diff options
author | Alexander Lantsev <aunsane@gmail.com> | 2015-03-19 20:25:50 +0000 |
---|---|---|
committer | Alexander Lantsev <aunsane@gmail.com> | 2015-03-19 20:25:50 +0000 |
commit | 14834460074eebcee4a83917fbb806a95446aec3 (patch) | |
tree | 43a7d3f920458a1eecffc95af615b536e1106f7d /protocols/SkypeWeb | |
parent | c659a92109a8c2a4d7c0cf142eab84fd636a62dc (diff) |
SkypeWeb: changed contacts info getting
git-svn-id: http://svn.miranda-ng.org/main/trunk@12436 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb')
-rw-r--r-- | protocols/SkypeWeb/src/requests/contacts.h | 2 | ||||
-rw-r--r-- | protocols/SkypeWeb/src/skype_contacts.cpp | 68 |
2 files changed, 32 insertions, 38 deletions
diff --git a/protocols/SkypeWeb/src/requests/contacts.h b/protocols/SkypeWeb/src/requests/contacts.h index 3ba86d9b2e..5144de597a 100644 --- a/protocols/SkypeWeb/src/requests/contacts.h +++ b/protocols/SkypeWeb/src/requests/contacts.h @@ -5,7 +5,7 @@ class GetContactsRequest : public HttpRequest {
public:
GetContactsRequest(const char *token) :
- HttpRequest(REQUEST_GET, "api.skype.com/users/self/contacts")
+ HttpRequest(REQUEST_GET, "api.skype.com/users/self/contacts?hideDetails=true")
{
flags |= NLHRF_SSL;
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index 5aebc68c75..f403c462e5 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -105,6 +105,35 @@ void CSkypeProto::LoadProfiles(const NETLIBHTTPREQUEST *response) MCONTACT hContact = AddContact(skypename);
if (hContact)
{
+ node = json_get(item, "fullname");
+ CMString realname = ptrT(json_as_string(node)); + if (!realname.IsEmpty() && realname != "null") + { + size_t pos = realname.Find(' ', 1); + if (mir_strcmpi(skypename, "echo123") != 0 && pos != -1) + { + setTString(hContact, "FirstName", realname.Mid(0, pos)); + setTString(hContact, "LastName", realname.Mid(pos + 1)); + } + else + { + setTString(hContact, "FirstName", realname); + delSetting(hContact, "LastName"); + } + }
+ else
+ {
+ delSetting(hContact, "FirstName");
+ delSetting(hContact, "LastName");
+ }
+
+ node = json_get(item, "display_name");
+ CMString nick = ptrT(json_as_string(node));
+ if (!nick.IsEmpty() && nick != "null")
+ setTString(hContact, "Nick", nick);
+ else
+ delSetting(hContact, "Nick");
+
node = json_get(item, "avatarUrl");
CMStringA avatarUrl = mir_t2a(ptrT(json_as_string(node)));
if (avatarUrl && avatarUrl != "null")
@@ -135,7 +164,8 @@ void CSkypeProto::LoadProfiles(const NETLIBHTTPREQUEST *response) json_delete(items);
}
-//[{"skypename":"echo123", "fullname" : "Echo \/ Sound Test Service", "authorized" : true, "blocked" : false, "display_name" : null, "pstn_number" : null, "phone1" : null, "phone1_label" : null, "phone2" : null, "phone2_label" : null, "phone3" : null, "phone3_label" : null},...]
+//[{"skypename":"echo123", "authorized" : true, "blocked" : false, ...},...]
+// other properties is exists but empty
void CSkypeProto::LoadContacts(const NETLIBHTTPREQUEST *response)
{
if (response == NULL)
@@ -159,42 +189,6 @@ void CSkypeProto::LoadContacts(const NETLIBHTTPREQUEST *response) MCONTACT hContact = AddContact(skypename);
if (hContact)
{
- node = json_get(item, "fullname");
- CMString realname = ptrT(json_as_string(node)); - if (!realname.IsEmpty() && realname != "null") - { - size_t pos = realname.Find(' ', 1); - if (mir_strcmpi(skypename, "echo123") != 0 && pos != -1) - { - setTString(hContact, "FirstName", realname.Mid(0, pos)); - setTString(hContact, "LastName", realname.Mid(pos + 1)); - } - else - { - setTString(hContact, "FirstName", realname); - delSetting(hContact, "LastName"); - } - }
- else
- {
- delSetting(hContact, "FirstName");
- delSetting(hContact, "LastName");
- }
-
- node = json_get(item, "display_name");
- CMString nick = ptrT(json_as_string(node));
- if (!nick.IsEmpty() && nick != "null")
- setTString(hContact, "Nick", nick);
- else
- delSetting(hContact, "Nick");
-
- node = json_get(item, "pstn_number");
- CMString ptsnNumber = ptrT(json_as_string(node));
- if (!ptsnNumber.IsEmpty() && ptsnNumber != "null")
- setString(hContact, "PtsnNumber", ptrA(mir_u2a(ptsnNumber)));
- else
- delSetting(hContact, "PtsnNumber");
-
node = json_get(item, "authorized");
if (json_as_bool(node))
{
|