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
6bff8561
Commit
6bff8561
authored
5 years ago
by
Adrien Béraud
Browse files
Options
Downloads
Patches
Plain Diff
account manager: check info
Change-Id: Iccae983c6d70ba47e0ec20c83d209c16bbe8b2b0
parent
d89bccf0
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/jamidht/account_manager.cpp
+18
-7
18 additions, 7 deletions
src/jamidht/account_manager.cpp
src/jamidht/account_manager.h
+1
-1
1 addition, 1 deletion
src/jamidht/account_manager.h
with
19 additions
and
8 deletions
src/jamidht/account_manager.cpp
+
18
−
7
View file @
6bff8561
...
@@ -320,6 +320,10 @@ AccountManager::addContact(const std::string& uri, bool confirmed)
...
@@ -320,6 +320,10 @@ AccountManager::addContact(const std::string& uri, bool confirmed)
JAMI_ERR
(
"addContact: invalid contact URI"
);
JAMI_ERR
(
"addContact: invalid contact URI"
);
return
;
return
;
}
}
if
(
not
info_
)
{
JAMI_ERR
(
"addContact(): account not loaded"
);
return
;
}
if
(
info_
->
contacts
->
addContact
(
h
,
confirmed
))
{
if
(
info_
->
contacts
->
addContact
(
h
,
confirmed
))
{
syncDevices
();
syncDevices
();
}
}
...
@@ -333,6 +337,10 @@ AccountManager::removeContact(const std::string& uri, bool banned)
...
@@ -333,6 +337,10 @@ AccountManager::removeContact(const std::string& uri, bool banned)
JAMI_ERR
(
"removeContact: invalid contact URI"
);
JAMI_ERR
(
"removeContact: invalid contact URI"
);
return
;
return
;
}
}
if
(
not
info_
)
{
JAMI_ERR
(
"addContact(): account not loaded"
);
return
;
}
if
(
info_
->
contacts
->
removeContact
(
h
,
banned
))
{
if
(
info_
->
contacts
->
removeContact
(
h
,
banned
))
{
syncDevices
();
syncDevices
();
}
}
...
@@ -391,25 +399,25 @@ AccountManager::findCertificate(const dht::InfoHash& h, std::function<void(const
...
@@ -391,25 +399,25 @@ AccountManager::findCertificate(const dht::InfoHash& h, std::function<void(const
bool
bool
AccountManager
::
setCertificateStatus
(
const
std
::
string
&
cert_id
,
tls
::
TrustStore
::
PermissionStatus
status
)
AccountManager
::
setCertificateStatus
(
const
std
::
string
&
cert_id
,
tls
::
TrustStore
::
PermissionStatus
status
)
{
{
return
info_
->
contacts
->
setCertificateStatus
(
cert_id
,
status
);
return
info_
and
info_
->
contacts
->
setCertificateStatus
(
cert_id
,
status
);
}
}
std
::
vector
<
std
::
string
>
std
::
vector
<
std
::
string
>
AccountManager
::
getCertificatesByStatus
(
tls
::
TrustStore
::
PermissionStatus
status
)
AccountManager
::
getCertificatesByStatus
(
tls
::
TrustStore
::
PermissionStatus
status
)
{
{
return
info_
->
contacts
->
getCertificatesByStatus
(
status
);
return
info_
?
info_
->
contacts
->
getCertificatesByStatus
(
status
)
:
std
::
vector
<
std
::
string
>
{}
;
}
}
tls
::
TrustStore
::
PermissionStatus
tls
::
TrustStore
::
PermissionStatus
AccountManager
::
getCertificateStatus
(
const
std
::
string
&
cert_id
)
const
AccountManager
::
getCertificateStatus
(
const
std
::
string
&
cert_id
)
const
{
{
return
info_
->
contacts
->
getCertificateStatus
(
cert_id
);
return
info_
?
info_
->
contacts
->
getCertificateStatus
(
cert_id
)
:
tls
::
TrustStore
::
PermissionStatus
::
UNDEFINED
;
}
}
bool
bool
AccountManager
::
isAllowed
(
const
crypto
::
Certificate
&
crt
,
bool
allowPublic
)
AccountManager
::
isAllowed
(
const
crypto
::
Certificate
&
crt
,
bool
allowPublic
)
{
{
return
info_
->
contacts
->
isAllowed
(
crt
,
allowPublic
);
return
info_
and
info_
->
contacts
->
isAllowed
(
crt
,
allowPublic
);
}
}
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
std
::
vector
<
std
::
map
<
std
::
string
,
std
::
string
>>
...
@@ -426,7 +434,7 @@ bool
...
@@ -426,7 +434,7 @@ bool
AccountManager
::
acceptTrustRequest
(
const
std
::
string
&
from
)
AccountManager
::
acceptTrustRequest
(
const
std
::
string
&
from
)
{
{
dht
::
InfoHash
f
(
from
);
dht
::
InfoHash
f
(
from
);
if
(
info_
->
contacts
->
acceptTrustRequest
(
f
))
{
if
(
info_
and
info_
->
contacts
->
acceptTrustRequest
(
f
))
{
sendTrustRequestConfirm
(
f
);
sendTrustRequestConfirm
(
f
);
syncDevices
();
syncDevices
();
return
true
;
return
true
;
...
@@ -438,7 +446,7 @@ bool
...
@@ -438,7 +446,7 @@ bool
AccountManager
::
discardTrustRequest
(
const
std
::
string
&
from
)
AccountManager
::
discardTrustRequest
(
const
std
::
string
&
from
)
{
{
dht
::
InfoHash
f
(
from
);
dht
::
InfoHash
f
(
from
);
return
info_
->
contacts
->
discardTrustRequest
(
f
);
return
info_
and
info_
->
contacts
->
discardTrustRequest
(
f
);
}
}
void
void
...
@@ -450,6 +458,10 @@ AccountManager::sendTrustRequest(const std::string& to, const std::vector<uint8_
...
@@ -450,6 +458,10 @@ AccountManager::sendTrustRequest(const std::string& to, const std::vector<uint8_
JAMI_ERR
(
"can't send trust request to invalid hash: %s"
,
to
.
c_str
());
JAMI_ERR
(
"can't send trust request to invalid hash: %s"
,
to
.
c_str
());
return
;
return
;
}
}
if
(
not
info_
)
{
JAMI_ERR
(
"sendTrustRequest(): account not loaded"
);
return
;
}
if
(
info_
->
contacts
->
addContact
(
toH
))
{
if
(
info_
->
contacts
->
addContact
(
toH
))
{
syncDevices
();
syncDevices
();
}
}
...
@@ -474,7 +486,6 @@ AccountManager::sendTrustRequestConfirm(const dht::InfoHash& toH)
...
@@ -474,7 +486,6 @@ AccountManager::sendTrustRequestConfirm(const dht::InfoHash& toH)
});
});
}
}
void
void
AccountManager
::
forEachDevice
(
const
dht
::
InfoHash
&
to
,
AccountManager
::
forEachDevice
(
const
dht
::
InfoHash
&
to
,
std
::
function
<
void
(
const
dht
::
InfoHash
&
)
>&&
op
,
std
::
function
<
void
(
const
dht
::
InfoHash
&
)
>&&
op
,
...
...
This diff is collapsed.
Click to expand it.
src/jamidht/account_manager.h
+
1
−
1
View file @
6bff8561
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