Example #1
0
bool CUserProfile::updateContactProfileFromJSON( const std::string& data, int& jsId, int& qtId )
{
	bool result = false;
	ContactProfile profile;

	ContactProfileJSONSerializer serializer( getUserProfile().getContactList(), profile );
	
	if ( serializer.unserialize( data ) )
	{
		if ( profile.getId() <= 0 )	//This is an add.
		{
			jsId = profile.getId();

			getCContactList().addContact(profile);
		}
		else
		{
			Contact* contact = getUserProfile().getContactList().getContactByJSONId( profile.getId() );

			if ( contact )
			{
//				getCContactList().updateContactGroups( *contact, contact->getContactGroupInfoSet(), profile.getContactGroupInfoSet() );	//VOXOX - JRT - 2009.09.23 

				profile.getIMContactSetNonConst() = contact->getIMContactSetNonConst();
			}

			getCContactList().updateContact( profile );
		}

		result = true;
	}

	return result;
}