Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
c7b30f5a
Commit
c7b30f5a
authored
17 years ago
by
Alexandre Bourget
Browse files
Options
Downloads
Patches
Plain Diff
Correct support for add/remove Accounts.
parent
1093d618
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/dbus/configurationmanager.cpp
+1
-3
1 addition, 3 deletions
src/dbus/configurationmanager.cpp
src/managerimpl.cpp
+48
-1
48 additions, 1 deletion
src/managerimpl.cpp
src/managerimpl.h
+20
-0
20 additions, 0 deletions
src/managerimpl.h
with
69 additions
and
4 deletions
src/dbus/configurationmanager.cpp
+
1
−
3
View file @
c7b30f5a
...
...
@@ -50,9 +50,7 @@ void
ConfigurationManager
::
addAccount
(
const
std
::
map
<
::
DBus
::
String
,
::
DBus
::
String
>&
details
)
{
_debug
(
"ConfigurationManager::addAccount received
\n
"
);
std
::
stringstream
accountID
;
accountID
<<
"Account:"
<<
time
(
NULL
);
Manager
::
instance
().
setAccountDetails
(
accountID
.
str
(),
details
);
Manager
::
instance
().
addAccount
(
details
);
}
...
...
This diff is collapsed.
Click to expand it.
src/managerimpl.cpp
+
48
−
1
View file @
c7b30f5a
...
...
@@ -1717,10 +1717,57 @@ ManagerImpl::setAccountDetails( const ::DBus::String& accountID,
if
(
_dbus
)
_dbus
->
getConfigurationManager
()
->
accountsChanged
();
}
void
ManagerImpl
::
addAccount
(
const
std
::
map
<
::
DBus
::
String
,
::
DBus
::
String
>&
details
)
{
/** @todo Deal with both the _accountMap and the Configuration */
std
::
string
accountType
=
(
*
details
.
find
(
CONFIG_ACCOUNT_TYPE
)).
second
;
Account
*
newAccount
;
std
::
stringstream
accountID
;
accountID
<<
"Account:"
<<
time
(
NULL
);
AccountID
newAccountID
=
accountID
.
str
();
/** @todo Verify the uniqueness, in case a program adds accounts, two in a row. */
setAccountDetails
(
accountID
.
str
(),
details
);
saveConfig
();
if
(
accountType
==
"SIP"
)
{
newAccount
=
AccountCreator
::
createAccount
(
AccountCreator
::
SIP_ACCOUNT
,
newAccountID
);
}
else
if
(
accountType
==
"IAX"
)
{
newAccount
=
AccountCreator
::
createAccount
(
AccountCreator
::
IAX_ACCOUNT
,
newAccountID
);
}
else
{
_debug
(
"Unknown %s param when calling addAccount(): %s
\n
"
,
CONFIG_ACCOUNT_TYPE
,
accountType
.
c_str
());
return
;
}
_accountMap
[
newAccountID
]
=
newAccount
;
// Get it up and running...
newAccount
->
loadConfig
();
if
(
newAccount
->
isEnabled
())
{
if
(
newAccount
->
init
())
{
newAccount
->
registerVoIPLink
();
}
}
}
void
ManagerImpl
::
removeAccount
(
const
AccountID
&
accountID
)
{
// Get it down and dying
Account
*
remAccount
=
getAccount
(
accountID
);
if
(
remAccount
)
{
remAccount
->
unregisterVoIPLink
();
_accountMap
.
erase
(
accountID
);
delete
remAccount
;
}
_config
.
removeSection
(
accountID
);
saveConfig
();
}
...
...
This diff is collapsed.
Click to expand it.
src/managerimpl.h
+
20
−
0
View file @
c7b30f5a
...
...
@@ -220,15 +220,35 @@ public:
bool
attachZeroconfEvents
(
const
std
::
string
&
sequenceId
,
Pattern
::
Observer
&
observer
);
bool
detachZeroconfEvents
(
Pattern
::
Observer
&
observer
);
bool
getCallStatus
(
const
std
::
string
&
sequenceId
);
/**
* Get account list
* @return A list of accoundIDs
*/
std
::
vector
<
std
::
string
>
getAccountList
();
/**
* Retrieve details about a given account
*/
std
::
map
<
std
::
string
,
std
::
string
>
getAccountDetails
(
const
AccountID
&
accountID
);
/**
* Save the details of an existing account, given the account ID
*/
void
setAccountDetails
(
const
::
DBus
::
String
&
accountID
,
const
std
::
map
<
::
DBus
::
String
,
::
DBus
::
String
>&
details
);
/**
* Add a new account, and give it a new account ID automatically
*/
void
addAccount
(
const
std
::
map
<
::
DBus
::
String
,
::
DBus
::
String
>&
details
);
/**
* Delete an existing account, unregister VoIPLink associated, and
* purge from configuration.
*/
void
removeAccount
(
const
AccountID
&
accountID
);
bool
getConfigAll
(
const
std
::
string
&
sequenceId
);
bool
getConfig
(
const
std
::
string
&
section
,
const
std
::
string
&
name
,
TokenList
&
arg
);
bool
setConfig
(
const
std
::
string
&
section
,
const
std
::
string
&
name
,
const
std
::
string
&
value
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment