diff options
author | Tobias Fella <fella@posteo.de> | 2022-02-12 12:12:24 +0100 |
---|---|---|
committer | Tobias Fella <fella@posteo.de> | 2022-02-12 12:12:24 +0100 |
commit | b0aef4af9cbf00755c7b70c71d77f0bf7ce0d200 (patch) | |
tree | a583f1b70e15568ebe784b6d6c6bdd3ea7dcbed5 | |
parent | 148bb1256fb15c73c605c5301da2b9602f859660 (diff) | |
download | libquotient-b0aef4af9cbf00755c7b70c71d77f0bf7ce0d200.tar.gz libquotient-b0aef4af9cbf00755c7b70c71d77f0bf7ce0d200.zip |
Replace QPair with std::pair
-rw-r--r-- | lib/connection.cpp | 2 | ||||
-rw-r--r-- | lib/connection.h | 2 | ||||
-rw-r--r-- | lib/database.cpp | 6 | ||||
-rw-r--r-- | lib/database.h | 4 | ||||
-rw-r--r-- | lib/room.cpp | 4 |
5 files changed, 9 insertions, 9 deletions
diff --git a/lib/connection.cpp b/lib/connection.cpp index cc5d8739..a8de4030 100644 --- a/lib/connection.cpp +++ b/lib/connection.cpp @@ -2122,7 +2122,7 @@ Database* Connection::database() return d->database; } -UnorderedMap<QPair<QString, QString>, QOlmInboundGroupSessionPtr> Connection::loadRoomMegolmSessions(Room* room) +UnorderedMap<std::pair<QString, QString>, QOlmInboundGroupSessionPtr> Connection::loadRoomMegolmSessions(Room* room) { return database()->loadMegolmSessions(room->id(), picklingMode()); } diff --git a/lib/connection.h b/lib/connection.h index 13aa15c0..28ea6ff3 100644 --- a/lib/connection.h +++ b/lib/connection.h @@ -316,7 +316,7 @@ public: #ifdef Quotient_E2EE_ENABLED QOlmAccount* olmAccount() const; Database* database(); - UnorderedMap<QPair<QString, QString>, QOlmInboundGroupSessionPtr> loadRoomMegolmSessions(Room* room); + UnorderedMap<std::pair<QString, QString>, QOlmInboundGroupSessionPtr> loadRoomMegolmSessions(Room* room); void saveMegolmSession(Room* room, const QString& senderKey, QOlmInboundGroupSession* session); #endif // Quotient_E2EE_ENABLED Q_INVOKABLE Quotient::SyncJob* syncJob() const; diff --git a/lib/database.cpp b/lib/database.cpp index 535920e2..b91b6ef1 100644 --- a/lib/database.cpp +++ b/lib/database.cpp @@ -160,14 +160,14 @@ UnorderedMap<QString, std::vector<QOlmSessionPtr>> Database::loadOlmSessions(con return sessions; } -UnorderedMap<QPair<QString, QString>, QOlmInboundGroupSessionPtr> Database::loadMegolmSessions(const QString& roomId, const PicklingMode& picklingMode) +UnorderedMap<std::pair<QString, QString>, QOlmInboundGroupSessionPtr> Database::loadMegolmSessions(const QString& roomId, const PicklingMode& picklingMode) { auto query = prepareQuery(QStringLiteral("SELECT * FROM inbound_megolm_sessions WHERE roomId=:roomId;")); query.bindValue(":roomId", roomId); transaction(); execute(query); commit(); - UnorderedMap<QPair<QString, QString>, QOlmInboundGroupSessionPtr> sessions; + UnorderedMap<std::pair<QString, QString>, QOlmInboundGroupSessionPtr> sessions; while (query.next()) { auto session = QOlmInboundGroupSession::unpickle(query.value("pickle").toByteArray(), picklingMode); if (std::holds_alternative<QOlmError>(session)) { @@ -204,7 +204,7 @@ void Database::addGroupSessionIndexRecord(const QString& roomId, const QString& commit(); } -QPair<QString, qint64> Database::groupSessionIndexRecord(const QString& roomId, const QString& sessionId, qint64 index) +std::pair<QString, qint64> Database::groupSessionIndexRecord(const QString& roomId, const QString& sessionId, qint64 index) { auto query = prepareQuery(QStringLiteral("SELECT * FROM group_session_record_index WHERE roomId=:roomId AND sessionId=:sessionId AND i=:index;")); query.bindValue(":roomId", roomId); diff --git a/lib/database.h b/lib/database.h index b2187ba4..96256a55 100644 --- a/lib/database.h +++ b/lib/database.h @@ -30,10 +30,10 @@ public: void clear(); void saveOlmSession(const QString& senderKey, const QString& sessionId, const QByteArray &pickle); UnorderedMap<QString, std::vector<QOlmSessionPtr>> loadOlmSessions(const PicklingMode& picklingMode); - UnorderedMap<QPair<QString, QString>, QOlmInboundGroupSessionPtr> loadMegolmSessions(const QString& roomId, const PicklingMode& picklingMode); + UnorderedMap<std::pair<QString, QString>, QOlmInboundGroupSessionPtr> loadMegolmSessions(const QString& roomId, const PicklingMode& picklingMode); void saveMegolmSession(const QString& roomId, const QString& senderKey, const QString& sessionKey, const QByteArray& pickle); void addGroupSessionIndexRecord(const QString& roomId, const QString& sessionId, uint32_t index, const QString& eventId, qint64 ts); - QPair<QString, qint64> groupSessionIndexRecord(const QString& roomId, const QString& sessionId, qint64 index); + std::pair<QString, qint64> groupSessionIndexRecord(const QString& roomId, const QString& sessionId, qint64 index); void clearRoomData(const QString& roomId); private: diff --git a/lib/room.cpp b/lib/room.cpp index 492845d7..0fc7d23e 100644 --- a/lib/room.cpp +++ b/lib/room.cpp @@ -368,7 +368,7 @@ public: #ifdef Quotient_E2EE_ENABLED // A map from (senderKey, sessionId) to InboundGroupSession - UnorderedMap<QPair<QString, QString>, QOlmInboundGroupSessionPtr> groupSessions; + UnorderedMap<std::pair<QString, QString>, QOlmInboundGroupSessionPtr> groupSessions; bool addInboundGroupSession(QString senderKey, QString sessionId, QString sessionKey) @@ -397,7 +397,7 @@ public: const QString& eventId, QDateTime timestamp) { - const auto senderSessionPairKey = qMakePair(senderKey, sessionId); + const auto senderSessionPairKey = make_pair(senderKey, sessionId); auto groupSessionIt = groupSessions.find(senderSessionPairKey); if (groupSessionIt == groupSessions.end()) { // qCWarning(E2EE) << "Unable to decrypt event" << eventId |