From 3f169c64d70ee3c4b735d31744be154cccc85d67 Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sat, 12 Feb 2022 19:15:52 +0100 Subject: [PATCH] CIM: Announce accepted method --- libdino/src/service/call_state.vala | 12 +++++++++++- xmpp-vala/src/module/xep/0166_jingle/session.vala | 2 +- .../src/module/xep/0353_call_invite_message.vala | 10 ++++++++-- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/libdino/src/service/call_state.vala b/libdino/src/service/call_state.vala index c1f0522d..452deb4f 100644 --- a/libdino/src/service/call_state.vala +++ b/libdino/src/service/call_state.vala @@ -100,7 +100,17 @@ public class Dino.CallState : Object { if (use_cim) { XmppStream stream = stream_interactor.get_stream(call.account); if (stream == null) return; - stream.get_module(Xep.CallInvites.Module.IDENTITY).send_accept(stream, cim_counterpart, cim_call_id, cim_message_type); + StanzaNode? inner_node = null; + if (group_call != null) { + inner_node = new StanzaNode.build("muji", Xep.Muji.NS_URI).add_self_xmlns() + .put_attribute("room", group_call.muc_jid.to_string()); + } else if (peers.size == 1) { + foreach (PeerState peer in peers.values) { + inner_node = new StanzaNode.build("jingle", Xep.CallInvites.NS_URI) + .put_attribute("sid", peer.sid); + } + } + stream.get_module(Xep.CallInvites.Module.IDENTITY).send_accept(stream, cim_counterpart, cim_call_id, inner_node, cim_message_type); } else { foreach (PeerState peer in peers.values) { peer.accept(); diff --git a/xmpp-vala/src/module/xep/0166_jingle/session.vala b/xmpp-vala/src/module/xep/0166_jingle/session.vala index 577792ff..53a9c58d 100644 --- a/xmpp-vala/src/module/xep/0166_jingle/session.vala +++ b/xmpp-vala/src/module/xep/0166_jingle/session.vala @@ -426,7 +426,7 @@ public class Xmpp.Xep.Jingle.Session : Object { reason_node.put_node(new StanzaNode.build(reason_name, NS_URI)); } if (reason_text != null) { - reason_node.put_node(new StanzaNode.text(reason_text)); + reason_node.put_node(new StanzaNode.build("text", NS_URI).put_node(new StanzaNode.text(reason_text))); } terminate_iq.put_node(reason_node); } diff --git a/xmpp-vala/src/module/xep/0353_call_invite_message.vala b/xmpp-vala/src/module/xep/0353_call_invite_message.vala index 38d87f43..8031beaf 100644 --- a/xmpp-vala/src/module/xep/0353_call_invite_message.vala +++ b/xmpp-vala/src/module/xep/0353_call_invite_message.vala @@ -40,8 +40,14 @@ namespace Xmpp.Xep.CallInvites { send_message(stream, to, call_id, "retract", "cancel", message_type); } - public void send_accept(XmppStream stream, Jid to, string call_id, string message_type) { - send_message(stream, to, call_id, "accept", null, message_type); + public void send_accept(XmppStream stream, Jid inviter, string call_id, StanzaNode? inner_node, string message_type) { + StanzaNode accept_node = new StanzaNode.build("accept", NS_URI).add_self_xmlns() + .put_attribute("id", call_id); + if (inner_node != null) accept_node.put_node(inner_node); + MessageStanza invite_message = new MessageStanza() { to=inviter, type_=message_type }; + MessageProcessingHints.set_message_hint(invite_message, MessageProcessingHints.HINT_STORE); + invite_message.stanza.put_node(accept_node); + stream.get_module(MessageModule.IDENTITY).send_message.begin(stream, invite_message); } public void send_reject(XmppStream stream, Jid to, string call_id, string message_type) {