mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
Remove all duplicate init/registerVoIPLink and terminate/unregister calls and methods.
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@ -63,6 +63,7 @@ sflphone-gtk/doc/html/*
|
||||
/sflphone-gtk/mkinstalldirs
|
||||
/sflphone-gtk/src/sflphone-gtk
|
||||
/sflphone-gtk/autom4te*
|
||||
/sflphone-gtk/sflphone.desktop
|
||||
|
||||
|
||||
|
||||
@ -94,7 +95,7 @@ tools/portaudio
|
||||
/www/cache
|
||||
/www/config.inc.php
|
||||
/www/lighttpd.*
|
||||
|
||||
/doc/images/graphics/*
|
||||
|
||||
# Ignore platform packaging temp files
|
||||
/platform/debian/changelog
|
||||
|
@ -79,7 +79,7 @@ class Account{
|
||||
inline VoIPLink* getVoIPLink() { return _link; }
|
||||
|
||||
/**
|
||||
* Register the underlying VoIPLink
|
||||
* Register the underlying VoIPLink. Launch the event listener.
|
||||
*
|
||||
* This should update the getRegistrationState() return value.
|
||||
*
|
||||
@ -88,7 +88,7 @@ class Account{
|
||||
virtual void registerVoIPLink() = 0;
|
||||
|
||||
/**
|
||||
* Unregister the underlying VoIPLink
|
||||
* Unregister the underlying VoIPLink. Stop the event listener.
|
||||
*
|
||||
* This should update the getRegistrationState() return value.
|
||||
*
|
||||
@ -96,18 +96,6 @@ class Account{
|
||||
*/
|
||||
virtual void unregisterVoIPLink() = 0;
|
||||
|
||||
/**
|
||||
* Init the voiplink to run (event listener)
|
||||
* @return false if an error occurs
|
||||
*/
|
||||
virtual bool init() = 0;
|
||||
|
||||
/**
|
||||
* Stop the voiplink to run (event listener)
|
||||
* @return false is an error occurs
|
||||
*/
|
||||
virtual bool terminate() = 0;
|
||||
|
||||
/**
|
||||
* Tell if the account is enable or not. See doc for _enabled.
|
||||
*/
|
||||
|
@ -38,7 +38,8 @@ IAXAccount::~IAXAccount()
|
||||
void
|
||||
IAXAccount::registerVoIPLink()
|
||||
{
|
||||
init();
|
||||
_link->init();
|
||||
|
||||
//unregisterAccount(); No need to unregister first.
|
||||
IAXVoIPLink* thislink = dynamic_cast<IAXVoIPLink*> (_link);
|
||||
if (thislink) {
|
||||
@ -55,20 +56,7 @@ void
|
||||
IAXAccount::unregisterVoIPLink()
|
||||
{
|
||||
_link->sendUnregister();
|
||||
}
|
||||
|
||||
bool
|
||||
IAXAccount::init()
|
||||
{
|
||||
_link->init();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
IAXAccount::terminate()
|
||||
{
|
||||
_link->terminate();
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -30,16 +30,14 @@
|
||||
class IAXAccount : public Account
|
||||
{
|
||||
public:
|
||||
IAXAccount(const AccountID& accountID);
|
||||
IAXAccount(const AccountID& accountID);
|
||||
|
||||
~IAXAccount();
|
||||
~IAXAccount();
|
||||
|
||||
/** Actually unuseful, since config loading is done in init() */
|
||||
void loadConfig();
|
||||
void registerVoIPLink();
|
||||
void unregisterVoIPLink();
|
||||
bool init();
|
||||
bool terminate();
|
||||
|
||||
private:
|
||||
};
|
||||
|
@ -456,7 +456,6 @@ ManagerImpl::registerAccount(const AccountID& accountId)
|
||||
while ( iter != _accountMap.end() ) {
|
||||
if ( iter->second ) {
|
||||
iter->second->unregisterVoIPLink();
|
||||
iter->second->terminate();
|
||||
}
|
||||
iter++;
|
||||
}
|
||||
|
@ -38,16 +38,22 @@ SIPAccount::~SIPAccount()
|
||||
void
|
||||
SIPAccount::registerVoIPLink()
|
||||
{
|
||||
init(); // init if not enable
|
||||
unregisterVoIPLink();
|
||||
_link->setFullName(Manager::instance().getConfigString(_accountID,SIP_FULL_NAME));
|
||||
_link->setHostName(Manager::instance().getConfigString(_accountID,SIP_HOST_PART));
|
||||
int useStun = Manager::instance().getConfigInt(_accountID,SIP_USE_STUN);
|
||||
|
||||
SIPVoIPLink* thislink = dynamic_cast<SIPVoIPLink*> (_link);
|
||||
if (thislink) {
|
||||
// Stuff needed for SIP registration.
|
||||
thislink->setProxy (Manager::instance().getConfigString(_accountID,SIP_PROXY));
|
||||
thislink->setUserPart(Manager::instance().getConfigString(_accountID,SIP_USER_PART));
|
||||
thislink->setAuthName(Manager::instance().getConfigString(_accountID,SIP_AUTH_NAME));
|
||||
thislink->setPassword(Manager::instance().getConfigString(_accountID,SIP_PASSWORD));
|
||||
}
|
||||
|
||||
thislink->setStunServer(Manager::instance().getConfigString(_accountID,SIP_STUN_SERVER));
|
||||
thislink->setUseStun( useStun!=0 ? true : false);
|
||||
|
||||
_link->init();
|
||||
|
||||
// Stuff needed for SIP registration.
|
||||
thislink->setProxy (Manager::instance().getConfigString(_accountID,SIP_PROXY));
|
||||
thislink->setUserPart(Manager::instance().getConfigString(_accountID,SIP_USER_PART));
|
||||
thislink->setAuthName(Manager::instance().getConfigString(_accountID,SIP_AUTH_NAME));
|
||||
thislink->setPassword(Manager::instance().getConfigString(_accountID,SIP_PASSWORD));
|
||||
|
||||
_link->sendRegister();
|
||||
}
|
||||
@ -56,29 +62,7 @@ void
|
||||
SIPAccount::unregisterVoIPLink()
|
||||
{
|
||||
_link->sendUnregister();
|
||||
}
|
||||
|
||||
bool
|
||||
SIPAccount::init()
|
||||
{
|
||||
_link->setFullName(Manager::instance().getConfigString(_accountID,SIP_FULL_NAME));
|
||||
_link->setHostName(Manager::instance().getConfigString(_accountID,SIP_HOST_PART));
|
||||
int useStun = Manager::instance().getConfigInt(_accountID,SIP_USE_STUN);
|
||||
|
||||
SIPVoIPLink* thislink = dynamic_cast<SIPVoIPLink*> (_link);
|
||||
if (thislink) {
|
||||
thislink->setStunServer(Manager::instance().getConfigString(_accountID,SIP_STUN_SERVER));
|
||||
thislink->setUseStun( useStun!=0 ? true : false);
|
||||
}
|
||||
_link->init();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
SIPAccount::terminate()
|
||||
{
|
||||
_link->terminate();
|
||||
return true;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -24,7 +24,7 @@
|
||||
|
||||
|
||||
/**
|
||||
* A Sip Account specify SIP specific functions and object (SIPCall/SIPVoIPLink)
|
||||
* A SIP Account specify SIP specific functions and object (SIPCall/SIPVoIPLink)
|
||||
* @author Yan Morin <yan.morin@gmail.com>
|
||||
*/
|
||||
class SIPAccount : public Account
|
||||
@ -38,11 +38,8 @@ public:
|
||||
void loadConfig();
|
||||
void registerVoIPLink();
|
||||
void unregisterVoIPLink();
|
||||
bool init();
|
||||
bool terminate();
|
||||
|
||||
private:
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
Reference in New Issue
Block a user