From df19ab8e9da9404c8342efbe8f8d99c1c2e65d8b Mon Sep 17 00:00:00 2001 From: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com> Date: Thu, 21 May 2009 11:28:42 -0400 Subject: [PATCH] [#1400] Make the match with the hostname instead of username --- sflphone-common/src/managerimpl.cpp | 4 ++-- sflphone-common/src/sipaccount.cpp | 7 ++++++- sflphone-common/src/sipaccount.h | 1 + 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/sflphone-common/src/managerimpl.cpp b/sflphone-common/src/managerimpl.cpp index a9886dd739..5f08b84bb0 100644 --- a/sflphone-common/src/managerimpl.cpp +++ b/sflphone-common/src/managerimpl.cpp @@ -2507,11 +2507,11 @@ ManagerImpl::getAccountIdFromNameAndServer(const std::string& userName, const st } } - // We failed! Then only match the username + // We failed! Then only match the hostname for(iter = _accountMap.begin(); iter != _accountMap.end(); ++iter) { account = dynamic_cast<SIPAccount *>(iter->second); if ( account != NULL ) { - if(account->userMatch(userName)) + if(account->hostnameMatch(server)) return iter->first; } } diff --git a/sflphone-common/src/sipaccount.cpp b/sflphone-common/src/sipaccount.cpp index b72eb15e0f..31502460a3 100644 --- a/sflphone-common/src/sipaccount.cpp +++ b/sflphone-common/src/sipaccount.cpp @@ -87,7 +87,7 @@ void SIPAccount::loadConfig() bool SIPAccount::fullMatch(const std::string& username, const std::string& hostname) { - return (username == getUsername() && hostname == getHostname()); + return (userMatch (username) && hostnameMatch (hostname)); } bool SIPAccount::userMatch(const std::string& username) @@ -95,3 +95,8 @@ bool SIPAccount::userMatch(const std::string& username) return (username == getUsername()); } +bool SIPAccount::hostnameMatch(const std::string& hostname) +{ + return (hostname == getHostname()); +} + diff --git a/sflphone-common/src/sipaccount.h b/sflphone-common/src/sipaccount.h index a49af2d008..a9925d734f 100644 --- a/sflphone-common/src/sipaccount.h +++ b/sflphone-common/src/sipaccount.h @@ -76,6 +76,7 @@ class SIPAccount : public Account bool fullMatch(const std::string& username, const std::string& hostname); bool userMatch(const std::string& username); + bool hostnameMatch(const std::string& hostname); pjsip_regc* getRegistrationInfo( void ) { return _regc; } void setRegistrationInfo( pjsip_regc *regc ) { _regc = regc; } -- GitLab