aboutsummaryrefslogtreecommitdiff
path: root/lib/connection.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-08-25 19:28:10 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-08-25 19:48:33 +0200
commit1c94d1b41eb352b31b2dc915fea95e26f6138284 (patch)
treeac3aa4c3b067fe1d004cad3f35443047ea961a0a /lib/connection.h
parent82f4efb0227e7e22e831733fae3952818b063ac2 (diff)
downloadlibquotient-1c94d1b41eb352b31b2dc915fea95e26f6138284.tar.gz
libquotient-1c94d1b41eb352b31b2dc915fea95e26f6138284.zip
KeyVerificationSession: cleanup
- Use std::chrono for the timeout (it's more readable and less ambiguous) and make it a local variable - Only pass a Connection object once to constructors - Ensure buildability even without E2EE (key verification is disabled in that case) - Reorder #includes - Other cleanup following clang-tidy warnings
Diffstat (limited to 'lib/connection.h')
-rw-r--r--lib/connection.h21
1 files changed, 12 insertions, 9 deletions
diff --git a/lib/connection.h b/lib/connection.h
index b684d16b..3a4ee798 100644
--- a/lib/connection.h
+++ b/lib/connection.h
@@ -24,10 +24,9 @@
#ifdef Quotient_E2EE_ENABLED
#include "e2ee/e2ee.h"
-#include "e2ee/qolmmessage.h"
#include "e2ee/qolmoutboundsession.h"
-#include "events/keyverificationevent.h"
#include "keyverificationsession.h"
+#include "events/keyverificationevent.h"
#endif
Q_DECLARE_METATYPE(Quotient::GetLoginFlowsJob::LoginFlow)
@@ -332,12 +331,16 @@ public:
void saveCurrentOutboundMegolmSession(
const QString& roomId, const QOlmOutboundGroupSession& session) const;
-
- QString edKeyForUserDevice(const QString& user, const QString& device) const;
+ QString edKeyForUserDevice(const QString& userId,
+ const QString& deviceId) const;
bool hasOlmSession(const QString& user, const QString& deviceId) const;
+ // This assumes that an olm session already exists. If it doesn't, no message is sent.
+ void sendToDevice(const QString& userId, const QString& deviceId,
+ event_ptr_tt<Event> event, bool encrypted);
+
/// Returns true if this megolm session comes from a verified device
- bool isVerifiedSession(const QString& megolmSessionId);
+ bool isVerifiedSession(const QString& megolmSessionId) const;
void sendSessionKeyToDevices(const QString& roomId,
const QByteArray& sessionId,
@@ -528,9 +531,6 @@ public:
/// Saves the olm account data to disk. Usually doesn't need to be called manually.
void saveOlmAccount();
- // This assumes that an olm session already exists. If it doesn't, no message is sent.
- void sendToDevice(const QString& userId, const QString& deviceId, event_ptr_tt<Event> event, bool encrypted);
-
public Q_SLOTS:
/// \brief Set the homeserver base URL and retrieve its login flows
///
@@ -708,9 +708,9 @@ public Q_SLOTS:
/** \deprecated Do not use this directly, use Room::leaveRoom() instead */
virtual LeaveRoomJob* leaveRoom(Room* room);
+#ifdef Quotient_E2EE_ENABLED
void startKeyVerificationSession(const QString& deviceId);
-#ifdef Quotient_E2EE_ENABLED
void encryptionUpdate(Room *room);
#endif
@@ -871,6 +871,8 @@ Q_SIGNALS:
void lazyLoadingChanged();
void turnServersChanged(const QJsonObject& servers);
void devicesListLoaded();
+
+#ifdef Quotient_E2EE_ENABLED
void incomingKeyVerificationReady(const KeyVerificationReadyEvent& event);
void incomingKeyVerificationStart(const KeyVerificationStartEvent& event);
void incomingKeyVerificationAccept(const KeyVerificationAcceptEvent& event);
@@ -881,6 +883,7 @@ Q_SIGNALS:
void newKeyVerificationSession(KeyVerificationSession* session);
void sessionVerified(const QString& userId, const QString& deviceId);
+#endif
protected:
/**