aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/plugins/Matrix.cpp16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index bf988ca..4328888 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -2751,14 +2751,16 @@ namespace QuickMedia {
return std::string::npos;
}
- static void formatted_body_add_line(std::string &formatted_body, const std::string &line_str) {
+ void Matrix::formatted_body_add_line(RoomData *room, std::string &formatted_body, const std::string &line_str) {
size_t index = 0;
while(true) {
size_t backquote_start_index = find_backquote_index_with_escape(line_str, index);
if(backquote_start_index != std::string::npos) {
size_t backquote_end_index = find_backquote_index_with_escape(line_str, backquote_start_index + 1);
if(backquote_end_index != std::string::npos) {
- formatted_body += line_str.substr(index, backquote_start_index - index);
+ std::string str_to_append = line_str.substr(index, backquote_start_index - index);
+ replace_mentions(room, str_to_append);
+ formatted_body += std::move(str_to_append);
formatted_body += "<code>";
formatted_body += line_str.substr(backquote_start_index + 1, backquote_end_index - (backquote_start_index + 1));
formatted_body += "</code>";
@@ -2767,7 +2769,9 @@ namespace QuickMedia {
}
}
- formatted_body += line_str.substr(index);
+ std::string str_to_append = line_str.substr(index);
+ replace_mentions(room, str_to_append);
+ formatted_body += std::move(str_to_append);
break;
}
}
@@ -2856,15 +2860,13 @@ namespace QuickMedia {
} else {
if(!is_inside_code_block && size > 0 && str[0] == '>') {
formatted_body += "<font color=\"#789922\">";
- replace_mentions(room, line_str);
- formatted_body_add_line(formatted_body, line_str);
+ formatted_body_add_line(room, formatted_body, line_str);
formatted_body += "</font>";
} else {
if(is_inside_code_block) {
formatted_body += line_str;
} else {
- replace_mentions(room, line_str);
- formatted_body_add_line(formatted_body, line_str);
+ formatted_body_add_line(room, formatted_body, line_str);
}
}
is_first_line = false;