From 23c021685364de19e64248d0411a7ed2f216700e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 2 Jul 2020 11:51:30 +0200 Subject: [PATCH] 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. --- main/src/ui/conversation_content_view/message_widget.vala | 8 ++++---- 1 file 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 = @"$(Markup.escape_text(display_name))" + markup_text; + markup_text = @"$(Markup.escape_text(display_name)) " + markup_text; theme_dependent = true; }