Commit dd407a6b authored by Alexandre Bourget's avatar Alexandre Bourget
Browse files

Remove all duplicate init/registerVoIPLink and terminate/unregister calls and methods.

parent 65690e30
...@@ -63,6 +63,7 @@ sflphone-gtk/doc/html/* ...@@ -63,6 +63,7 @@ sflphone-gtk/doc/html/*
/sflphone-gtk/mkinstalldirs /sflphone-gtk/mkinstalldirs
/sflphone-gtk/src/sflphone-gtk /sflphone-gtk/src/sflphone-gtk
/sflphone-gtk/autom4te* /sflphone-gtk/autom4te*
/sflphone-gtk/sflphone.desktop
...@@ -94,7 +95,7 @@ tools/portaudio ...@@ -94,7 +95,7 @@ tools/portaudio
/www/cache /www/cache
/www/config.inc.php /www/config.inc.php
/www/lighttpd.* /www/lighttpd.*
/doc/images/graphics/*
# Ignore platform packaging temp files # Ignore platform packaging temp files
/platform/debian/changelog /platform/debian/changelog
......
...@@ -79,7 +79,7 @@ class Account{ ...@@ -79,7 +79,7 @@ class Account{
inline VoIPLink* getVoIPLink() { return _link; } inline VoIPLink* getVoIPLink() { return _link; }
/** /**
* Register the underlying VoIPLink * Register the underlying VoIPLink. Launch the event listener.
* *
* This should update the getRegistrationState() return value. * This should update the getRegistrationState() return value.
* *
...@@ -88,7 +88,7 @@ class Account{ ...@@ -88,7 +88,7 @@ class Account{
virtual void registerVoIPLink() = 0; virtual void registerVoIPLink() = 0;
/** /**
* Unregister the underlying VoIPLink * Unregister the underlying VoIPLink. Stop the event listener.
* *
* This should update the getRegistrationState() return value. * This should update the getRegistrationState() return value.
* *
...@@ -96,18 +96,6 @@ class Account{ ...@@ -96,18 +96,6 @@ class Account{
*/ */
virtual void unregisterVoIPLink() = 0; 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. * Tell if the account is enable or not. See doc for _enabled.
*/ */
......
...@@ -38,7 +38,8 @@ IAXAccount::~IAXAccount() ...@@ -38,7 +38,8 @@ IAXAccount::~IAXAccount()
void void
IAXAccount::registerVoIPLink() IAXAccount::registerVoIPLink()
{ {
init(); _link->init();
//unregisterAccount(); No need to unregister first. //unregisterAccount(); No need to unregister first.
IAXVoIPLink* thislink = dynamic_cast<IAXVoIPLink*> (_link); IAXVoIPLink* thislink = dynamic_cast<IAXVoIPLink*> (_link);
if (thislink) { if (thislink) {
...@@ -55,20 +56,7 @@ void ...@@ -55,20 +56,7 @@ void
IAXAccount::unregisterVoIPLink() IAXAccount::unregisterVoIPLink()
{ {
_link->sendUnregister(); _link->sendUnregister();
}
bool
IAXAccount::init()
{
_link->init();
return true;
}
bool
IAXAccount::terminate()
{
_link->terminate(); _link->terminate();
return true;
} }
void void
......
...@@ -30,16 +30,14 @@ ...@@ -30,16 +30,14 @@
class IAXAccount : public Account class IAXAccount : public Account
{ {
public: public:
IAXAccount(const AccountID& accountID); IAXAccount(const AccountID& accountID);
~IAXAccount(); ~IAXAccount();
/** Actually unuseful, since config loading is done in init() */ /** Actually unuseful, since config loading is done in init() */
void loadConfig(); void loadConfig();
void registerVoIPLink(); void registerVoIPLink();
void unregisterVoIPLink(); void unregisterVoIPLink();
bool init();
bool terminate();
private: private:
}; };
......
...@@ -456,7 +456,6 @@ ManagerImpl::registerAccount(const AccountID& accountId) ...@@ -456,7 +456,6 @@ ManagerImpl::registerAccount(const AccountID& accountId)
while ( iter != _accountMap.end() ) { while ( iter != _accountMap.end() ) {
if ( iter->second ) { if ( iter->second ) {
iter->second->unregisterVoIPLink(); iter->second->unregisterVoIPLink();
iter->second->terminate();
} }
iter++; iter++;
} }
......
...@@ -37,48 +37,32 @@ SIPAccount::~SIPAccount() ...@@ -37,48 +37,32 @@ SIPAccount::~SIPAccount()
void void
SIPAccount::registerVoIPLink() SIPAccount::registerVoIPLink()
{
init(); // init if not enable
unregisterVoIPLink();
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));
}
_link->sendRegister();
}
void
SIPAccount::unregisterVoIPLink()
{
_link->sendUnregister();
}
bool
SIPAccount::init()
{ {
_link->setFullName(Manager::instance().getConfigString(_accountID,SIP_FULL_NAME)); _link->setFullName(Manager::instance().getConfigString(_accountID,SIP_FULL_NAME));
_link->setHostName(Manager::instance().getConfigString(_accountID,SIP_HOST_PART)); _link->setHostName(Manager::instance().getConfigString(_accountID,SIP_HOST_PART));
int useStun = Manager::instance().getConfigInt(_accountID,SIP_USE_STUN); int useStun = Manager::instance().getConfigInt(_accountID,SIP_USE_STUN);
SIPVoIPLink* thislink = dynamic_cast<SIPVoIPLink*> (_link); SIPVoIPLink* thislink = dynamic_cast<SIPVoIPLink*> (_link);
if (thislink) {
thislink->setStunServer(Manager::instance().getConfigString(_accountID,SIP_STUN_SERVER)); thislink->setStunServer(Manager::instance().getConfigString(_accountID,SIP_STUN_SERVER));
thislink->setUseStun( useStun!=0 ? true : false); thislink->setUseStun( useStun!=0 ? true : false);
}
_link->init(); _link->init();
return true;
// 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();
} }
bool void
SIPAccount::terminate() SIPAccount::unregisterVoIPLink()
{ {
_link->sendUnregister();
_link->terminate(); _link->terminate();
return true;
} }
void void
......
...@@ -24,7 +24,7 @@ ...@@ -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> * @author Yan Morin <yan.morin@gmail.com>
*/ */
class SIPAccount : public Account class SIPAccount : public Account
...@@ -38,11 +38,8 @@ public: ...@@ -38,11 +38,8 @@ public:
void loadConfig(); void loadConfig();
void registerVoIPLink(); void registerVoIPLink();
void unregisterVoIPLink(); void unregisterVoIPLink();
bool init();
bool terminate();
private: private:
}; };
#endif #endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment