diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-10-02 19:08:25 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-10-02 19:09:19 +0200 |
commit | 99bee0e8d2c498f6dff94a87db7540687161f3f7 (patch) | |
tree | 5c17aeb1f08b144df8e03231e0641131acfb7352 /src/plugins | |
parent | 2d4772337df47794fb0b1734bda209177a989515 (diff) |
Matrix: fix reply to multiline reply
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/Matrix.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp index 585664a..b8f3742 100644 --- a/src/plugins/Matrix.cpp +++ b/src/plugins/Matrix.cpp @@ -904,6 +904,20 @@ namespace QuickMedia { return str; } + static std::string block_quote(const std::string &str) { + std::string result = "> "; + for(char c : str) { + if(c == '>') { + result += "\\>"; + } else if(c == '\n') { + result += "\n> "; + } else { + result += c; + } + } + return result; + } + static std::string create_body_for_message_reply(const RoomData *room_data, const Message *message, const std::string &body) { std::string related_to_body; switch(message->type) { @@ -927,7 +941,7 @@ namespace QuickMedia { related_to_body = "sent a file"; break; } - return "> <" + room_data->user_info[message->user_id].user_id + "> " + std::move(related_to_body) + "\n\n" + body; + return block_quote("<" + room_data->user_info[message->user_id].user_id + "> " + std::move(related_to_body)) + "\n\n" + body; } // TODO: Add formatted_body just like element does with <mx-reply><blockquote... and also support greentext with that |