Commit dd407a6b authored by Alexandre Bourget's avatar Alexandre Bourget

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

parent 65690e30
......@@ -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++;
}
......
......@@ -37,48 +37,32 @@ SIPAccount::~SIPAccount()
void
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->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);
}
thislink->setStunServer(Manager::instance().getConfigString(_accountID,SIP_STUN_SERVER));
thislink->setUseStun( useStun!=0 ? true : false);
_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
SIPAccount::terminate()
void
SIPAccount::unregisterVoIPLink()
{
_link->sendUnregister();
_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
Markdown is supported
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