示例#1
0
//[{"username":"******", "firstname" : "Echo \/ Sound Test Service", "lastname" : null, "avatarUrl" : null, "mood" : null, "richMood" : null, "displayname" : null, "country" : null, "city" : null},...]
void CSkypeProto::LoadContactsInfo(const NETLIBHTTPREQUEST *response)
{
	if (response == NULL)
		return;

	JSONNode root = JSONNode::parse(response->pData);
	if (!root)
		return;

	const JSONNode &items = root.as_array();
	for (size_t i = 0; i < items.size(); i++)
	{
		const JSONNode &item = items.at(i);
		if (!item)
			break;

		std::string skypename = item["username"].as_string();
		MCONTACT hContact = AddContact(skypename.c_str());
		if (hContact)
		{
			UpdateProfileCountry(item, hContact);
			UpdateProfileCity(item, hContact);
			UpdateProfileStatusMessage(item, hContact);
		}
	}
}
示例#2
0
//{"firstname":"Echo \/ Sound Test Service", "lastname" : null, "birthday" : null, "gender" : null, "country" : null, "city" : null, "language" : null, "homepage" : null, "about" : null, "province" : null, "jobtitle" : null, "emails" : [], "phoneMobile" : null, "phoneHome" : null, "phoneOffice" : null, "mood" : null, "richMood" : null, "avatarUrl" : null, "username" : "echo123"}
void CSkypeProto::LoadProfile(const NETLIBHTTPREQUEST *response)
{
	if (response == NULL)
		return;

	JSONNode root = JSONNode::parse(response->pData);
	if (!root)
		return;

	std::string username = root["username"].as_string();
	MCONTACT hContact = NULL;
	if (!IsMe(username.c_str()))
		hContact = FindContact(username.c_str());

	UpdateProfileFirstName(root, hContact);
	UpdateProfileLastName(root, hContact);
	UpdateProfileDisplayName(root, hContact);
	UpdateProfileGender(root, hContact);
	UpdateProfileBirthday(root, hContact);
	UpdateProfileCountry(root, hContact);
	UpdateProfileState(root, hContact);
	UpdateProfileCity(root, hContact);
	UpdateProfileLanguage(root, hContact);
	UpdateProfileHomepage(root, hContact);
	UpdateProfileAbout(root, hContact);
	//jobtitle
	UpdateProfileEmails(root, hContact);
	UpdateProfilePhoneMobile(root, hContact);
	UpdateProfilePhoneHome(root, hContact);
	UpdateProfilePhoneOffice(root, hContact);
	UpdateProfileStatusMessage(root, hContact);
	//richMood
	UpdateProfileAvatar(root, hContact);
}