aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/connection.cpp8
-rw-r--r--lib/encryptionmanager.cpp2
-rw-r--r--lib/jobs/downloadfilejob.cpp2
-rw-r--r--lib/jobs/downloadfilejob.h2
-rw-r--r--lib/mxcreply.cpp3
-rw-r--r--lib/room.cpp11
6 files changed, 13 insertions, 15 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp
index 95ed1eb6..df9ff445 100644
--- a/lib/connection.cpp
+++ b/lib/connection.cpp
@@ -57,7 +57,7 @@
#include <QtNetwork/QDnsLookup>
-#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
+#if QT_VERSION_MAJOR >= 6
# include <qt6keychain/keychain.h>
#else
# include <qt5keychain/keychain.h>
@@ -830,7 +830,7 @@ void Connection::Private::consumePresenceData(Events&& presenceData)
void Connection::Private::consumeToDeviceEvents(Events&& toDeviceEvents)
{
#ifdef Quotient_E2EE_ENABLED
- if(toDeviceEvents.size() > 0) {
+ if (!toDeviceEvents.empty()) {
qCDebug(E2EE) << "Consuming" << toDeviceEvents.size() << "to-device events";
visitEach(toDeviceEvents, [this](const EncryptedEvent& event) {
if (event.algorithm() != OlmV1Curve25519AesSha2AlgoKey) {
@@ -1020,7 +1020,7 @@ DownloadFileJob* Connection::downloadFile(const QUrl& url,
#ifdef Quotient_E2EE_ENABLED
DownloadFileJob* Connection::downloadFile(const QUrl& url,
- const EncryptedFile file,
+ const EncryptedFile& file,
const QString& localFilename)
{
auto mediaId = url.authority() + url.path();
@@ -1996,7 +1996,7 @@ void Connection::Private::saveDevicesList()
void Connection::Private::loadDevicesList()
{
- QFile file { q->e2eeDataDir() + QStringLiteral("/deviceslist.json") };
+ QFile file { q->e2eeDataDir() % "/deviceslist.json" };
if(!file.exists() || !file.open(QIODevice::ReadOnly)) {
qCDebug(E2EE) << "No devicesList cache exists. Creating new";
return;
diff --git a/lib/encryptionmanager.cpp b/lib/encryptionmanager.cpp
index b09e5260..c816eda7 100644
--- a/lib/encryptionmanager.cpp
+++ b/lib/encryptionmanager.cpp
@@ -51,7 +51,7 @@ public:
}
}
void loadSessions() {
- QFile file { static_cast<Connection *>(q->parent())->e2eeDataDir() + QStringLiteral("/olmsessions.json") };
+ QFile file { static_cast<Connection *>(q->parent())->e2eeDataDir() % "/olmsessions.json" };
if(!file.exists() || !file.open(QIODevice::ReadOnly)) {
qCDebug(E2EE) << "No sessions cache exists.";
return;
diff --git a/lib/jobs/downloadfilejob.cpp b/lib/jobs/downloadfilejob.cpp
index 2fba1973..0b4cf6d2 100644
--- a/lib/jobs/downloadfilejob.cpp
+++ b/lib/jobs/downloadfilejob.cpp
@@ -49,7 +49,7 @@ DownloadFileJob::DownloadFileJob(const QString& serverName,
#ifdef Quotient_E2EE_ENABLED
DownloadFileJob::DownloadFileJob(const QString& serverName,
const QString& mediaId,
- const EncryptedFile file,
+ const EncryptedFile& file,
const QString& localFilename)
: GetContentJob(serverName, mediaId)
, d(localFilename.isEmpty() ? new Private : new Private(localFilename))
diff --git a/lib/jobs/downloadfilejob.h b/lib/jobs/downloadfilejob.h
index 67a3e95f..90d80478 100644
--- a/lib/jobs/downloadfilejob.h
+++ b/lib/jobs/downloadfilejob.h
@@ -16,7 +16,7 @@ public:
const QString& localFilename = {});
#ifdef Quotient_E2EE_ENABLED
- DownloadFileJob(const QString& serverName, const QString& mediaId, const EncryptedFile file, const QString& localFilename = {});
+ DownloadFileJob(const QString& serverName, const QString& mediaId, const EncryptedFile& file, const QString& localFilename = {});
#endif
QString targetFileName() const;
diff --git a/lib/mxcreply.cpp b/lib/mxcreply.cpp
index 639c1324..2ad49c2c 100644
--- a/lib/mxcreply.cpp
+++ b/lib/mxcreply.cpp
@@ -3,8 +3,7 @@
#include "mxcreply.h"
-#include <algorithm>
-#include <QBuffer>
+#include <QtCore/QBuffer>
#include "accountregistry.h"
#include "connection.h"
#include "room.h"
diff --git a/lib/room.cpp b/lib/room.cpp
index 65ce82ac..fca1912f 100644
--- a/lib/room.cpp
+++ b/lib/room.cpp
@@ -456,7 +456,7 @@ public:
return false;
}
qCWarning(E2EE) << "Adding inbound session";
- groupSessions[qMakePair(senderKey, sessionId)] = std::move(megolmSession);
+ groupSessions[{senderKey, sessionId}] = std::move(megolmSession);
saveMegOlmSessions();
return true;
}
@@ -469,13 +469,14 @@ public:
{
QPair<QString, QString> senderSessionPairKey =
qMakePair(senderKey, sessionId);
- if (groupSessions.find(senderSessionPairKey) == groupSessions.end()) {
+ auto groupSessionIt = groupSessions.find(senderSessionPairKey);
+ if (groupSessionIt == groupSessions.end()) {
qCWarning(E2EE) << "Unable to decrypt event" << eventId
<< "The sender's device has not sent us the keys for "
"this message";
return QString();
}
- auto& senderSession = groupSessions[senderSessionPairKey];
+ auto& senderSession = *groupSessionIt;
auto decryptResult = senderSession->decrypt(cipher);
if(std::holds_alternative<QOlmError>(decryptResult)) {
qCWarning(E2EE) << "Unable to decrypt event" << eventId
@@ -520,8 +521,6 @@ Room::Room(Connection* connection, QString id, JoinState initialJoinState)
emit baseStateLoaded();
return this == r; // loadedRoomState fires only once per room
});
- qCDebug(STATE) << "New" << initialJoinState << "Room:" << id;
-
#ifdef Quotient_E2EE_ENABLED
connectSingleShot(this, &Room::encryption, this, [=](){
connection->encryptionUpdate(this);
@@ -1555,7 +1554,7 @@ RoomEventPtr Room::decryptMessage(const EncryptedEvent& encryptedEvent)
qCWarning(E2EE) << "Encrypted message is empty";
return {};
}
- QJsonObject eventObject = QJsonDocument::fromJson(decrypted.toUtf8()).object();
+ auto eventObject = QJsonDocument::fromJson(decrypted.toUtf8()).object();
eventObject["event_id"] = encryptedEvent.id();
eventObject["sender"] = encryptedEvent.senderId();
eventObject["origin_server_ts"] = encryptedEvent.originTimestamp().toMSecsSinceEpoch();