From f63eb2bfc28dff8bbf9d56dd57b2bc6b53487f56 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 29 May 2017 23:45:19 +0300 Subject: Skype: - fixes #829; - massive code cleaning --- protocols/SkypeWeb/src/skype_profile.cpp | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) (limited to 'protocols/SkypeWeb/src/skype_profile.cpp') diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp index 6b4e4892e9..b2dc58160d 100644 --- a/protocols/SkypeWeb/src/skype_profile.cpp +++ b/protocols/SkypeWeb/src/skype_profile.cpp @@ -274,7 +274,7 @@ void CSkypeProto::UpdateProfileDisplayName(const JSONNode &root, MCONTACT hConta else if (lastname) setWString(hContact, "Nick", lastname); else { - + const JSONNode &node = root["displayname"]; CMStringW displayname((!node) ? root["username"].as_mstring() : node.as_mstring()); if (!displayname.IsEmpty() && displayname != "null") @@ -296,16 +296,14 @@ void CSkypeProto::UpdateProfileGender(const JSONNode &root, MCONTACT hContact) void CSkypeProto::UpdateProfileBirthday(const JSONNode &root, MCONTACT hContact) { CMStringW birthday = root["birthday"].as_mstring(); - if (!birthday.IsEmpty() && birthday != "null") - { + if (!birthday.IsEmpty() && birthday != "null") { int d, m, y; swscanf(birthday.GetBuffer(), L"%d-%d-%d", &y, &m, &d); setWord(hContact, "BirthYear", y); setByte(hContact, "BirthDay", d); setByte(hContact, "BirthMonth", m); } - else - { + else { delSetting(hContact, "BirthYear"); delSetting(hContact, "BirthDay"); delSetting(hContact, "BirthMonth"); @@ -315,8 +313,7 @@ void CSkypeProto::UpdateProfileBirthday(const JSONNode &root, MCONTACT hContact) void CSkypeProto::UpdateProfileCountry(const JSONNode &root, MCONTACT hContact) { std::string isocode = root["country"].as_string(); - if (!isocode.empty() && isocode != "null") - { + if (!isocode.empty() && isocode != "null") { char *country = (char *)CallService(MS_UTILS_GETCOUNTRYBYISOCODE, (WPARAM)isocode.c_str(), 0); setString(hContact, "Country", country); } @@ -371,11 +368,9 @@ void CSkypeProto::UpdateProfileAbout(const JSONNode &root, MCONTACT hContact) void CSkypeProto::UpdateProfileEmails(const JSONNode &root, MCONTACT hContact) { const JSONNode &node = root["emails"]; - if (node) - { + if (node) { const JSONNode &items = node.as_array(); - for (size_t i = 0; i < min(items.size(), 3); i++) - { + for (size_t i = 0; i < min(items.size(), 3); i++) { const JSONNode &item = items.at(i); if (!item) break; @@ -384,8 +379,7 @@ void CSkypeProto::UpdateProfileEmails(const JSONNode &root, MCONTACT hContact) setWString(hContact, name, item.as_mstring()); } } - else - { + else { delSetting(hContact, "e-mail0"); delSetting(hContact, "e-mail1"); delSetting(hContact, "e-mail2"); @@ -431,8 +425,7 @@ void CSkypeProto::UpdateProfileXStatusMessage(const JSONNode &root, MCONTACT hCo void CSkypeProto::UpdateProfileAvatar(const JSONNode &root, MCONTACT hContact) { CMStringW province = root["avatarUrl"].as_mstring(); - if (!province.IsEmpty() && province != "null") - { + if (!province.IsEmpty() && province != "null") { SetAvatarUrl(hContact, province); ReloadAvatarInfo(hContact); } @@ -460,8 +453,10 @@ void CSkypeProto::LoadProfile(const NETLIBHTTPREQUEST *response, void *arg) return; } - if (username != li.szSkypename.get()) - li.szSkypename = mir_strdup(username.c_str()); + if (li.szSkypename != username.c_str()) + li.szMyname = username.c_str(); + else + li.szMyname = li.szSkypename; UpdateProfileFirstName(root, hContact); UpdateProfileLastName(root, hContact); -- cgit v1.2.3