aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.cpp
diff options
context:
space:
mode:
authorTobias Fella <9750016+TobiasFella@users.noreply.github.com>2022-05-18 22:02:50 +0200
committerGitHub <noreply@github.com>2022-05-18 22:02:50 +0200
commitc671867a0a3e2a6ad0e7ae6e93fa09467c06188f (patch)
tree6c8605a54480ec85b385e25f263d775d0dbfaead /lib/connection.cpp
parent89d8f6c44f86a27df28b1d89a80564fb0d4d89fc (diff)
downloadlibquotient-c671867a0a3e2a6ad0e7ae6e93fa09467c06188f.tar.gz
libquotient-c671867a0a3e2a6ad0e7ae6e93fa09467c06188f.zip
Apply suggestions from code review
Co-authored-by: Alexey Rusakov <Kitsune-Ral@users.sf.net>
Diffstat (limited to 'lib/connection.cpp')
-rw-r--r--lib/connection.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index a5615f64..66e21a2a 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -33,7 +33,6 @@
#include "jobs/downloadfilejob.h"
#include "jobs/mediathumbnailjob.h"
#include "jobs/syncjob.h"
-#include <variant>
#ifdef Quotient_E2EE_ENABLED
# include "database.h"
@@ -2242,7 +2241,7 @@ bool Connection::isKnownCurveKey(const QString& user, const QString& curveKey)
bool Connection::hasOlmSession(User* user, const QString& deviceId) const
{
const auto& curveKey = curveKeyForUserDevice(user->id(), deviceId);
- return d->olmSessions.contains(curveKey) && d->olmSessions[curveKey].size() > 0;
+ return d->olmSessions.contains(curveKey) && !d->olmSessions[curveKey].empty();
}
QPair<QOlmMessage::Type, QByteArray> Connection::olmEncryptMessage(User* user, const QString& device, const QByteArray& message)
@@ -2254,9 +2253,9 @@ QPair<QOlmMessage::Type, QByteArray> Connection::olmEncryptMessage(User* user, c
if (pickle) {
database()->updateOlmSession(curveKey, d->olmSessions[curveKey][0]->sessionId(), *pickle);
} else {
- qCWarning(E2EE) << "Failed to pickle olm session.";
+ qCWarning(E2EE) << "Failed to pickle olm session: " << pickle.error();
}
- return qMakePair(type, result.toCiphertext());
+ return { type, result.toCiphertext() };
}
void Connection::createOlmSession(const QString& theirIdentityKey, const QString& theirOneTimeKey)