aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/Matrix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/Matrix.cpp')
-rw-r--r--src/plugins/Matrix.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 2736421..6d0e095 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -20,7 +20,7 @@
static const char* SERVICE_NAME = "matrix";
static const char* OTHERS_ROOM_TAG = "tld.name.others";
-static const char* FILTER = "{\"presence\":{\"limit\":0,\"types\":[\"\"]},\"account_data\":{\"limit\":0,\"types\":[\"\"]},\"room\":{\"state\":{\"not_types\":[\"m.room.related_groups\",\"m.room.power_levels\",\"m.room.join_rules\",\"m.room.history_visibility\"],\"lazy_load_members\":true},\"timeline\":{\"limit\":3,\"lazy_load_members\":true},\"ephemeral\":{\"limit\":0,\"types\":[\"\"],\"lazy_load_members\":true},\"account_data\":{\"limit\":1,\"types\":[\"m.fully_read\",\"m.tag\"],\"lazy_load_members\":true}}}";
+static const char* FILTER = "{\"presence\":{\"limit\":0,\"types\":[\"\"]},\"account_data\":{\"limit\":0,\"types\":[\"\"]},\"room\":{\"state\":{\"not_types\":[\"m.room.related_groups\",\"m.room.power_levels\",\"m.room.join_rules\",\"m.room.history_visibility\"],\"lazy_load_members\":true},\"timeline\":{\"limit\":1,\"lazy_load_members\":true},\"ephemeral\":{\"limit\":0,\"types\":[\"\"],\"lazy_load_members\":true},\"account_data\":{\"limit\":1,\"types\":[\"m.fully_read\",\"m.tag\"],\"lazy_load_members\":true}}}";
static rapidjson::Value nullValue(rapidjson::kNullType);
static const rapidjson::Value& GetMember(const rapidjson::Value &obj, const char *key) {
@@ -1021,11 +1021,11 @@ namespace QuickMedia {
room->release_room_lock();
}
- PluginResult Matrix::get_previous_room_messages(RoomData *room, Messages &messages) {
+ PluginResult Matrix::get_previous_room_messages(RoomData *room, Messages &messages, bool latest_messages) {
room->acquire_room_lock();
size_t num_messages_before = room->get_messages_thread_unsafe().size();
room->release_room_lock();
- PluginResult result = get_previous_room_messages(room);
+ PluginResult result = get_previous_room_messages(room, latest_messages);
if(result != PluginResult::OK)
return result;
@@ -2150,9 +2150,11 @@ namespace QuickMedia {
}
}
- PluginResult Matrix::get_previous_room_messages(RoomData *room_data) {
+ PluginResult Matrix::get_previous_room_messages(RoomData *room_data, bool latest_messages) {
std::string from = room_data->get_prev_batch();
- if(from.empty()) {
+ if(latest_messages)
+ from = "END";
+ else if(from.empty()) {
fprintf(stderr, "Info: missing previous batch for room: %s, using /sync next batch\n", room_data->id.c_str());
// TODO: When caching /sync, remember to add lock around getting next_batch!
from = get_next_batch();