コード例 #1
0
//VOXOX CHANGE by Rolando - 2009.05.21 -commented line, we are now using a logo
//VOXOX CHANGE by Rolando 04-06-09
//void QtAddVoxOxAccount::updateAvatarLabel(std::string profileName){	
//		
//	UserProfile * userProfile = new UserProfile();
//
//	//gets userprofile
//	_cUserProfileHandler.getUserProfileHandler().LoadUserProfileFromName(userProfile, profileName);
//	std::string backgroundPixmapFilename = ":/pics/avatar_background.png";
//
//	if(userProfile){		
//		std::string foregroundPixmapData = userProfile->getIcon().getData();
//		_ui->avatarLabel->setPixmap(PixmapMerging::merge(foregroundPixmapData, backgroundPixmapFilename));//merge two images
//	}
//	else{
//		QPixmap backgroundPixmap;
//		backgroundPixmap.loadFromData((uchar *) backgroundPixmapFilename.c_str(), backgroundPixmapFilename.size());
//		_ui->avatarLabel->setPixmap(backgroundPixmap);
//	}
//	
//	
//		
//}
//VOXOX CHANGE by Rolando 04-06-09
void QtAddVoxOxAccount::itemActivatedComboBoxSlot(int index) {

	QString profileName = _ui->usernameComboBox->itemText(index);
	
	UserProfile userProfile;
	if (_cUserProfileHandler.getUserProfileHandler().LoadUserProfileFromName(&userProfile, _profileMap[profileName.toStdString()])) {
		SipAccount * sipAccount = userProfile.getSipAccount();
		if (sipAccount) {
			if (sipAccount->isPasswordRemembered()) {
				setPassword(sipAccount->getUserPassword());
				
				_ui->rememberPasswordCheckBox->setCheckState(Qt::Checked);
			} else {
				setPassword("");				
				_ui->rememberPasswordCheckBox->setCheckState(Qt::Unchecked);
			}

			_ui->publicComputerCheckBox->setChecked(!sipAccount->isUsernameRemembered());					

			_ui->automaticallyLoginCheckBox->setChecked(sipAccount->isAutoLoginVoxOx());			
		}
	}
	//VOXOX CHANGE by Rolando - 2009.05.21 -commented line, we are now using a logo
	//updateAvatarLabel(profileName.toStdString());
}
コード例 #2
0
void QtAddVoxOxAccount::load(const SipAccount & sipAccount) {
	if (sipAccount.getType() == SipAccount::SipAccountTypeWengo) {
		const WengoAccount & wengoAccount = dynamic_cast<const WengoAccount &>(sipAccount);
		//setAccountName(QString::fromStdString(wengoAccount.getWengoLogin()));
		//setPassword(wengoAccount.getWengoPassword());
		//VOXOX CHANGE by Rolando 04-06-09	
		if (sipAccount.isPasswordRemembered()) {
			setPassword(sipAccount.getUserPassword());
			_ui->rememberPasswordCheckBox->setCheckState(Qt::Checked);
		} else {
			setPassword("");
			_ui->rememberPasswordCheckBox->setCheckState(Qt::Unchecked);
		}

		if (!sipAccount.isUsernameRemembered()) {		
			setAccountName("");
			setPassword("");
			_ui->rememberPasswordCheckBox->setCheckState(Qt::Unchecked);
			//_ui->publicComputerCheckBox->setCheckState(Qt::Checked);
		} else {							
			_ui->publicComputerCheckBox->setCheckState(Qt::Unchecked);
			
		}

		_ui->automaticallyLoginCheckBox->setChecked(sipAccount.isAutoLoginVoxOx());

		

	} else {
		LOG_DEBUG("SIP getType() = SipAccount::SipAccountTypeBasic");
	}
}
コード例 #3
0
void UserProfileHandler::sipAccountConnectedEventHandlerThreadSafe() 
{
//	RecursiveMutex::ScopedLock lock(_mutex);	//VOXOX - JRT - 2009.09.22 - Prevent COE

	if(_currentUserProfile)
	{
		Config & config = ConfigManager::getInstance().getCurrentConfig();
		SipAccount * sipaccount = _currentUserProfile->getSipAccount()->clone();
		std::string loginName = sipaccount->getDisplayName();

		if( sipaccount->isAutoLoginVoxOx()){			
			if(loginName != ""){					
				config.set(Config::PROFILE_LAST_USED_NAME_KEY, loginName);							
			}
		}else{									
			std::string profileNameEmpty = "";			
			config.set(Config::PROFILE_LAST_USED_NAME_KEY, profileNameEmpty);	
		}

		if(sipaccount->isUsernameRemembered()){//if I want that VoxOx remembers that I logged in... then
			config.set(Config::PROFILE_LAST_LOGGED_ACCOUNT_KEY, loginName);
		}

		saveUserProfile(*_currentUserProfile);

		if (_currentUserProfile->hasWengoAccount()) {
			WsUrl::setWengoAccount(_currentUserProfile->getWengoAccount());
		}

//JRT-XXX		userProfileInitializedEvent(*this, *_currentUserProfile);

		//setLastUsedUserProfile(*_currentUserProfile);
	}
}
コード例 #4
0
ファイル: SipAccount.cpp プロジェクト: Buffi79/callblocker
void SipAccount::onIncomingCallCB(pjsua_acc_id acc_id, pjsua_call_id call_id, pjsip_rx_data *rdata) {
  SipAccount* p = (SipAccount*)pjsua_acc_get_user_data(acc_id);
  if (p == NULL) {
    Logger::warn("onIncomingCallCB(acc_id=%d, call_id=%d) failed", acc_id, call_id);
    return;
  }
  p->onIncomingCall(call_id, rdata);
}
コード例 #5
0
ファイル: SipAccount.cpp プロジェクト: Buffi79/callblocker
void SipAccount::onCallMediaStateCB(pjsua_call_id call_id) {
  SipAccount* p = (SipAccount*)pjsua_call_get_user_data(call_id);
  if (p == NULL) {
    Logger::warn("onCallMediaStateCB(%d) failed", call_id);
    return;
  }
  p->onCallMediaState(call_id);
}
コード例 #6
0
void QtAddIMContact::addIMContact() {
	QString contactId = _ui->contactIdLineEdit->text().trimmed();
	
	if (contactId.isEmpty()) {
		return;
	}
	
	QString protocolName = _ui->protocolComboBox->currentText();

	EnumIMProtocol::IMProtocol imProtocol = EnumIMProtocol::toIMProtocol(protocolName.toStdString());
	
	// sip contact should know their domain
	Config & config = ConfigManager::getInstance().getCurrentConfig();
	QString wengoSuffix = "@" + QString::fromStdString( config.getWengoRealm() );
	if (imProtocol == EnumIMProtocol::IMProtocolWengo) {
		contactId += wengoSuffix;
	} else if (imProtocol == EnumIMProtocol::IMProtocolSIP) {
		if (!contactId.contains("@")) {
			SipAccount * sipaccount = _cUserProfile.getUserProfile().getSipAccount();
			if (sipaccount) {
				contactId += QString("@") + QString::fromStdString(sipaccount->getRealm());
			}
		}
	}
	////
	
	IMContact imContact(imProtocol, contactId.toStdString());

	IMAccountList imAccounts = getSelectedIMAccounts(imProtocol);

	if (imAccounts.empty()) {
		_contactProfile.addIMContact(imContact);
	}

	for (IMAccountList::const_iterator it = imAccounts.begin();
		it != imAccounts.end(); ++it) {

		IMAccount * imAccount =
//			_cUserProfile.getUserProfile().getIMAccountManager().getIMAccount((*it).getUUID());	//VOXOX - JRT - 2009.04.09 
//			_cUserProfile.getUserProfile().getIMAccountManager().getIMAccount( it->second.getUUID());
			_cUserProfile.getUserProfile().getIMAccountManager().getIMAccount( it->second );	//VOXOX - JRT - 2009.04.24
		imContact.setIMAccount(imAccount);
		_contactProfile.addIMContact(imContact);
		OWSAFE_DELETE(imAccount);
	}
}
コード例 #7
0
void QtAddVoxOxAccount::load(std::string sipAccountName) {
	//load userprofile
	UserProfile * userProfile = _cUserProfileHandler.getUserProfileHandler().getUserProfile(sipAccountName);
	if (userProfile) {
		SipAccount * sipAccount = userProfile->getSipAccount();
		//VOXOX CHANGE by Rolando 04-06-09
		if (sipAccount) {
			
			if (sipAccount->isPasswordRemembered()) {
				setPassword(sipAccount->getUserPassword());
				_ui->rememberPasswordCheckBox->setCheckState(Qt::Checked);
			} else {
				setPassword("");
				_ui->rememberPasswordCheckBox->setCheckState(Qt::Unchecked);
			}

			if (!sipAccount->isUsernameRemembered()) {		
				setAccountName("");
				setPassword("");
				_ui->rememberPasswordCheckBox->setCheckState(Qt::Unchecked);
				/*_ui->publicComputerCheckBox->setCheckState(Qt::Checked);*/
			} else {
				// Add and select the given SipAccount
				//SERGIO MARIN IF EXISTS ACCOUNT IN COMBO BOX
				if (_ui->usernameComboBox->findText(QString::fromStdString(sipAccountName))== -1){
					_ui->usernameComboBox->addItem(QString::fromStdString(sipAccountName));
				}

				setAccountName(QString::fromStdString(sipAccountName));

				_ui->publicComputerCheckBox->setCheckState(Qt::Unchecked);
				
			}

			_ui->automaticallyLoginCheckBox->setChecked(sipAccount->isAutoLoginVoxOx());

		}
	}
	else {
		//VOXOX CHANGE by Rolando - 2009.05.21 -commented line, we are now using a logo
		//updateAvatarLabel("");
	}
}
コード例 #8
0
void QtAddWengoAccount::load(const SipAccount & sipAccount) {
	if (sipAccount.getType() == SipAccount::SipAccountTypeWengo) {
		const WengoAccount & wengoAccount = dynamic_cast<const WengoAccount &>(sipAccount);
		_ui->email->setText(QString::fromStdString(wengoAccount.getWengoLogin()));
		_ui->password->setText(QString::fromStdString(wengoAccount.getWengoPassword()));
		setInfoMessage();
	} else {
		LOG_DEBUG("SIP getType() = SipAccount::SipAccountTypeBasic");
		//_loginDialog->changePage(QtLoginDialog::AddSIPAccount, sipAccount);
	}
}
コード例 #9
0
bool SipAccount::operator == (const SipAccount & other) const 
{
	if (other.getType() != SipAccountTypeBasic) 
	{
		return false;
	}
	else
	{
		loginStateChangedEvent(*(SipAccount *)this, EnumSipLoginState::SipLoginStateNetworkError, "");//VOXOX CHANGE by Rolando - 2009.09.10 
	}

	return (	_identity				== other._identity &&
				_username				== other._username &&
				_realm					== other._realm &&
				_password				== other._password &&
				_imPassword				== other._imPassword &&		//VOXOX - JRT - 2009.09.25 
				_registerServerHostname == other._registerServerHostname &&
				_registerServerPort		== other._registerServerPort &&
				_sipProxyServerHostname == other._sipProxyServerHostname &&
				_sipProxyServerPort		== other._sipProxyServerPort );
}
コード例 #10
0
void QtAddVoxOxAccount::initPage() {

	_ui->usernameComboBox->clear();
	_ui->usernameComboBox->setFocus();
	_ui->loginButton->setDefault(true);

	std::vector<std::string> profileNames = _cUserProfileHandler.getUserProfileNames(true);
	//VOXOX CHANGE by Rolando 04-06-09
	if (profileNames.size() > 0) {

		// finds all userprofiles
		for (std::vector<std::string>::const_iterator it = profileNames.begin();
			it != profileNames.end();
			++it) {

			UserProfile userProfile;
			std::string tmpname;
			SipAccount * sipAccount = NULL;

			//gets userprofile
			if (_cUserProfileHandler.getUserProfileHandler().LoadUserProfileFromName(&userProfile, *it)) {
				
				//gets sipaccount
				sipAccount = userProfile.getSipAccount();
				if (sipAccount) {
					
					if(sipAccount->isUsernameRemembered()){
						//finds and displays visible name, saves real userprofile name
						tmpname = sipAccount->getVisibleName();
						_profileMap[tmpname] = (*it);
						if (_ui->usernameComboBox->findText(QString::fromStdString(tmpname))== -1){
							_ui->usernameComboBox->addItem(QString::fromStdString(tmpname));
						}											
					}									
				}
			}
		}
		////
		
		//default value
		if(_ui->usernameComboBox->count() > 0){
			_ui->usernameComboBox->setInsertPolicy(QComboBox::InsertAlphabetically);
			/*_ui->usernameComboBox->setCurrentIndex(0);
			currentIndexChanged(_ui->usernameComboBox->currentText());*/
			Config & config = ConfigManager::getInstance().getCurrentConfig();
			QString lastLoggedAccount = QString::fromStdString(config.getProfileLastLoggedAccount());
			//setAccountName(lastLoggedAccount);
			if(lastLoggedAccount != ""){
				load(lastLoggedAccount.toStdString());//VOXOX CHANGE by Rolando 04-06-09
			}
			else{//VOXOX CHANGE by Rolando 04-06-09
				load(_ui->usernameComboBox->currentText().toStdString());
			}
		}
		else{
			//VOXOX CHANGE by Rolando - 2009.05.21 -commented line, we are now using a logo
			//updateAvatarLabel("");
		}
		
	} 
	else {
		//VOXOX CHANGE by Rolando - 2009.05.21 -commented line, we are now using a logo
		//updateAvatarLabel("");
	}	

	_ui->usernameComboBox->setFocus();
	_ui->loginButton->setDefault(true);

}
コード例 #11
0
//VOXOX CHANGE by Rolando - 2009.05.22 - added parameter "loginInvisible" to be able to login with a invisible presence
void UserProfileHandler::setCurrentUserProfile(const std::string & name, const SipAccount & sipAccount, bool loginInvisible) {

	RecursiveMutex::ScopedLock lock(_mutex);

	UserProfile * result = getUserProfile(name);
	
	// Check if the desired UserProfile is different from the current UserProfile
	// and check if the WengoAccount of the current UserProfile is different from the given WengoAccount
	// (if so the WengoAccount (only 'password' and 'keep password' members) will be updated).
	if (!_currentUserProfile ||
		(_currentUserProfile &&
			((_currentUserProfile->getName() != name) ||
			((sipAccount.getUserPassword() != result->getSipAccount()->getUserPassword()) ||
				(sipAccount.isPasswordRemembered() != result->getSipAccount()->isPasswordRemembered()))))) {

		if (result) {
			// If the SipAccount is not empty, we update the one in UserProfile
			// This can happen if the password has been changed
			
			if (!sipAccount.isEmpty() ) {

				// to be virtual ?
				switch(sipAccount.getType()) {
					case SipAccount::SipAccountTypeBasic: {
					
						SipAccount * actSipAccount = result->getSipAccount();
						if (actSipAccount) {
						
							actSipAccount->setRegisterServerHostname(sipAccount.getRegisterServerHostname());
							actSipAccount->setRegisterServerPort(sipAccount.getRegisterServerPort());
							actSipAccount->setSIPProxyServerHostname(sipAccount.getSIPProxyServerHostname());
							actSipAccount->setSIPProxyServerPort(sipAccount.getSIPProxyServerPort());
							actSipAccount->setDisplayName(sipAccount.getDisplayName());
							actSipAccount->setIdentity(sipAccount.getIdentity());
							actSipAccount->setUsername(sipAccount.getUsername());
							actSipAccount->setPassword(sipAccount.getPassword());
							actSipAccount->setRealm(sipAccount.getRealm());
							actSipAccount->setVisibleName(sipAccount.getVisibleName());
							actSipAccount->enablePIM(sipAccount.isPIMEnabled());
							actSipAccount->setRememberPassword(sipAccount.isPasswordRemembered());
							actSipAccount->setRememberUsername(sipAccount.isUsernameRemembered());
							actSipAccount->setAutoLoginVoxOx(sipAccount.isAutoLoginVoxOx());
						} else {
							SipAccount mySipAccount = sipAccount;
							result->setSipAccount(mySipAccount, false);
						}
					}
					break;
					case SipAccount::SipAccountTypeWengo: {
					
						const WengoAccount & refWengoAccount = dynamic_cast<const WengoAccount &>(sipAccount);
						WengoAccount * actWengoAccount = result->getWengoAccount();
						
						if (actWengoAccount) {
							actWengoAccount->setWengoLogin(refWengoAccount.getWengoLogin());
							actWengoAccount->setWengoPassword(refWengoAccount.getWengoPassword());
							actWengoAccount->setRememberPassword(refWengoAccount.isPasswordRemembered());
							actWengoAccount->setRememberUsername(refWengoAccount.isUsernameRemembered());
							actWengoAccount->setAutoLoginVoxOx(sipAccount.isAutoLoginVoxOx());
						} else {
							WengoAccount myWengoAccount = refWengoAccount;
							result->setSipAccount(myWengoAccount, false);
						}
					}
					break;
				}
			}

			//VOXOX CHANGE by Rolando - 2009.05.22 - sets if user checked login with a invisible presence
			result->setLoginInvisible(loginInvisible);

			if (_currentUserProfile) {
				LOG_DEBUG("UserProfile will change");
				_desiredUserProfile = result;
				currentUserProfileWillDieEvent(*this);
			} else {
				LOG_DEBUG("No current UserProfile set. Change now");
				_currentUserProfile = result;
				initializeCurrentUserProfile();
			}
		} else {
			// log off
			if (_currentUserProfile && name.empty()) {

				_saveTimerRunning = false;
				_saveTimer.stop();

				_desiredUserProfile = NULL;
				currentUserProfileWillDieEvent(*this);
			// when name is empty or do not match any profile
			} else {
				noCurrentUserProfileSetEvent(*this);
			}
		}
	}
}