From b0ff90a14a5d127e17f2371f87e7bb659de3a68f Mon Sep 17 00:00:00 2001 From: fiaxh Date: Mon, 29 Jul 2024 13:16:54 +0200 Subject: Add initial message markup (XEP-0394) support --- main/src/ui/chat_input/chat_input_controller.vala | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'main/src/ui/chat_input/chat_input_controller.vala') diff --git a/main/src/ui/chat_input/chat_input_controller.vala b/main/src/ui/chat_input/chat_input_controller.vala index cf8e5a02..07499aa4 100644 --- a/main/src/ui/chat_input/chat_input_controller.vala +++ b/main/src/ui/chat_input/chat_input_controller.vala @@ -3,6 +3,7 @@ using Gdk; using Gtk; using Xmpp; +using Xmpp; using Dino.Entities; namespace Dino.Ui { @@ -136,6 +137,7 @@ public class ChatInputController : Object { string text = chat_input.chat_text_view.text_view.buffer.text; ContentItem? quoted_content_item_bak = quoted_content_item; + var markups = chat_input.chat_text_view.get_markups(); // Reset input state. Has do be done before parsing commands, because those directly return. chat_input.chat_text_view.text_view.buffer.text = ""; @@ -194,21 +196,8 @@ public class ChatInputController : Object { break; } } - Message out_message = stream_interactor.get_module(MessageProcessor.IDENTITY).create_out_message(text, conversation); - if (quoted_content_item_bak != null) { - out_message.set_quoted_item(quoted_content_item_bak.id); - - // Store body with fallback - string fallback = FallbackBody.get_quoted_fallback_body(quoted_content_item_bak); - out_message.body = fallback + out_message.body; - - // Store fallback location - var fallback_location = new Xep.FallbackIndication.FallbackLocation(0, (int)fallback.char_count()); - var fallback_list = new ArrayList(); - fallback_list.add(new Xep.FallbackIndication.Fallback(Xep.Replies.NS_URI, new Xep.FallbackIndication.FallbackLocation[] { fallback_location })); - out_message.set_fallbacks(fallback_list); - } - stream_interactor.get_module(MessageProcessor.IDENTITY).send_message(out_message, conversation); + + Dino.send_message(conversation, text, quoted_content_item_bak != null ? quoted_content_item_bak.id : 0, null, markups); } private void on_text_input_changed() { -- cgit v1.2.3-70-g09d2