diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-10-01 11:03:30 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-10-01 11:03:30 +0200 |
commit | cb60c5304db0b25d6ce2460fded4cd42a1dcf0dc (patch) | |
tree | 6889b66b45838063ccd662be251b1aa749a262ea /plugins | |
parent | ae02ed04389117d100070c47f3ae69abb9080231 (diff) |
Matrix: show indication for unread messages and show the last message in the rooms list
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/Matrix.hpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp index fdd3392..7df29e1 100644 --- a/plugins/Matrix.hpp +++ b/plugins/Matrix.hpp @@ -57,6 +57,8 @@ namespace QuickMedia { AFTER }; + using RoomSyncMessages = std::unordered_map<RoomData*, std::vector<std::shared_ptr<Message>>>; + class Matrix : public Plugin { public: Matrix(); @@ -68,7 +70,7 @@ namespace QuickMedia { bool search_suggestion_is_search() const override { return true; } Page get_page_after_search() const override { return Page::EXIT; } PluginResult get_cached_sync(BodyItems &result_items); - PluginResult sync(); + PluginResult sync(RoomSyncMessages &room_messages); PluginResult get_joined_rooms(BodyItems &result_items); PluginResult get_all_synced_room_messages(const std::string &room_id, BodyItems &result_items); PluginResult get_new_room_messages(const std::string &room_id, BodyItems &result_items); @@ -98,11 +100,13 @@ namespace QuickMedia { // |message| is from |BodyItem.userdata| and is of type |Message*| bool was_message_posted_by_me(const std::string &room_id, void *message) const; + + std::string message_get_author_displayname(RoomData *room_data, Message *message) const; private: - PluginResult sync_response_to_body_items(const Json::Value &root); + PluginResult sync_response_to_body_items(const Json::Value &root, RoomSyncMessages &room_messages); PluginResult get_previous_room_messages(const std::string &room_id, RoomData *room_data); void events_add_user_info(const Json::Value &events_json, RoomData *room_data); - void events_add_messages(const Json::Value &events_json, RoomData *room_data, MessageDirection message_dir); + void events_add_messages(const Json::Value &events_json, RoomData *room_data, MessageDirection message_dir, RoomSyncMessages *room_messages); void events_set_room_name(const Json::Value &events_json, RoomData *room_data); std::shared_ptr<Message> get_edited_message_original_message(RoomData *room_data, std::shared_ptr<Message> message); |