diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-11-13 22:25:03 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-11-13 22:25:03 +0100 |
commit | a98911daeb80ab8028dfd425d07d19471e936448 (patch) | |
tree | 18196ac23e86b8166e39b691a5adf76c1ff98c6a /src/plugins | |
parent | aea90e2c43d6dbf8b8276e1209f4d4abe1cea128 (diff) |
Matrix: allow pinning a message if no message has ever been pinned before in the room, fix get_previous_message spam when reaching top sometimes, fit card view cutting off bottom text (description)
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Matrix.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 6e6264f..75e293a 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -3719,7 +3719,7 @@ namespace QuickMedia { const rapidjson::Value &end_json = GetMember(json_root, "end"); if(!end_json.IsString()) { - room_data->set_prev_batch("invalid"); + room_data->set_prev_batch(""); fprintf(stderr, "Warning: matrix messages response is missing 'end', this could happen if we received the very first messages in the room\n"); if(reached_end) *reached_end = true; @@ -4970,7 +4970,12 @@ namespace QuickMedia { } const rapidjson::Value &errcode_json = GetMember(json_root, "errcode"); - if(errcode_json.IsString() && strcmp(errcode_json.GetString(), "M_NOT_FOUND") != 0) { + if(errcode_json.IsString()) { + // This is the case if the room has never set pinned events. + // After a pinned event has added and then removed so the list is empty then an empty list is returned instead. + if(strcmp(errcode_json.GetString(), "M_NOT_FOUND") == 0) + return PluginResult::OK; + const rapidjson::Value &error_json = GetMember(json_root, "error"); if(error_json.IsString()) { show_notification("QuickMedia", "Failed to get pinned events for room " + room->id + ", error: " + std::string(error_json.GetString(), error_json.GetStringLength()), Urgency::CRITICAL); |