diff options
author | Kirill Volinsky <mataes2007@gmail.com> | 2015-03-20 06:25:16 +0000 |
---|---|---|
committer | Kirill Volinsky <mataes2007@gmail.com> | 2015-03-20 06:25:16 +0000 |
commit | 81f46061857cad78faa649a0f1a8916008ab0017 (patch) | |
tree | ccbba92f0a3fa22db094b2bb1fb1f4ea7db01381 /protocols/SkypeWeb/src/skype_profile.cpp | |
parent | 6f81c5ba5c6999abd6a568028e1a4d6578794122 (diff) |
fixed gender and birthday info
git-svn-id: http://svn.miranda-ng.org/main/trunk@12441 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/SkypeWeb/src/skype_profile.cpp')
-rw-r--r-- | protocols/SkypeWeb/src/skype_profile.cpp | 68 |
1 files changed, 40 insertions, 28 deletions
diff --git a/protocols/SkypeWeb/src/skype_profile.cpp b/protocols/SkypeWeb/src/skype_profile.cpp index 85c72423f5..9d1bd3ea10 100644 --- a/protocols/SkypeWeb/src/skype_profile.cpp +++ b/protocols/SkypeWeb/src/skype_profile.cpp @@ -3,39 +3,39 @@ void CSkypeProto::UpdateProfileFirstName(JSONNODE *root, MCONTACT hContact)
{
JSONNODE *node = json_get(root, "firstname");
- CMString firstname = ptrT(json_as_string(node)); - if (!firstname.IsEmpty() && firstname != "null") - setTString(hContact, "FirstName", firstname); - else + CMString firstname = ptrT(json_as_string(node));
+ if (!firstname.IsEmpty() && firstname != "null")
+ setTString(hContact, "FirstName", firstname);
+ else
delSetting(hContact, "FirstName");
}
void CSkypeProto::UpdateProfileLastName(JSONNODE *root, MCONTACT hContact)
{
JSONNODE *node = json_get(root, "lastname");
- CMString lastname = ptrT(json_as_string(node)); - if (!lastname.IsEmpty() && lastname != "null") - setTString(hContact, "LastName", lastname); - else + CMString lastname = ptrT(json_as_string(node));
+ if (!lastname.IsEmpty() && lastname != "null")
+ setTString(hContact, "LastName", lastname);
+ else
delSetting(hContact, "LastName");
}
void CSkypeProto::UpdateProfileDisplayName(JSONNODE *root, MCONTACT hContact)
{
JSONNODE *node = json_get(root, "displayname");
- CMString displayname = ptrT(json_as_string(node)); - if (!displayname.IsEmpty() && displayname != "null") - setTString(hContact, "Nick", displayname); - else + CMString displayname = ptrT(json_as_string(node));
+ if (!displayname.IsEmpty() && displayname != "null")
+ setTString(hContact, "Nick", displayname);
+ else
delSetting(hContact, "Nick");
}
void CSkypeProto::UpdateProfileGender(JSONNODE *root, MCONTACT hContact)
{
JSONNODE *node = json_get(root, "gender");
- int value = json_as_int(node);
- if (value)
- setByte(hContact, "Gender", (BYTE)(value == 1 ? 'M' : 'F'));
+ CMString gender = ptrT(json_as_string(node));
+ if (!gender.IsEmpty() && gender != "null")
+ setByte(hContact, "Gender", (BYTE)(_ttoi(gender) == 1 ? 'M' : 'F'));
else
delSetting(hContact, "Gender");
}
@@ -43,7 +43,19 @@ void CSkypeProto::UpdateProfileGender(JSONNODE *root, MCONTACT hContact) void CSkypeProto::UpdateProfileBirthday(JSONNODE *root, MCONTACT hContact)
{
JSONNODE *node = json_get(root, "birthday");
- // parse "YYYY-MM-DD"
+ CMString birthday = ptrT(json_as_string(node));
+ if (!birthday.IsEmpty() && birthday != "null") {
+ int d, m, y;
+ _stscanf(birthday.GetBuffer(), _T("%d-%d-%d"), &y, &m, &d);
+ setWord(hContact, "BirthYear", y);
+ setByte(hContact, "BirthDay", d);
+ setByte(hContact, "BirthMonth", m);
+ }
+ else {
+ delSetting(hContact, "BirthYear");
+ delSetting(hContact, "BirthDay");
+ delSetting(hContact, "BirthMonth");
+ }
}
void CSkypeProto::UpdateProfileCountry(JSONNODE *root, MCONTACT hContact)
@@ -72,10 +84,10 @@ void CSkypeProto::UpdateProfileState(JSONNODE *root, MCONTACT hContact) void CSkypeProto::UpdateProfileCity(JSONNODE *root, MCONTACT hContact)
{
JSONNODE *node = json_get(root, "city");
- CMString city = ptrT(json_as_string(node)); - if (!city.IsEmpty() && city != "null") - setTString(hContact, "City", city); - else + CMString city = ptrT(json_as_string(node));
+ if (!city.IsEmpty() && city != "null")
+ setTString(hContact, "City", city);
+ else
delSetting(hContact, "City");
}
@@ -94,20 +106,20 @@ void CSkypeProto::UpdateProfileLanguage(JSONNODE *root, MCONTACT hContact) void CSkypeProto::UpdateProfileHomepage(JSONNODE *root, MCONTACT hContact)
{
JSONNODE *node = json_get(root, "homepage");
- CMString homepage = ptrT(json_as_string(node)); - if (!homepage.IsEmpty() && homepage != "null") - setTString(hContact, "Homepage", homepage); - else + CMString homepage = ptrT(json_as_string(node));
+ if (!homepage.IsEmpty() && homepage != "null")
+ setTString(hContact, "Homepage", homepage);
+ else
delSetting(hContact, "Homepage");
}
void CSkypeProto::UpdateProfileAbout(JSONNODE *root, MCONTACT hContact)
{
JSONNODE *node = json_get(root, "about");
- CMString about = ptrT(json_as_string(node)); - if (!about.IsEmpty() && about != "null") - setTString(hContact, "About", about); - else + CMString about = ptrT(json_as_string(node));
+ if (!about.IsEmpty() && about != "null")
+ setTString(hContact, "About", about);
+ else
delSetting(hContact, "About");
}
|