예제 #1
0
WsAccount::WsAccount(UserProfile & userProfile )
	: WengoWebService(userProfile.getWengoAccount()),
	_userProfile(userProfile)
{
	Config & config = ConfigManager::getInstance().getCurrentConfig();

	//Setup the web service
//	setHostname(config.getWengoServerHostname());

#if 1
//	setHostname( "" );//VOXOX - CJC - 2009.07.05 Set server address
	setHostname( config.getApiHostname() );
	setServicePath( config.getVoxOxSyncWSPath() );
	setHttps(true);
	setPort(443);
#else
	setHostname( "" );
	setServicePath( "" );//VOXOX - CJC - 2009.07.05  Ser server address
	setHttps(false);
	setPort( 80 );
#endif

	setGet(true);	//true = POST in Curl lib.
	setWengoAuthentication(false);

	_userNetworkId = 0;
	_bDeleted	   = false;
}
예제 #2
0
WsContactUpload::WsContactUpload(UserProfile & userProfile)
	: WengoWebService(userProfile.getWengoAccount()),
	_userProfile(userProfile) {

	Config & config = ConfigManager::getInstance().getCurrentConfig();

	//Setup the web service
	setHostname(config.getWengoServerHostname());
	setGet(true);
	setServicePath(config.getVoxoxContactUploadPath());
	setWengoAuthentication(false);

#if 1
	setHttps(true);	//VOXOX - JRT - 2009.10.05 
	setPort(443);
#else
	setHttps(false);
	setPort(80);
#endif
}
예제 #3
0
void QtAddWengoAccount::load(std::string sipAccountName) {
	//load userprofile
	UserProfile * userProfile = _cUserProfileHandler.getUserProfileHandler().getUserProfile(sipAccountName);
	if (userProfile && userProfile->hasSipAccount()) {
		//tests account type
		if (userProfile->hasWengoAccount()) {
			//loads the wengo acccount
			WengoAccount * wengoAccount = userProfile->getWengoAccount();
			_ui->email->setText(QString::fromStdString(wengoAccount->getWengoLogin()));
			_ui->password->setText(QString::fromStdString(wengoAccount->getWengoPassword()));
			setInfoMessage();
		} else {
			//should be loaded as a sip account
			//_loginDialog->changePage(QtLoginDialog::AddSIPAccount, sipAccountName);//VOXOX CHANGE by Rolando 02-25-09
			_loginDialog->changePage(QtLoginDialog::AddVoxOxAccount, sipAccountName);//VOXOX CHANGE by Rolando 02-25-09

		}
	} else {
		//_loginDialog->changePage(QtLoginDialog::AddAccount);//VOXOX CHANGE by Rolando 02-25-09
		_loginDialog->changePage(QtLoginDialog::AddVoxOxAccount, sipAccountName);//VOXOX CHANGE by Rolando 02-25-09

	}
	OWSAFE_DELETE(userProfile);
}
예제 #4
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);
			}
		}
	}
}