Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
jami-libclient
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
savoirfairelinux
jami-libclient
Commits
281c50f5
Commit
281c50f5
authored
5 years ago
by
Ming Rui Zhang
Browse files
Options
Downloads
Patches
Plain Diff
newaccountmodel: add functions to interact with sip credential informations
Change-Id: Id1540c50cbbf6da7f62bc85de12a7664c4ad10c8
parent
3e6e9038
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/api/account.h
+75
-74
75 additions, 74 deletions
src/api/account.h
src/api/newaccountmodel.h
+2
-0
2 additions, 0 deletions
src/api/newaccountmodel.h
src/newaccountmodel.cpp
+32
-7
32 additions, 7 deletions
src/newaccountmodel.cpp
with
109 additions
and
81 deletions
src/api/account.h
+
75
−
74
View file @
281c50f5
...
...
@@ -128,6 +128,7 @@ struct ConfProperties_t {
bool
accountDiscovery
;
bool
accountPublish
;
int
registrationExpire
;
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
credentials
;
struct
Audio_t
{
int
audioPortMax
;
int
audioPortMin
;
...
...
This diff is collapsed.
Click to expand it.
src/api/newaccountmodel.h
+
2
−
0
View file @
281c50f5
...
...
@@ -65,12 +65,14 @@ public:
* @return a std::vector<std::string>.
*/
std
::
vector
<
std
::
string
>
getAccountList
()
const
;
/**
* get account informations associated to an accountId.
* @param accountId.
* @return a const account::Info& structure.
*/
const
account
::
Info
&
getAccountInfo
(
const
std
::
string
&
accountId
)
const
;
/**
* flag account corresponding to passed id as freeable.
*/
...
...
This diff is collapsed.
Click to expand it.
src/newaccountmodel.cpp
+
32
−
7
View file @
281c50f5
...
...
@@ -222,14 +222,26 @@ NewAccountModel::setAccountConfig(const std::string& accountId,
if
(
accountInfo
.
profileInfo
.
type
==
profile
::
Type
::
RING
)
{
details
[
ConfProperties
::
USERNAME
]
=
toQString
(
accountInfo
.
profileInfo
.
uri
).
prepend
((
accountInfo
.
profileInfo
.
type
==
profile
::
Type
::
RING
)
?
"ring:"
:
""
);
}
else
if
(
accountInfo
.
profileInfo
.
type
==
profile
::
Type
::
SIP
)
{
MapStringString
credentials
;
credentials
[
ConfProperties
::
USERNAME
]
=
toQString
(
confProperties
.
username
);
credentials
[
ConfProperties
::
PASSWORD
]
=
toQString
(
confProperties
.
password
);
credentials
[
ConfProperties
::
REALM
]
=
confProperties
.
realm
.
empty
()
?
QString
(
"*"
)
:
toQString
(
confProperties
.
realm
);
QVector
<
MapStringString
>
credentialsVec
;
credentialsVec
.
append
(
credentials
);
ConfigurationManager
::
instance
().
setCredentials
(
accountId
.
c_str
(),
credentialsVec
);
VectorMapStringString
finalCred
;
std
::
map
<
std
::
string
,
std
::
string
>
credentials
;
credentials
[
ConfProperties
::
USERNAME
]
=
confProperties
.
username
;
credentials
[
ConfProperties
::
PASSWORD
]
=
confProperties
.
password
;
credentials
[
ConfProperties
::
REALM
]
=
confProperties
.
realm
.
empty
()
?
"*"
:
confProperties
.
realm
;
auto
credentialsVec
=
confProperties
.
credentials
;
credentialsVec
[
0
]
=
credentials
;
for
(
auto
const
&
i
:
credentialsVec
)
{
QMap
<
QString
,
QString
>
credMap
;
for
(
auto
const
&
j
:
i
)
{
credMap
[
j
.
first
.
c_str
()]
=
j
.
second
.
c_str
();
}
finalCred
.
append
(
credMap
);
}
ConfigurationManager
::
instance
().
setCredentials
(
accountId
.
c_str
(),
finalCred
);
details
[
ConfProperties
::
USERNAME
]
=
toQString
(
confProperties
.
username
);
accountInfo
.
confProperties
.
credentials
.
swap
(
credentialsVec
);
}
configurationManager
.
setAccountDetails
(
QString
::
fromStdString
(
accountId
),
details
);
}
...
...
@@ -621,6 +633,19 @@ NewAccountModelPimpl::addToAccounts(const std::string& accountId,
MapStringString
details
=
ConfigurationManager
::
instance
().
getAccountDetails
(
accountId
.
c_str
());
newAccInfo
.
fromDetails
(
details
);
// Fill account::Info::confProperties credentials
VectorMapStringString
credGet
=
ConfigurationManager
::
instance
().
getCredentials
(
accountId
.
c_str
());
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
credToStore
;
for
(
auto
const
&
i
:
credGet
.
toStdVector
())
{
std
::
map
<
std
::
string
,
std
::
string
>
credMap
;
for
(
auto
const
&
j
:
i
.
toStdMap
())
{
credMap
[
j
.
first
.
toStdString
()]
=
j
.
second
.
toStdString
();
}
credToStore
.
emplace_back
(
credMap
);
}
newAccInfo
.
confProperties
.
credentials
.
swap
(
credToStore
);
// Init models for this account
newAccInfo
.
accountModel
=
&
linked
;
newAccInfo
.
callModel
=
std
::
make_unique
<
NewCallModel
>
(
newAccInfo
,
callbacksHandler
);
...
...
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