Example #1
0
void ConnectHandler::connect(const std::string & imAccountId) {
	RecursiveMutex::ScopedLock lock(_mutex);

	Connect * connect = NULL;
	IMAccount * imAccount = _userProfile->getIMAccountManager().getIMAccount(imAccountId);

	if (imAccount) {
		ConnectMap::iterator it = _connectMap.find(imAccountId);
		if (it == _connectMap.end()) {
			connect = new Connect(*imAccount, *_userProfile);

			connect->connectedEvent			 += boost::bind(&ConnectHandler::connectedEventHandler,			 this, _1);
			connect->disconnectedEvent		 += boost::bind(&ConnectHandler::disconnectedEventHandler,		 this, _1, _2, _3, _4);	//VOXOX - JRT - 2009.07.13 
			connect->connectionProgressEvent +=	boost::bind(&ConnectHandler::connectionProgressEventHandler, this, _1, _2, _3, _4);

			_connectMap.insert(std::pair<std::string, Connect*>(imAccountId, connect));
		} else {
			connect = (*it).second;
		}
		
		if (!(imAccount->isConnected())) {
			connect->connect();
		}		
		
		OWSAFE_DELETE(imAccount);
	} else {
		LOG_ERROR("IMAccount " + imAccountId + " not found!");
	}
}
Example #2
0
void ConnectHandler::connectionIsDownEventHandlerThreadSafe() {
	RecursiveMutex::ScopedLock lock(_mutex);

	for (ConnectMap::const_iterator it = _connectMap.begin();
		it != _connectMap.end();
		++it) {

		IMAccount * imAccount = _userProfile->getIMAccountManager().getIMAccount((*it).first);
		if (imAccount) {
			if (imAccount->isConnected()) {
				(*it).second->disconnect(true);
			}
			OWSAFE_DELETE(imAccount);
		} else {
			LOG_ERROR("IMAccount " + (*it).first + " not found!");
		}
	}
}
Example #3
0
void ConnectHandler::connectionIsUpEventHandlerThreadSafe() {
	RecursiveMutex::ScopedLock lock(_mutex);

	for (ConnectMap::const_iterator it = _connectMap.begin();
		it != _connectMap.end();
		++it) {

		IMAccount * imAccount = _userProfile->getIMAccountManager().getIMAccount((*it).first);
		if (imAccount) {
			if (!imAccount->isConnected()) {
				(*it).second->connect();
			}
			OWSAFE_DELETE(imAccount);
		} else {
			LOG_ERROR("IMAccount " + (*it).first + " not found!");
		}
	}
	//VOXOX CHANGE CJC CONNECT IM ACCOUNTS< AFTER CONNECTIONS IS RESTORED< THIS IS NOT HAPPENING
	_userProfile->connect();
}