Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
087e935b
Commit
087e935b
authored
Jul 25, 2006
by
yanmorin
Browse files
Terminate account when registrating a new one
parent
0c8dac16
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/account.cpp
View file @
087e935b
...
...
@@ -27,6 +27,7 @@ Account::Account(const AccountID& accountID) : _accountID(accountID)
_shouldRegisterOnStart
=
false
;
_enabled
=
false
;
_registered
=
false
;
_state
=
false
;
}
...
...
src/account.h
View file @
087e935b
...
...
@@ -102,6 +102,11 @@ public:
*/
bool
isEnabled
()
{
return
_enabled
;
}
/**
* Tell if the latest registration succeed or failed
*/
bool
setState
(
bool
state
)
{
_state
=
state
;
}
private:
/**
* Create a unique voIPLink() depending on the protocol
...
...
@@ -145,6 +150,11 @@ protected:
*/
bool
_registered
;
/**
* The latest registration was a success or not
*/
bool
_state
;
};
#endif
src/managerimpl.cpp
View file @
087e935b
...
...
@@ -440,8 +440,19 @@ ManagerImpl::registerVoIPLink(const AccountID& accountId)
{
_debug
(
"Register VoIP Link
\n
"
);
int
returnValue
=
false
;
if
(
accountExists
(
accountId
)
)
{
returnValue
=
getAccount
(
accountId
)
->
registerAccount
();
// right now, we don't support two SIP account
// so we close everything before registring a new account
Account
*
account
=
getAccount
(
accountId
);
if
(
account
!=
0
)
{
AccountMap
::
iterator
iter
=
_accountMap
.
begin
();
while
(
iter
!=
_accountMap
.
end
()
)
{
if
(
iter
->
second
)
{
iter
->
second
->
unregisterAccount
();
iter
->
second
->
terminate
();
}
iter
++
;
}
returnValue
=
account
->
registerAccount
();
}
return
returnValue
;
}
...
...
@@ -453,7 +464,7 @@ ManagerImpl::unregisterVoIPLink(const AccountID& accountId)
_debug
(
"Unregister VoIP Link
\n
"
);
int
returnValue
=
false
;
if
(
accountExists
(
accountId
)
)
{
returnValue
=
getAccount
(
accountId
)
->
registerAccount
();
returnValue
=
getAccount
(
accountId
)
->
un
registerAccount
();
}
return
returnValue
;
}
...
...
@@ -739,20 +750,28 @@ void
ManagerImpl
::
stopVoiceMessageNotification
(
const
AccountID
&
accountId
)
{
if
(
_gui
)
_gui
->
sendVoiceNbMessage
(
accountId
,
std
::
string
(
"0"
));
}
}
//THREAD=VoIP
void
ManagerImpl
::
registrationSucceed
(
const
AccountID
&
accountid
)
{
if
(
_gui
)
_gui
->
sendRegistrationState
(
accountid
,
true
);
Account
*
acc
=
getAccount
(
accountid
);
if
(
acc
)
{
acc
->
setState
(
true
);
if
(
_gui
)
_gui
->
sendRegistrationState
(
accountid
,
true
);
}
}
//THREAD=VoIP
void
ManagerImpl
::
registrationFailed
(
const
AccountID
&
accountid
)
{
if
(
_gui
)
_gui
->
sendRegistrationState
(
accountid
,
false
);
Account
*
acc
=
getAccount
(
accountid
);
if
(
acc
)
{
acc
->
setState
(
false
);
if
(
_gui
)
_gui
->
sendRegistrationState
(
accountid
,
false
);
}
}
/**
...
...
src/sipaccount.cpp
View file @
087e935b
...
...
@@ -55,6 +55,7 @@ bool
SIPAccount
::
registerAccount
()
{
if
(
_link
)
{
init
();
// init if not enable
unregisterAccount
();
SIPVoIPLink
*
tmplink
=
dynamic_cast
<
SIPVoIPLink
*>
(
_link
);
if
(
tmplink
)
{
...
...
src/sipvoiplink.cpp
View file @
087e935b
...
...
@@ -224,7 +224,7 @@ SIPVoIPLink::getEvent()
_debug
(
"EXOSIP_REGISTRATION_REFRESHED event is not implemented
\n
"
);
break
;
case
EXOSIP_REGISTRATION_TERMINATED
:
/** 04 < UA is not registred any more. */
_debug
(
"EXOSIP_REGISTRATION_TERMINATED event is not implmen
e
ted
\n
"
);
_debug
(
"EXOSIP_REGISTRATION_TERMINATED event is not impl
e
mented
\n
"
);
break
;
/* INVITE related events within calls */
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment