diff options
author | George Hazan <george.hazan@gmail.com> | 2024-08-08 13:11:59 +0300 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2024-08-08 13:11:59 +0300 |
commit | e6b307560c6d58d8c1e7b960c2d41d759947b2e2 (patch) | |
tree | 86b2138d680fce13f1587c5c93af54140d85a695 /protocols/SkypeWeb/src | |
parent | 63026a4ad1411dc49590f7f3f2c2a459cae82f63 (diff) |
SkypeWeb: fix for contact's info format v.2
Diffstat (limited to 'protocols/SkypeWeb/src')
-rw-r--r-- | protocols/SkypeWeb/src/skype_contacts.cpp | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index 3797ff66fd..733bbc631a 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -146,8 +146,6 @@ void CSkypeProto::LoadContactList(MHttpResponse *response, AsyncHttpRequest*) auto &root = reply.data();
for (auto &item : root["contacts"]) {
- const JSONNode &name = item["name"];
-
CMStringA szSkypeId = item["person_id"].as_mstring();
if (!IsPossibleUserType(szSkypeId))
continue;
@@ -170,33 +168,48 @@ void CSkypeProto::LoadContactList(MHttpResponse *response, AsyncHttpRequest*) delSetting(hContact, "IsBlocked");
ptrW wszGroup(Clist_GetGroup(hContact));
- if (wszGroup == nullptr) {
- if (wstrCListGroup) {
- Clist_GroupCreate(0, wstrCListGroup);
- Clist_SetGroup(hContact, wstrCListGroup);
+ if (wszGroup == nullptr && wstrCListGroup) {
+ Clist_GroupCreate(0, wstrCListGroup);
+ Clist_SetGroup(hContact, wstrCListGroup);
+ }
+
+ auto &profile = item["profile"];
+ SetString(hContact, "Homepage", profile["website"]);
+
+ auto wstr = profile["birthday"].as_mstring();
+ if (!wstr.IsEmpty() ) {
+ int nYear, nMonth, nDay;
+ if (swscanf(wstr, L"%d-%d-%d", &nYear, &nMonth, &nDay) == 3) {
+ setWord(hContact, "BirthYear", nYear);
+ setByte(hContact, "BirthMonth", nMonth);
+ setByte(hContact, "BirthDay", nDay);
}
}
+ wstr = profile["gender"].as_mstring();
+ if (wstr == "male")
+ setByte(hContact, "Gender", 'M');
+ else if (wstr == "female")
+ setByte(hContact, "Gender", 'F');
+
+ auto &name = profile["name"];
SetString(hContact, "FirstName", name["first"]);
SetString(hContact, "LastName", name["surname"]);
- if (item["mood"])
+ if (profile["mood"])
db_set_ws(hContact, "CList", "StatusMsg", RemoveHtml(item["mood"].as_mstring()));
- SetAvatarUrl(hContact, item["avatar_url"].as_mstring());
+ SetAvatarUrl(hContact, profile["avatar_url"].as_mstring());
ReloadAvatarInfo(hContact);
- for (auto &phone : item["phones"]) {
+ for (auto &phone : profile["phones"]) {
CMStringW number = phone["number"].as_mstring();
- switch (phone["type"].as_int()) {
- case 0:
- setWString(hContact, "Phone", number);
- break;
- case 2:
+ auto wszType = phone["type"].as_mstring();
+ if (wszType == L"mobile")
setWString(hContact, "Cellular", number);
- break;
- }
+ else if (wszType == L"phone")
+ setWString(hContact, "Phone", number);
}
}
|