예제 #1
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.
		}
	}
}
예제 #2
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;
}