aboutsummaryrefslogtreecommitdiff
path: root/lib/database.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-05-31 19:16:23 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-05-31 19:16:23 +0200
commitec75d2d0e9601dcf32387120ca67135ac7e7f472 (patch)
tree146484ece089a8293dc30505b0c2380374e5fac7 /lib/database.h
parent945b1ab33c92b7b13e2c6b6ebc1f56c5caee0f79 (diff)
parenta7c43995c3a47bbbac8d862f69f9229eb39f4ed6 (diff)
downloadlibquotient-ec75d2d0e9601dcf32387120ca67135ac7e7f472.tar.gz
libquotient-ec75d2d0e9601dcf32387120ca67135ac7e7f472.zip
Merge branch 'dev' into update-api-update
Diffstat (limited to 'lib/database.h')
-rw-r--r--lib/database.h42
1 files changed, 30 insertions, 12 deletions
diff --git a/lib/database.h b/lib/database.h
index 45348c8d..4091d61b 100644
--- a/lib/database.h
+++ b/lib/database.h
@@ -32,22 +32,40 @@ public:
QByteArray accountPickle();
void setAccountPickle(const QByteArray &pickle);
void clear();
- void saveOlmSession(const QString& senderKey, const QString& sessionId, const QByteArray& pickle, const QDateTime& timestamp);
- UnorderedMap<QString, std::vector<QOlmSessionPtr>> loadOlmSessions(const PicklingMode& picklingMode);
- UnorderedMap<QString, QOlmInboundGroupSessionPtr> loadMegolmSessions(const QString& roomId, const PicklingMode& picklingMode);
- void saveMegolmSession(const QString& roomId, const QString& sessionId, const QByteArray& pickle, const QString& senderId, const QString& olmSessionId);
- void addGroupSessionIndexRecord(const QString& roomId, const QString& sessionId, uint32_t index, const QString& eventId, qint64 ts);
- std::pair<QString, qint64> groupSessionIndexRecord(const QString& roomId, const QString& sessionId, qint64 index);
+ void saveOlmSession(const QString& senderKey, const QString& sessionId,
+ const QByteArray& pickle, const QDateTime& timestamp);
+ UnorderedMap<QString, std::vector<QOlmSessionPtr>> loadOlmSessions(
+ const PicklingMode& picklingMode);
+ UnorderedMap<QString, QOlmInboundGroupSessionPtr> loadMegolmSessions(
+ const QString& roomId, const PicklingMode& picklingMode);
+ void saveMegolmSession(const QString& roomId, const QString& sessionId,
+ const QByteArray& pickle, const QString& senderId,
+ const QString& olmSessionId);
+ void addGroupSessionIndexRecord(const QString& roomId,
+ const QString& sessionId, uint32_t index,
+ const QString& eventId, qint64 ts);
+ std::pair<QString, qint64> groupSessionIndexRecord(const QString& roomId,
+ const QString& sessionId,
+ qint64 index);
void clearRoomData(const QString& roomId);
- void setOlmSessionLastReceived(const QString& sessionId, const QDateTime& timestamp);
- QOlmOutboundGroupSessionPtr loadCurrentOutboundMegolmSession(const QString& roomId, const PicklingMode& picklingMode);
- void saveCurrentOutboundMegolmSession(const QString& roomId, const PicklingMode& picklingMode, const QOlmOutboundGroupSessionPtr& data);
- void updateOlmSession(const QString& senderKey, const QString& sessionId, const QByteArray& pickle);
+ void setOlmSessionLastReceived(const QString& sessionId,
+ const QDateTime& timestamp);
+ QOlmOutboundGroupSessionPtr loadCurrentOutboundMegolmSession(
+ const QString& roomId, const PicklingMode& picklingMode);
+ void saveCurrentOutboundMegolmSession(
+ const QString& roomId, const PicklingMode& picklingMode,
+ const QOlmOutboundGroupSession& session);
+ void updateOlmSession(const QString& senderKey, const QString& sessionId,
+ const QByteArray& pickle);
// Returns a map UserId -> [DeviceId] that have not received key yet
- QHash<QString, QStringList> devicesWithoutKey(const QString& roomId, QHash<QString, QStringList>& devices, const QString &sessionId);
+ QMultiHash<QString, QString> devicesWithoutKey(const QString& roomId, QMultiHash<QString, QString> devices,
+ const QString& sessionId);
// 'devices' contains tuples {userId, deviceId, curveKey}
- void setDevicesReceivedKey(const QString& roomId, const QVector<std::tuple<QString, QString, QString>>& devices, const QString& sessionId, int index);
+ void setDevicesReceivedKey(
+ const QString& roomId,
+ const QVector<std::tuple<QString, QString, QString>>& devices,
+ const QString& sessionId, int index);
private:
void migrateTo1();