aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--TODO3
-rw-r--r--src/plugins/Matrix.cpp17
2 files changed, 14 insertions, 6 deletions
diff --git a/TODO b/TODO
index c5e74d2..e4b0f2b 100644
--- a/TODO
+++ b/TODO
@@ -141,4 +141,5 @@ Show reactions in pinned messages tab?
Remove display names from reactions if there are many reactions, and instead group them into: reaction (#number of this type of reaction); for example: 👍 2.
Make reaction and deleted message provisional.
Allow removing reactions.
-When fetching previous messages in matrix, fetching until there are 0 messages or until there is at least 1 visible item. This is needed because right now we could fetch 10 messages, all which are delete/edit/react and it will look like there are no more messages to fetch to the user. \ No newline at end of file
+When fetching previous messages in matrix, fetching until there are 0 messages or until there is at least 1 visible item. This is needed because right now we could fetch 10 messages, all which are delete/edit/react and it will look like there are no more messages to fetch to the user.
+QuickMedia crashes if you enter a room that you have left before. This could happen if cache is loaded that has a room that is then getting removed when sync is finished. \ No newline at end of file
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index 291787f..653569d 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -456,8 +456,12 @@ namespace QuickMedia {
static std::string message_to_room_description_text(Message *message) {
if(message->type == MessageType::REACTION)
return "Reacted with: " + extract_first_line_elipses(message->body, 150);
+ else if(message->related_event_type == RelatedEventType::REPLY)
+ return extract_first_line_elipses(remove_reply_formatting(message->body), 150);
+ else if(message->related_event_type == RelatedEventType::EDIT)
+ return "Edited: " + extract_first_line_elipses(message->body, 150);
else
- return extract_first_line_elipses(message_get_body_remove_formatting(message), 150);
+ return extract_first_line_elipses(message->body, 150);
}
void MatrixQuickMedia::update_room_description(RoomData *room, Messages &new_messages, bool is_initial_sync, bool sync_is_cache) {
@@ -1496,16 +1500,19 @@ namespace QuickMedia {
if(!type_json.IsString() || strcmp(type_json.GetString(), "m.room.member") != 0)
continue;
- const rapidjson::Value &sender_json = GetMember(event_item_json, "sender");
- if(!sender_json.IsString())
+ const rapidjson::Value *sender_json = &GetMember(event_item_json, "sender");
+ if(!sender_json->IsString())
continue;
+
+ const rapidjson::Value *state_key_json = &GetMember(event_item_json, "state_key");
+ if(state_key_json->IsString() && state_key_json->GetStringLength() != 0)
+ sender_json = state_key_json;
const rapidjson::Value &content_json = GetMember(event_item_json, "content");
if(!content_json.IsObject())
continue;
- std::string sender_json_str = sender_json.GetString();
- parse_user_info(content_json, sender_json_str, room_data);
+ parse_user_info(content_json, sender_json->GetString(), room_data);
}
}