summary refs log tree commit diff
path: root/src/Cache.h
diff options
context:
space:
mode:
authorJoe <rubberduckie3554@gmail.com>2019-11-02 00:27:54 -0400
committerJoe <rubberduckie3554@gmail.com>2019-11-02 00:27:54 -0400
commit35759d2c6cbc86bd6a5df2c96de5d2dd078742ec (patch)
treee97c5aafb4488755d617bdad2e5f969fe94386f0 /src/Cache.h
parentUpdate README with translation information (diff)
parentFix boost build in FreeBSD (diff)
downloadnheko-35759d2c6cbc86bd6a5df2c96de5d2dd078742ec.tar.xz
Merge branch '0.7.0-dev' of https://github.com/Nheko-Reborn/nheko into 0.7.0-dev
Diffstat (limited to 'src/Cache.h')
-rw-r--r--src/Cache.h21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/Cache.h b/src/Cache.h

index 65c5263d..0da49793 100644 --- a/src/Cache.h +++ b/src/Cache.h
@@ -32,6 +32,7 @@ #include <nlohmann/json.hpp> #include "Logging.h" +#include "MatrixClient.h" using mtx::events::state::JoinRule; @@ -152,7 +153,6 @@ struct RoomSearchResult { std::string room_id; RoomInfo info; - QImage img; }; Q_DECLARE_METATYPE(RoomSearchResult) @@ -323,6 +323,8 @@ public: std::map<QString, mtx::responses::Timeline> roomMessages(); + QMap<QString, mtx::responses::Notifications> getTimelineMentions(); + //! Retrieve all the user ids from a room. std::vector<std::string> roomMembers(const std::string &room_id); @@ -402,6 +404,9 @@ public: //! Check if we have sent a desktop notification for the given event id. bool isNotificationSent(const std::string &event_id); + //! Add all notifications containing a user mention to the db. + void saveTimelineMentions(const mtx::responses::Notifications &res); + //! Remove old unused data. void deleteOldMessages(); void deleteOldData() noexcept; @@ -470,6 +475,15 @@ private: lmdb::dbi &membersdb, const mtx::responses::InvitedRoom &room); + //! Add a notification containing a user mention to the db. + void saveTimelineMentions(lmdb::txn &txn, + const std::string &room_id, + const QList<mtx::responses::Notification> &res); + + //! Get timeline items that a user was mentions in for a given room + mtx::responses::Notifications getTimelineMentionsForRoom(lmdb::txn &txn, + const std::string &room_id); + QString getInviteRoomName(lmdb::txn &txn, lmdb::dbi &statesdb, lmdb::dbi &membersdb); QString getInviteRoomTopic(lmdb::txn &txn, lmdb::dbi &statesdb); QString getInviteRoomAvatarUrl(lmdb::txn &txn, lmdb::dbi &statesdb, lmdb::dbi &membersdb); @@ -660,6 +674,11 @@ private: return lmdb::dbi::open(txn, std::string(room_id + "/members").c_str(), MDB_CREATE); } + lmdb::dbi getMentionsDb(lmdb::txn &txn, const std::string &room_id) + { + return lmdb::dbi::open(txn, std::string(room_id + "/mentions").c_str(), MDB_CREATE); + } + //! Retrieves or creates the database that stores the open OLM sessions between our device //! and the given curve25519 key which represents another device. //!