aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-11-18 15:21:53 +0100
committerdec05eba <dec05eba@protonmail.com>2020-11-18 15:21:53 +0100
commitff1390601c8b7b4fbec87f3f23a76495118eff91 (patch)
treec0c18787339b3185458ca2e66efd4aab4ec178ff /plugins
parente7f82bda1534880bf4c6695b9f074241dfc56ac3 (diff)
Matrix: attempt to fix fetching of previous messages before sync is finished
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Matrix.hpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp
index e60889f..e6a35e2 100644
--- a/plugins/Matrix.hpp
+++ b/plugins/Matrix.hpp
@@ -63,6 +63,7 @@ namespace QuickMedia {
sf::Vector2i thumbnail_size; // Set to {0, 0} if not specified
RelatedEventType related_event_type = RelatedEventType::NONE;
bool mentions_me = false;
+ bool cache = false;
time_t timestamp = 0; // In milliseconds
MessageType type;
};
@@ -81,10 +82,10 @@ namespace QuickMedia {
void set_user_display_name(std::shared_ptr<UserInfo> &user, std::string display_name);
void set_user_avatar_url(std::shared_ptr<UserInfo> &user, std::string avatar_url);
- // Ignores duplicates
- void prepend_messages_reverse(const std::vector<std::shared_ptr<Message>> &new_messages);
- // Ignores duplicates
- void append_messages(const std::vector<std::shared_ptr<Message>> &new_messages);
+ // Ignores duplicates, returns the number of added messages
+ size_t prepend_messages_reverse(const std::vector<std::shared_ptr<Message>> &new_messages);
+ // Ignores duplicates, returns the number of added messages
+ size_t append_messages(const std::vector<std::shared_ptr<Message>> &new_messages);
std::shared_ptr<Message> get_message_by_id(const std::string &id);
@@ -483,11 +484,12 @@ namespace QuickMedia {
PluginResult parse_notifications(const rapidjson::Value &notifications_json);
PluginResult parse_sync_account_data(const rapidjson::Value &account_data_json, std::optional<std::set<std::string>> &dm_rooms);
PluginResult parse_sync_room_data(const rapidjson::Value &rooms_json, bool is_additional_messages_sync);
- PluginResult get_previous_room_messages(RoomData *room_data, bool latest_messages);
+ PluginResult get_previous_room_messages(RoomData *room_data, bool latest_messages, size_t &num_new_messages);
void events_add_user_info(const rapidjson::Value &events_json, RoomData *room_data);
std::shared_ptr<UserInfo> parse_user_info(const rapidjson::Value &json, const std::string &user_id, RoomData *room_data);
void events_set_user_read_marker(const rapidjson::Value &events_json, RoomData *room_data, std::shared_ptr<UserInfo> &me);
- void events_add_messages(const rapidjson::Value &events_json, RoomData *room_data, MessageDirection message_dir, bool has_unread_notifications);
+ // Returns the number of messages added
+ size_t events_add_messages(const rapidjson::Value &events_json, RoomData *room_data, MessageDirection message_dir, bool has_unread_notifications);
void events_set_room_name(const rapidjson::Value &events_json, RoomData *room_data);
void set_room_name_to_users_if_empty(RoomData *room, const std::string &room_creator_user_id);
void events_add_pinned_events(const rapidjson::Value &events_json, RoomData *room_data);