diff options
author | dec05eba <dec05eba@protonmail.com> | 2022-11-11 01:18:01 +0100 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2022-11-11 01:18:01 +0100 |
commit | 67e3d3fbbe2999790b07b3f0c894b9ed01a79633 (patch) | |
tree | 40787ce704eb4eb9fd0767c100540ee75e79dcca /src | |
parent | e19a29c7e51860144f02d7e7b08ac5e430e1f78f (diff) |
Matrix: fix replying to custom emoji making the custom emoji also display in the reply text
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/Matrix.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 28b4823..fd5026a 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -2630,7 +2630,7 @@ namespace QuickMedia { } else if(html_parser->tag_name.size == 4 && memcmp(html_parser->tag_name.data, "code", 4) == 0) { parse_userdata.inside_code_tag = false; } else if(html_parser->tag_name.size == 3 && memcmp(html_parser->tag_name.data, "img", 3) == 0) { - if(parse_userdata.matrix && parse_userdata.inside_img_tag && parse_userdata.img_src.size() > 0) { + if(parse_userdata.allow_formatted_text && parse_userdata.matrix && parse_userdata.mx_reply_depth == 0 && parse_userdata.inside_img_tag && parse_userdata.img_src.size() > 0) { std::string image_url(parse_userdata.img_src); html_unescape_sequences(image_url); mgl::vec2i img_size = parse_userdata.img_size; @@ -2660,7 +2660,7 @@ namespace QuickMedia { const std::string height(html_parser->attribute_value.data, html_parser->attribute_value.size); parse_userdata.img_size.y = atoi(height.c_str()); } - } else if(!parse_userdata.allow_formatted_text && parse_userdata.inside_img_tag && html_parser->attribute_key.size == 3 && memcmp(html_parser->attribute_key.data, "alt", 3) == 0) { + } else if(!parse_userdata.allow_formatted_text && parse_userdata.inside_img_tag && parse_userdata.mx_reply_depth == 0 && html_parser->attribute_key.size == 3 && memcmp(html_parser->attribute_key.data, "alt", 3) == 0) { std::string text_to_add(html_parser->attribute_value.data, html_parser->attribute_value.size); html_unescape_sequences(text_to_add); parse_userdata.result += std::move(text_to_add); @@ -3748,11 +3748,13 @@ namespace QuickMedia { html_escape_sequences(url); std::string width = std::to_string(it.second.size.x); std::string height = std::to_string(it.second.size.y); - std::string tag = "<img src=\"" + url + "\" alt=\"" + keybind + "\" width=\"" + width + "\" height=\"" + height + "\" vertical-align=\"middle\" />"; + std::string tag = "<img src=\"" + url + "\" alt=\"" + keybind + "\" width=\"" + width + "\" height=\"" + height + "\" />"; string_replace_all(str, keybind, tag); } } + // TODO: remove first/last newspace in codeblock. + std::string Matrix::body_to_formatted_body(RoomData *room, const std::string &body) { std::unordered_map<std::string, CustomEmoji> custom_emojis_copy; { |