summary refs log tree commit diff
path: root/src/timeline/InputBar.cpp
diff options
context:
space:
mode:
authorLoren Burkholder <computersemiexpert@outlook.com>2021-01-20 17:44:11 -0500
committerLoren Burkholder <computersemiexpert@outlook.com>2021-01-20 18:22:24 -0500
commit91155bf80332155b16b07f162e3ccd51bb9364cf (patch)
tree27a7ee4eed877a4092f4a47982d8bb6b5c829a9d /src/timeline/InputBar.cpp
parentMerge pull request #388 from LorenDB/fixBorkedDbus (diff)
downloadnheko-91155bf80332155b16b07f162e3ccd51bb9364cf.tar.xz
Add commands to override Markdown setting
Diffstat (limited to 'src/timeline/InputBar.cpp')
-rw-r--r--src/timeline/InputBar.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/timeline/InputBar.cpp b/src/timeline/InputBar.cpp
index 3cddd613..49dd837b 100644
--- a/src/timeline/InputBar.cpp
+++ b/src/timeline/InputBar.cpp
@@ -251,12 +251,12 @@ InputBar::openFileSelection()
 }
 
 void
-InputBar::message(QString msg)
+InputBar::message(QString msg, MarkdownOverride useMarkdown)
 {
         mtx::events::msg::Text text = {};
         text.body                   = msg.trimmed().toStdString();
 
-        if (ChatPage::instance()->userSettings()->markdown()) {
+        if ((ChatPage::instance()->userSettings()->markdown() && (useMarkdown != MarkdownOverride::OFF)) || (useMarkdown == MarkdownOverride::ON)) {
                 text.formatted_body = utils::markdownToHtml(msg).toStdString();
 
                 // Don't send formatted_body, when we don't need to
@@ -477,6 +477,10 @@ InputBar::command(QString command, QString args)
                 room->clearTimeline();
         } else if (command == "rotate-megolm-session") {
                 cache::dropOutboundMegolmSession(room->roomId().toStdString());
+        } else if (command == "md") {
+            message(args, MarkdownOverride::ON);
+        } else if (command == "plain") {
+            message(args, MarkdownOverride::OFF);
         }
 }