Example #1
0
void ConnectHandler::connectedEventHandlerThreadSafe(std::string imAccountId, EnumPresenceState::PresenceState initialPresenceState ) 
{
	if (_userProfile && !_freeze) 
	{
		IMAccount * imAccount = _userProfile->getIMAccountManager().getIMAccount(imAccountId);
		if (imAccount) 
		{
			imAccount->setConnected(true);
			imAccount->setPresenceState( initialPresenceState );	//VOXOX - JRT - 2009.09.10 

			//VOXOX - JRT - 2009.09.14 - We now set the initialPresence before we try to connect.
			////TODO: VOXOX CHANGE by Rolando - 2009.05.22 - FIX this: check if each network associated supports invisible presence
			//if(_userProfile->mustLoginInvisible() && imAccount->getProtocol() != EnumIMProtocol::IMProtocolWengo && imAccount->getProtocol() != EnumIMProtocol::IMProtocolSIP)
			//{
			//	//VOXOX CHANGE by Rolando - 2009.05.22 - because user can login as invisible presence we have to change here the presence to be able to do change it
			//	//TODO: Find a way to be able to change the presence to invisible before set connected the imaccount to "true"
			//	//this is provocating that others users can realize that user logged in and later "logged off" 
			//	imAccount->setPresenceState(EnumPresenceState::PresenceStateInvisible);
			//	_userProfile->setPresenceState(EnumPresenceState::PresenceStateInvisible, imAccountId);//VOXOX CHANGE by Rolando - 2009.05.15 
			//}

			EnumPresenceState::PresenceState presenceState = imAccount->getPresenceState();//VOXOX CHANGE by Rolando - 2009.07.15 
			EnumIMProtocol::IMProtocol imProtocol = imAccount->getProtocol();//VOXOX CHANGE by Rolando - 2009.07.15 

			_userProfile->updateIMAccount(*imAccount);
			_userProfile->requestSyncData(*imAccount);	//VOXOX - JRT - 2009.08.03 
			OWSAFE_DELETE(imAccount);			
			connectedEvent(*this, imAccountId);//VOXOX CHANGE by Rolando - 2009.05.15 

			//VOXOX CHANGE by Rolando - 2009.07.15 
			if( QtEnumIMProtocolMap::supportsPresence( imProtocol ) )	//VOXOX - JRT - 2009.08.28 - moved logic to QtEnumIMProtocol 
			{
				_userProfile->setPresenceState(presenceState, imAccountId, false, String::null );//VOXOX CHANGE by Rolando - 2009.07.15 //VOXOX - JRT - 2009.09.14 
			}
		}
	}
}