From cb3b19b01deb8460627578b885339e7528411f6f Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 6 Jan 2023 16:14:47 +0100 Subject: Support replies and reactions to files --- xmpp-vala/src/module/message/module.vala | 6 +++++- xmpp-vala/src/module/xep/0444_reactions.vala | 4 ++-- xmpp-vala/src/util.vala | 8 ++++++++ 3 files changed, 15 insertions(+), 3 deletions(-) (limited to 'xmpp-vala/src') diff --git a/xmpp-vala/src/module/message/module.vala b/xmpp-vala/src/module/message/module.vala index 2eced5c1..ef39a663 100644 --- a/xmpp-vala/src/module/message/module.vala +++ b/xmpp-vala/src/module/message/module.vala @@ -17,7 +17,11 @@ namespace Xmpp { public async void send_message(XmppStream stream, MessageStanza message) throws IOStreamError { yield send_pipeline.run(stream, message); - yield stream.write_async(message.stanza); + try { + yield stream.write_async(message.stanza); + } catch (IOStreamError e) { + throw new SendError.IO(e.message); + } } public async void received_message_stanza_async(XmppStream stream, StanzaNode node) { diff --git a/xmpp-vala/src/module/xep/0444_reactions.vala b/xmpp-vala/src/module/xep/0444_reactions.vala index 3501ca42..8e8a1706 100644 --- a/xmpp-vala/src/module/xep/0444_reactions.vala +++ b/xmpp-vala/src/module/xep/0444_reactions.vala @@ -11,7 +11,7 @@ public class Module : XmppStreamModule { private ReceivedPipelineListener received_pipeline_listener = new ReceivedPipelineListener(); - public void send_reaction(XmppStream stream, Jid jid, string stanza_type, string message_id, Gee.List reactions) { + public async void send_reaction(XmppStream stream, Jid jid, string stanza_type, string message_id, Gee.List reactions) throws SendError { StanzaNode reactions_node = new StanzaNode.build("reactions", NS_URI).add_self_xmlns(); reactions_node.put_attribute("id", message_id); foreach (string reaction in reactions) { @@ -25,7 +25,7 @@ public class Module : XmppStreamModule { MessageProcessingHints.set_message_hint(message, MessageProcessingHints.HINT_STORE); - stream.get_module(MessageModule.IDENTITY).send_message.begin(stream, message); + yield stream.get_module(MessageModule.IDENTITY).send_message(stream, message); } public override void attach(XmppStream stream) { diff --git a/xmpp-vala/src/util.vala b/xmpp-vala/src/util.vala index 6c0d0c9b..fda21f88 100644 --- a/xmpp-vala/src/util.vala +++ b/xmpp-vala/src/util.vala @@ -38,3 +38,11 @@ public long from_hex(string numeral) { } } + +namespace Xmpp { + public errordomain SendError { + IO, + NoStream, + Misc + } +} -- cgit v1.2.3-70-g09d2