Skip to content
Snippets Groups Projects
Commit 74a070f5 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

conversation_module: only decline if request is not found

Change-Id: If0450e78cefb1f850aca529a5dbfd80b139c9489
parent 0ec1d2e3
No related branches found
No related tags found
No related merge requests found
...@@ -273,15 +273,15 @@ public: ...@@ -273,15 +273,15 @@ public:
bool addConversationRequest(const std::string& id, const ConversationRequest& req) bool addConversationRequest(const std::string& id, const ConversationRequest& req)
{ {
std::lock_guard<std::mutex> lk(conversationsRequestsMtx_); std::lock_guard<std::mutex> lk(conversationsRequestsMtx_);
// Check that we're not adding a second one to one trust request
// NOTE: If a new one to one request is received, we can decline the previous one.
if (req.isOneToOne())
declineOtherConversationWith(req.from);
auto it = conversationsRequests_.find(id); auto it = conversationsRequests_.find(id);
if (it != conversationsRequests_.end()) { if (it != conversationsRequests_.end()) {
// Check if updated // Check if updated
if (req == it->second) if (req == it->second)
return false; return false;
} else if (req.isOneToOne()) {
// Check that we're not adding a second one to one trust request
// NOTE: If a new one to one request is received, we can decline the previous one.
declineOtherConversationWith(req.from);
} }
JAMI_DEBUG("Adding conversation request from {} ({})", req.from, id); JAMI_DEBUG("Adding conversation request from {} ({})", req.from, id);
conversationsRequests_[id] = req; conversationsRequests_[id] = req;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment