From ceb921a0148f7fdc2a9df3e6b85143bf8c26c341 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 26 Jul 2024 19:10:35 +0200 Subject: Store reply message as sent, with fallback --- main/src/ui/chat_input/chat_input_controller.vala | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'main/src/ui/chat_input') diff --git a/main/src/ui/chat_input/chat_input_controller.vala b/main/src/ui/chat_input/chat_input_controller.vala index d1c42d35..cf8e5a02 100644 --- a/main/src/ui/chat_input/chat_input_controller.vala +++ b/main/src/ui/chat_input/chat_input_controller.vala @@ -1,6 +1,7 @@ using Gee; using Gdk; using Gtk; +using Xmpp; using Dino.Entities; @@ -195,7 +196,17 @@ public class ChatInputController : Object { } Message out_message = stream_interactor.get_module(MessageProcessor.IDENTITY).create_out_message(text, conversation); if (quoted_content_item_bak != null) { - stream_interactor.get_module(Replies.IDENTITY).set_message_is_reply_to(out_message, quoted_content_item_bak); + 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); } -- cgit v1.2.3-70-g09d2