aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-09-25 04:15:17 +0200
committerdec05eba <dec05eba@protonmail.com>2020-09-25 04:15:17 +0200
commiteac2ace1c14c1ae0564d757b26a359c6bd4b754a (patch)
tree855b98a19b6a302663a2d26e3ed6ca69110d1ce0 /plugins
parent6cb237cfba67e1a15d475dccfb706bcc179afe71 (diff)
Matrix: fetch previous messages when reaching the top
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Matrix.hpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/plugins/Matrix.hpp b/plugins/Matrix.hpp
index 607ef81..396fc17 100644
--- a/plugins/Matrix.hpp
+++ b/plugins/Matrix.hpp
@@ -43,6 +43,7 @@ namespace QuickMedia {
std::string avatar_url;
std::string prev_batch;
bool initial_fetch_finished = false;
+ size_t last_read_index = 0;
};
enum class MessageDirection {
@@ -62,9 +63,9 @@ namespace QuickMedia {
PluginResult get_cached_sync(BodyItems &result_items);
PluginResult sync();
PluginResult get_joined_rooms(BodyItems &result_items);
- // Note: the number of items returned in |result_items| may not be the number of new messages because many messages can be combined
- // into one if one user sends multiple messages. The number of messages is returned in |num_new_messages|.
- PluginResult get_room_messages(const std::string &room_id, size_t start_index, BodyItems &result_items, size_t &num_new_messages);
+ 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);
+ PluginResult get_previous_room_messages(const std::string &room_id, BodyItems &result_items);
SearchResult search(const std::string &text, BodyItems &result_items) override;
// |url| should only be set when uploading media.
@@ -76,7 +77,7 @@ namespace QuickMedia {
PluginResult load_and_verify_cached_session();
private:
PluginResult sync_response_to_body_items(const Json::Value &root);
- PluginResult load_initial_room_data(const std::string &room_id, RoomData *room_data);
+ 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_set_room_name(const Json::Value &events_json, RoomData *room_data);