From 78bb2bbddaf587de77f67c404e8ed5083f16bf8a Mon Sep 17 00:00:00 2001 From: fiaxh Date: Sat, 18 Dec 2021 21:34:39 +0100 Subject: Add calls in private MUCs via a MUJI MUC --- xmpp-vala/src/module/xep/muji_meta.vala | 36 ++++++++++++++++----------------- 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'xmpp-vala') diff --git a/xmpp-vala/src/module/xep/muji_meta.vala b/xmpp-vala/src/module/xep/muji_meta.vala index 4452e611..89a0e8de 100644 --- a/xmpp-vala/src/module/xep/muji_meta.vala +++ b/xmpp-vala/src/module/xep/muji_meta.vala @@ -6,48 +6,48 @@ namespace Xmpp.Xep.MujiMeta { public class Module : XmppStreamModule { public static ModuleIdentity IDENTITY = new ModuleIdentity(NS_URI, "muji_meta"); - public signal void call_proposed(Jid from, Jid to, Jid muc_jid, Gee.List descriptions); - public signal void call_retracted(Jid from, Jid to, Jid muc_jid); - public signal void call_accepted(Jid from, Jid muc_jid); - public signal void call_rejected(Jid from, Jid to, Jid muc_jid); + public signal void call_proposed(Jid from, Jid to, Jid muc_jid, Gee.List descriptions, string message_type); + public signal void call_retracted(Jid from, Jid to, Jid muc_jid, string message_type); + public signal void call_accepted(Jid from, Jid muc_jid, string message_type); + public signal void call_rejected(Jid from, Jid to, Jid muc_jid, string message_type); - public void send_invite(XmppStream stream, Jid invitee, Jid muc_jid, bool video) { + public void send_invite(XmppStream stream, Jid invitee, Jid muc_jid, bool video, string? message_type = null) { var invite_node = new StanzaNode.build("propose", NS_URI).put_attribute("muc", muc_jid.to_string()); invite_node.put_node(new StanzaNode.build("description", Xep.JingleRtp.NS_URI).add_self_xmlns().put_attribute("media", "audio")); if (video) { invite_node.put_node(new StanzaNode.build("description", Xep.JingleRtp.NS_URI).add_self_xmlns().put_attribute("media", "video")); } var muji_node = new StanzaNode.build("muji", NS_URI).add_self_xmlns().put_node(invite_node); - MessageStanza invite_message = new MessageStanza() { to=invitee, type_=MessageStanza.TYPE_CHAT }; + MessageStanza invite_message = new MessageStanza() { to=invitee, type_=message_type }; invite_message.stanza.put_node(muji_node); stream.get_module(MessageModule.IDENTITY).send_message.begin(stream, invite_message); } - public void send_invite_retract_to_peer(XmppStream stream, Jid invitee, Jid muc_jid) { - send_jmi_message(stream, "retract", invitee, muc_jid); + public void send_invite_retract_to_peer(XmppStream stream, Jid invitee, Jid muc_jid, string? message_type = null) { + send_jmi_message(stream, "retract", invitee, muc_jid, message_type); } - public void send_invite_accept_to_peer(XmppStream stream, Jid invitor, Jid muc_jid) { - send_jmi_message(stream, "accept", invitor, muc_jid); + public void send_invite_accept_to_peer(XmppStream stream, Jid invitor, Jid muc_jid, string? message_type = null) { + send_jmi_message(stream, "accept", invitor, muc_jid, message_type); } public void send_invite_accept_to_self(XmppStream stream, Jid muc_jid) { send_jmi_message(stream, "accept", Bind.Flag.get_my_jid(stream).bare_jid, muc_jid); } - public void send_invite_reject_to_peer(XmppStream stream, Jid invitor, Jid muc_jid) { - send_jmi_message(stream, "reject", invitor, muc_jid); + public void send_invite_reject_to_peer(XmppStream stream, Jid invitor, Jid muc_jid, string? message_type = null) { + send_jmi_message(stream, "reject", invitor, muc_jid, message_type); } public void send_invite_reject_to_self(XmppStream stream, Jid muc_jid) { send_jmi_message(stream, "reject", Bind.Flag.get_my_jid(stream).bare_jid, muc_jid); } - private void send_jmi_message(XmppStream stream, string name, Jid to, Jid muc) { + private void send_jmi_message(XmppStream stream, string name, Jid to, Jid muc, string? message_type = null) { var jmi_node = new StanzaNode.build(name, NS_URI).add_self_xmlns().put_attribute("muc", muc.to_string()); var muji_node = new StanzaNode.build("muji", NS_URI).add_self_xmlns().put_node(jmi_node); - MessageStanza accepted_message = new MessageStanza() { to=to, type_=MessageStanza.TYPE_CHAT }; + MessageStanza accepted_message = new MessageStanza() { to=to, type_= message_type ?? MessageStanza.TYPE_CHAT }; accepted_message.stanza.put_node(muji_node); stream.get_module(MessageModule.IDENTITY).send_message.begin(stream, accepted_message); } @@ -80,7 +80,7 @@ namespace Xmpp.Xep.MujiMeta { switch (mi_node.name) { case "accept": case "proceed": - call_accepted(message.from, muc_jid); + call_accepted(message.from, muc_jid, message.type_); break; case "propose": ArrayList descriptions = new ArrayList(); @@ -91,14 +91,14 @@ namespace Xmpp.Xep.MujiMeta { } if (descriptions.size > 0) { - call_proposed(message.from, message.to, muc_jid, descriptions); + call_proposed(message.from, message.to, muc_jid, descriptions, message.type_); } break; case "retract": - call_retracted(message.from, message.to, muc_jid); + call_retracted(message.from, message.to, muc_jid, message.type_); break; case "reject": - call_rejected(message.from, message.to, muc_jid); + call_rejected(message.from, message.to, muc_jid, message.type_); break; } } -- cgit v1.2.3-70-g09d2