From 6ce1376869dfa560221085edbbfc0ac7cd7ef751 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 18 Nov 2020 02:28:53 +0100 Subject: Matrix: implement m.sticker --- src/plugins/Matrix.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 78ddac7..ee61c23 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -1770,7 +1770,7 @@ namespace QuickMedia { return message; } - if(strcmp(type_json.GetString(), "m.room.message") == 0) { + if(strcmp(type_json.GetString(), "m.room.message") == 0 || strcmp(type_json.GetString(), "m.sticker") == 0) { } else if(strcmp(type_json.GetString(), "m.room.member") == 0) { std::string user_display_name = room_data->get_user_display_name(user); @@ -1866,9 +1866,7 @@ namespace QuickMedia { // TODO: Also show joins, leave, invites, bans, kicks, mutes, etc - if(!content_type.IsString() || strcmp(content_type.GetString(), "m.text") == 0) { - message->type = MessageType::TEXT; - } else if(strcmp(content_type.GetString(), "m.image") == 0) { + if((content_type.IsString() && strcmp(content_type.GetString(), "m.image") == 0) || strcmp(type_json.GetString(), "m.sticker") == 0) { const rapidjson::Value &url_json = GetMember(*content_json, "url"); if(!url_json.IsString() || strncmp(url_json.GetString(), "mxc://", 6) != 0) return nullptr; @@ -1877,6 +1875,8 @@ namespace QuickMedia { message->thumbnail_url = message_content_extract_thumbnail_url(*content_json, homeserver); message_content_extract_thumbnail_size(*content_json, message->thumbnail_size); message->type = MessageType::IMAGE; + } else if(!content_type.IsString() || strcmp(content_type.GetString(), "m.text") == 0) { + message->type = MessageType::TEXT; } else if(strcmp(content_type.GetString(), "m.video") == 0) { const rapidjson::Value &url_json = GetMember(*content_json, "url"); if(!url_json.IsString() || strncmp(url_json.GetString(), "mxc://", 6) != 0) -- cgit v1.2.3