aboutsummaryrefslogtreecommitdiff
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/Matrix.cpp6
-rw-r--r--src/plugins/Plugin.cpp4
2 files changed, 7 insertions, 3 deletions
diff --git a/src/plugins/Matrix.cpp b/src/plugins/Matrix.cpp
index d364b16..513a9fb 100644
--- a/src/plugins/Matrix.cpp
+++ b/src/plugins/Matrix.cpp
@@ -666,7 +666,10 @@ namespace QuickMedia {
std::string formatted_body;
bool contains_formatted_text = false;
if(msgtype == MessageType::TEXT) {
- string_split(body, '\n', [&formatted_body, &contains_formatted_text](const char *str, size_t size){
+ int line = 0;
+ string_split(body, '\n', [&formatted_body, &contains_formatted_text, &line](const char *str, size_t size){
+ if(line > 0)
+ formatted_body += "<br/>";
if(size > 0 && str[0] == '>') {
std::string line(str, size);
html_escape_sequences(line);
@@ -677,6 +680,7 @@ namespace QuickMedia {
} else {
formatted_body.append(str, size);
}
+ ++line;
return true;
});
}
diff --git a/src/plugins/Plugin.cpp b/src/plugins/Plugin.cpp
index f23175c..20c4b0a 100644
--- a/src/plugins/Plugin.cpp
+++ b/src/plugins/Plugin.cpp
@@ -35,11 +35,11 @@ namespace QuickMedia {
void html_escape_sequences(std::string &str) {
const std::array<HtmlEscapeSequence, 6> escape_sequences = {
+ HtmlEscapeSequence { '&', "&amp;" }, // This should be first, to not accidentally replace a new sequence caused by replacing this
HtmlEscapeSequence { '"', "&quot;" },
HtmlEscapeSequence { '\'', "&#39;" },
HtmlEscapeSequence { '<', "&lt;" },
- HtmlEscapeSequence { '>', "&gt;" },
- HtmlEscapeSequence { '&', "&amp;" } // This should be last, to not accidentally replace a new sequence caused by replacing this
+ HtmlEscapeSequence { '>', "&gt;" }
};
for(const HtmlEscapeSequence &escape_sequence : escape_sequences) {