aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-07-02 11:51:30 +0200
committerGitHub <noreply@github.com>2020-07-02 11:51:30 +0200
commit23c021685364de19e64248d0411a7ed2f216700e (patch)
tree5ff7d3a6b4c2dcbb1007b9a9d8577db602b29f2e
parent2824dedd22a60f6598d06aaa6e6d6e2424cbfa01 (diff)
downloaddino-23c021685364de19e64248d0411a7ed2f216700e.tar.gz
dino-23c021685364de19e64248d0411a7ed2f216700e.zip
Fix messages mistakenly treated as /me command (#872)
Per XEP-0245 only messages that start with "/me " (with the trailing space) should treated as 3rd person actions.
-rw-r--r--main/src/ui/conversation_content_view/message_widget.vala8
1 files changed, 4 insertions, 4 deletions
diff --git a/main/src/ui/conversation_content_view/message_widget.vala b/main/src/ui/conversation_content_view/message_widget.vala
index aefab6e1..13b48a1e 100644
--- a/main/src/ui/conversation_content_view/message_widget.vala
+++ b/main/src/ui/conversation_content_view/message_widget.vala
@@ -156,8 +156,8 @@ public class MessageItemWidget : SizeRequestBin {
if (markup_text.length > 10000) {
markup_text = markup_text.substring(0, 10000) + " [" + _("Message too long") + "]";
}
- if (message.body.has_prefix("/me")) {
- markup_text = markup_text.substring(3);
+ if (message.body.has_prefix("/me ")) {
+ markup_text = markup_text.substring(4);
}
if (conversation.type_ == Conversation.Type.GROUPCHAT) {
@@ -166,10 +166,10 @@ public class MessageItemWidget : SizeRequestBin {
markup_text = Util.parse_add_markup(markup_text, null, true, true);
}
- if (message.body.has_prefix("/me")) {
+ if (message.body.has_prefix("/me ")) {
string display_name = Util.get_participant_display_name(stream_interactor, conversation, message.from);
string color = Util.get_name_hex_color(stream_interactor, conversation.account, message.real_jid ?? message.from, Util.is_dark_theme(label));
- markup_text = @"<span color=\"#$(color)\">$(Markup.escape_text(display_name))</span>" + markup_text;
+ markup_text = @"<span color=\"#$(color)\">$(Markup.escape_text(display_name))</span> " + markup_text;
theme_dependent = true;
}