diff options
author | George Hazan <ghazan@miranda.im> | 2021-03-16 20:19:11 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2021-03-16 20:19:11 +0300 |
commit | d0feef929e7a4432db63af44a9f99409ebbe4a10 (patch) | |
tree | 23c3ad3bd9cbe10ae425fe92c967d69d6721eaf2 | |
parent | c8ba5274c2bcc0bef3333e8957d2c80fdb158f4f (diff) |
Skype: fix for creating duplicate contacts running newly created account for the first time
-rw-r--r-- | protocols/SkypeWeb/src/skype_contacts.cpp | 84 |
1 files changed, 42 insertions, 42 deletions
diff --git a/protocols/SkypeWeb/src/skype_contacts.cpp b/protocols/SkypeWeb/src/skype_contacts.cpp index 89a62fad67..4adb73e341 100644 --- a/protocols/SkypeWeb/src/skype_contacts.cpp +++ b/protocols/SkypeWeb/src/skype_contacts.cpp @@ -154,61 +154,61 @@ void CSkypeProto::LoadContactList(NETLIBHTTPREQUEST *response, AsyncHttpRequest* for (auto &item : root["contacts"]) {
const JSONNode &name = item["name"];
- std::string skypeId = item["id"].as_string();
+ std::string skypeId = item["person_id"].as_string();
CMStringW first_name = name["first"].as_mstring();
CMStringW last_name = name["surname"].as_mstring();
CMStringW avatar_url = item["avatar_url"].as_mstring();
std::string type = item["type"].as_string();
if (type == "skype" || loadAll) {
- std::string displayName = item["displayname"].as_string();
- const char *szNick = (displayName.empty()) ? nullptr : displayName.c_str();
-
- MCONTACT hContact = AddContact(skypeId.c_str(), szNick);
- if (hContact) {
- if (item["authorized"].as_bool()) {
- delSetting(hContact, "Auth");
- delSetting(hContact, "Grant");
- }
- else setByte(hContact, "Grant", 1);
-
- if (item["blocked"].as_bool())
- setByte(hContact, "IsBlocked", 1);
- else
- delSetting(hContact, "IsBlocked");
-
- ptrW wszGroup(Clist_GetGroup(hContact));
- if (wszGroup == nullptr) {
- if (wstrCListGroup) {
- Clist_GroupCreate(0, wstrCListGroup);
- Clist_SetGroup(hContact, wstrCListGroup);
- }
+ MCONTACT hContact = AddContact(skypeId.c_str(), nullptr);
+
+ std::string displayName = item["display_name"].as_string();
+ if (!displayName.empty())
+ setUString(hContact, "Nick", displayName.c_str());
+
+ if (item["authorized"].as_bool()) {
+ delSetting(hContact, "Auth");
+ delSetting(hContact, "Grant");
+ }
+ else setByte(hContact, "Grant", 1);
+
+ if (item["blocked"].as_bool())
+ setByte(hContact, "IsBlocked", 1);
+ else
+ delSetting(hContact, "IsBlocked");
+
+ ptrW wszGroup(Clist_GetGroup(hContact));
+ if (wszGroup == nullptr) {
+ if (wstrCListGroup) {
+ Clist_GroupCreate(0, wstrCListGroup);
+ Clist_SetGroup(hContact, wstrCListGroup);
}
+ }
- setString(hContact, "Type", type.c_str());
+ setString(hContact, "Type", type.c_str());
- if (first_name)
- setWString(hContact, "FirstName", first_name);
- if (last_name)
- setWString(hContact, "LastName", last_name);
+ if (first_name)
+ setWString(hContact, "FirstName", first_name);
+ if (last_name)
+ setWString(hContact, "LastName", last_name);
- if (item["mood"])
- db_set_ws(hContact, "CList", "StatusMsg", RemoveHtml(item["mood"].as_mstring()));
+ if (item["mood"])
+ db_set_ws(hContact, "CList", "StatusMsg", RemoveHtml(item["mood"].as_mstring()));
- SetAvatarUrl(hContact, avatar_url);
- ReloadAvatarInfo(hContact);
+ SetAvatarUrl(hContact, avatar_url);
+ ReloadAvatarInfo(hContact);
- for (auto &phone : item["phones"]) {
- CMStringW number = phone["number"].as_mstring();
+ for (auto &phone : item["phones"]) {
+ CMStringW number = phone["number"].as_mstring();
- switch (phone["type"].as_int()) {
- case 0:
- setWString(hContact, "Phone", number);
- break;
- case 2:
- setWString(hContact, "Cellular", number);
- break;
- }
+ switch (phone["type"].as_int()) {
+ case 0:
+ setWString(hContact, "Phone", number);
+ break;
+ case 2:
+ setWString(hContact, "Cellular", number);
+ break;
}
}
}
|