Esempio n. 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;
}
Esempio n. 2
0
//TODO: VOXOX CHANGE by Rolando 04-29-09, fix this method to be able to get all phonenumbers of contacts when SQLite is integrated
void QtConferenceCallWidget::populateVoxOxContactsMap()
{
	//VOXOX - JRT - 2009.07.27 - TODO: this _voxOxContactsMap seems like overkill and includes ALL contacts.
	CUserProfile * currentCUserProfile = _cWengoPhone.getCUserProfileHandler().getCUserProfile();

	if (currentCUserProfile) 
	{
		CContactList& currentCContactList = currentCUserProfile->getCContactList();
		StringList    currentContactsIds  = currentCContactList.getContactIds();

		for (StringList::const_iterator it = currentContactsIds.begin(); it != currentContactsIds.end(); ++it) 
		{
			ContactProfile	tmpContactProfile = currentCContactList.getContactProfile(*it);
			QString			displayName		  = QString::fromUtf8(tmpContactProfile.getDisplayName().c_str());			
			std::string		freePhoneNumber   = tmpContactProfile.getVoxOxPhone();
			std::string		displayNameStr	  = displayName.toStdString();

			_voxOxContactsMap[displayNameStr] = freePhoneNumber;
		}
	}
}
Esempio n. 3
0
bool ParticipantList::includeInCandidateList( const ContactProfile& contactProfile, const IMChatSession& chatSession, bool& bInChatSession )
{
	bool			  bInclude  = true;
	const IMContact*  imContact = NULL;

	bInChatSession = false;

	if ( _includeOnlyOnline )
	{
		imContact = contactProfile.getFirstAvailableIMContact( const_cast<IMChatSession&>(chatSession) );	//This seems wrong.
	}
	else
	{
		imContact = contactProfile.getPreferredIMContact();
	}

	if ( imContact )
	{
		IMContact* imContact2 = chatSession.getIMContactSet().findByContact( *imContact );	//Don't add IMContacts already in chatsession.

		//Jabber IMContacts for Group Chats are not built correctly (missing domain), so try a second find.
		if ( imContact2 == NULL )
		{
			std::string accountId = imContact->getIMAccountId();
			std::string contactId = imContact->getContactId();
			imContact2 = chatSession.getIMContactSet().findBy( accountId, contactId, true );
		}

		bInChatSession = (imContact2 != NULL);

		if ( _sameNetworkOnly )
		{
			bInclude = (imContact->getProtocol() == chatSession.getIMContactSet().begin()->getProtocol() );	//OK use of getProtocol().
		}
	}

	return bInclude;
}
Esempio n. 4
0
void CUserProfile::updateContactThreadSafe(const ContactProfile contactProfile) 
{
	//We need to get the ServerProtocolId or UserNetworkId for the IMAccount.
	IMContact* imContact = contactProfile.getPreferredIMContact();

	if ( imContact )
	{
		IMAccount* imAccount = getUserProfile().getIMAccountManager().getIMAccount( imContact->getIMAccount()->getKey() );

		if ( imAccount )
		{
			imContact->setServerProtocolId( imAccount->getServerProtocolId() );
			imContact->setUserNetworkId   ( imAccount->getUserNetworkId()    );	//VOXOX - JRT - 2009.06.09 

			getCContactList().updateContact(contactProfile);		//This does the update.
		}
	}
}