[network/ruqola] src/core/localdatabase: Add E2E rooms database
Laurent Montel <[email protected]> Tue, 4 Aug 2026 17:42:18 +0000 (UTC)
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 426ae17dbc84ccc1d29fd6a7be26273633dd86f7 by Laurent Montel.
Committed on 04/08/2026 at 17:41.
Pushed by mlaurent into branch 'master'.
Add E2E rooms database
M +4 -1 src/core/localdatabase/autotests/localdatabaseutilstest.cpp
M +2 -0 src/core/localdatabase/e2edatabase.cpp
M +2 -0 src/core/localdatabase/e2edatabase.h
M +7 -0 src/core/localdatabase/localdatabaseutils.cpp
M +2 -0 src/core/localdatabase/localdatabaseutils.h
https://invent.kde.org/network/ruqola/-/commit/426ae17dbc84ccc1d29fd6a7be26273633dd86f7
diff --git a/src/core/localdatabase/autotests/localdatabaseutilstest.cpp b/src/core/localdatabase/autotests/localdatabaseutilstest.cpp
index c0b8d07b6b..26945ec3b1 100644
--- a/src/core/localdatabase/autotests/localdatabaseutilstest.cpp
+++ b/src/core/localdatabase/autotests/localdatabaseutilstest.cpp
@@ -5,13 +5,13 @@
*/
#include "localdatabaseutilstest.h"
-using namespace Qt::Literals::StringLiterals;
#include "localdatabase/localdatabaseutils.h"
#include <QStandardPaths>
#include <QTest>
QTEST_GUILESS_MAIN(LocalDatabaseUtilsTest)
+using namespace Qt::Literals::StringLiterals;
LocalDatabaseUtilsTest::LocalDatabaseUtilsTest(QObject *parent)
: QObject{parent}
{
@@ -34,6 +34,7 @@ void LocalDatabaseUtilsTest::shouldCheckPath()
QCOMPARE(LocalDatabaseUtils::databasePath(LocalDatabaseUtils::DatabasePath::Accounts), u"account/"_s);
QCOMPARE(LocalDatabaseUtils::databasePath(LocalDatabaseUtils::DatabasePath::Global), u"global/"_s);
QCOMPARE(LocalDatabaseUtils::databasePath(LocalDatabaseUtils::DatabasePath::E2E), u"e2e/"_s);
+ QCOMPARE(LocalDatabaseUtils::databasePath(LocalDatabaseUtils::DatabasePath::E2ERooms), u"e2e-rooms/"_s);
QCOMPARE(LocalDatabaseUtils::databasePath(LocalDatabaseUtils::DatabasePath::RoomPendingTypedInfo), u"roompendingtypedinfo/"_s);
QCOMPARE(LocalDatabaseUtils::databasePath(LocalDatabaseUtils::DatabasePath::RoomSubscriptions), u"roomsubscriptions/"_s);
}
@@ -46,6 +47,8 @@ void LocalDatabaseUtilsTest::shouldCheckDataPathPath()
QCOMPARE(LocalDatabaseUtils::localAccountsDatabasePath(), QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + u"/database/account/"_s);
QCOMPARE(LocalDatabaseUtils::localGlobalDatabasePath(), QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + u"/database/global/"_s);
QCOMPARE(LocalDatabaseUtils::localE2EDatabasePath(), QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + u"/database/e2e/"_s);
+ QCOMPARE(LocalDatabaseUtils::localE2ERoomsDatabasePath(),
+ QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + u"/database/e2e-rooms/"_s);
QCOMPARE(LocalDatabaseUtils::localRoomPendingTypedInfoDatabasePath(),
QStandardPaths::writableLocation(QStandardPaths::AppLocalDataLocation) + u"/database/roompendingtypedinfo/"_s);
QCOMPARE(LocalDatabaseUtils::localRoomSubscriptionsDatabasePath(),
diff --git a/src/core/localdatabase/e2edatabase.cpp b/src/core/localdatabase/e2edatabase.cpp
index 71f1effd53..5b4eb832fe 100644
--- a/src/core/localdatabase/e2edatabase.cpp
+++ b/src/core/localdatabase/e2edatabase.cpp
@@ -1,5 +1,7 @@
/*
SPDX-FileCopyrightText: 2025 Andro Ranogajec <[email protected]>
+ SPDX-FileCopyrightText: 2026 Laurent Montel <[email protected]>
+
SPDX-License-Identifier: LGPL-2.0-or-later
*/
diff --git a/src/core/localdatabase/e2edatabase.h b/src/core/localdatabase/e2edatabase.h
index 4144c935b4..4029c192f8 100644
--- a/src/core/localdatabase/e2edatabase.h
+++ b/src/core/localdatabase/e2edatabase.h
@@ -1,5 +1,7 @@
/*
SPDX-FileCopyrightText: 2025 Andro Ranogajec <[email protected]>
+ SPDX-FileCopyrightText: 2026 Laurent Montel <[email protected]>
+
SPDX-License-Identifier: LGPL-2.0-or-later
*/
diff --git a/src/core/localdatabase/localdatabaseutils.cpp b/src/core/localdatabase/localdatabaseutils.cpp
index af29b75b29..c4450606ff 100644
--- a/src/core/localdatabase/localdatabaseutils.cpp
+++ b/src/core/localdatabase/localdatabaseutils.cpp
@@ -62,6 +62,11 @@ QString LocalDatabaseUtils::localRoomSubscriptionsDatabasePath()
return LocalDatabaseUtils::localDatabasePath() + LocalDatabaseUtils::databasePath(LocalDatabaseUtils::DatabasePath::RoomSubscriptions);
}
+QString LocalDatabaseUtils::localE2ERoomsDatabasePath()
+{
+ return LocalDatabaseUtils::localDatabasePath() + LocalDatabaseUtils::databasePath(LocalDatabaseUtils::DatabasePath::E2ERooms);
+}
+
QString LocalDatabaseUtils::databasePath(LocalDatabaseUtils::DatabasePath pathType)
{
switch (pathType) {
@@ -75,6 +80,8 @@ QString LocalDatabaseUtils::databasePath(LocalDatabaseUtils::DatabasePath pathTy
return u"global/"_s;
case LocalDatabaseUtils::DatabasePath::E2E:
return u"e2e/"_s;
+ case LocalDatabaseUtils::DatabasePath::E2ERooms:
+ return u"e2e-rooms/"_s;
case LocalDatabaseUtils::DatabasePath::RoomPendingTypedInfo:
return u"roompendingtypedinfo/"_s;
case LocalDatabaseUtils::DatabasePath::RoomSubscriptions:
diff --git a/src/core/localdatabase/localdatabaseutils.h b/src/core/localdatabase/localdatabaseutils.h
index 43ff27169c..e0fa0e0321 100644
--- a/src/core/localdatabase/localdatabaseutils.h
+++ b/src/core/localdatabase/localdatabaseutils.h
@@ -16,6 +16,7 @@ enum class DatabasePath : uint8_t {
Accounts,
Global,
E2E,
+ E2ERooms,
RoomPendingTypedInfo,
RoomSubscriptions,
};
@@ -28,6 +29,7 @@ enum class DatabasePath : uint8_t {
[[nodiscard]] LIBRUQOLACORE_EXPORT QString localAccountsDatabasePath();
[[nodiscard]] LIBRUQOLACORE_EXPORT QString localGlobalDatabasePath();
[[nodiscard]] LIBRUQOLACORE_EXPORT QString localE2EDatabasePath();
+[[nodiscard]] LIBRUQOLACORE_EXPORT QString localE2ERoomsDatabasePath();
[[nodiscard]] LIBRUQOLACORE_EXPORT QString localRoomPendingTypedInfoDatabasePath();
[[nodiscard]] LIBRUQOLACORE_EXPORT QString localRoomSubscriptionsDatabasePath();
[[nodiscard]] LIBRUQOLACORE_EXPORT QString databasePath(LocalDatabaseUtils::DatabasePath pathType);