aboutsummaryrefslogtreecommitdiff
path: root/xmpp-vala/src/module/xep
diff options
context:
space:
mode:
authorfiaxh <git@lightrise.org>2022-02-06 23:48:58 +0100
committerfiaxh <git@lightrise.org>2022-02-07 01:21:11 +0100
commit29d1abccac205189d4ef1d5692493774b7af4bea (patch)
tree4135b739562e5979f309adee4a45c5af1223d7a7 /xmpp-vala/src/module/xep
parent071d925e370b2238a9804733a484fe4ec9432f44 (diff)
downloaddino-29d1abccac205189d4ef1d5692493774b7af4bea.tar.gz
dino-29d1abccac205189d4ef1d5692493774b7af4bea.zip
Support direct jingle call invites with call invite messages
Diffstat (limited to 'xmpp-vala/src/module/xep')
-rw-r--r--xmpp-vala/src/module/xep/0353_call_invite_message.vala25
1 files changed, 19 insertions, 6 deletions
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 806db5e7..844e9a7f 100644
--- a/xmpp-vala/src/module/xep/0353_call_invite_message.vala
+++ b/xmpp-vala/src/module/xep/0353_call_invite_message.vala
@@ -1,25 +1,38 @@
using Gee;
namespace Xmpp.Xep.CallInvites {
- public const string NS_URI = "urn:xmpp:call-invites:0";
+ public const string NS_URI = "urn:xmpp:call-message:1";
public class Module : XmppStreamModule {
public static ModuleIdentity<Module> IDENTITY = new ModuleIdentity<Module>(NS_URI, "call_invites");
public signal void call_proposed(Jid from, Jid to, bool video, Gee.List<StanzaNode> join_methods, MessageStanza message);
public signal void call_retracted(Jid from, Jid to, string invite_id, string message_type);
- public signal void call_accepted(Jid from, string invite_id, string message_type);
+ public signal void call_accepted(Jid from, Jid to, string invite_id, string message_type);
public signal void call_rejected(Jid from, Jid to, string invite_id, string message_type);
- public void send_invite(XmppStream stream, Jid invitee, Jid muc_jid, bool video, string message_type) {
- StanzaNode muji_node = new StanzaNode.build("muji", Muji.NS_URI).add_self_xmlns().put_attribute("room", muc_jid.to_string());
+ public string send_jingle_propose(XmppStream stream, Jid invitee, string sid, bool video) {
+ StanzaNode jingle_node = new StanzaNode.build("jingle", CallInvites.NS_URI)
+ .put_attribute("sid", sid);
+ return send_propose(stream, invitee, jingle_node, video, false, MessageStanza.TYPE_CHAT);
+ }
+
+ public void send_muji_propose(XmppStream stream, Jid invitee, Jid muc_jid, bool video, string message_type) {
+ StanzaNode muji_node = new StanzaNode.build("muji", Muji.NS_URI).add_self_xmlns()
+ .put_attribute("room", muc_jid.to_string());
+ send_propose(stream, invitee, muji_node, video, true, message_type);
+ }
+
+ private string send_propose(XmppStream stream, Jid invitee, StanzaNode inner_node, bool video, bool multiparty, string message_type) {
StanzaNode invite_node = new StanzaNode.build("propose", NS_URI).add_self_xmlns()
.put_attribute("video", video.to_string())
- .put_node(muji_node);
+ .put_attribute("multi", multiparty.to_string())
+ .put_node(inner_node);
MessageStanza invite_message = new MessageStanza() { to=invitee, type_=message_type };
MessageProcessingHints.set_message_hint(invite_message, MessageProcessingHints.HINT_STORE);
invite_message.stanza.put_node(invite_node);
stream.get_module(MessageModule.IDENTITY).send_message.begin(stream, invite_message);
+ return invite_message.id;
}
public void send_retract(XmppStream stream, Jid to, string invite_id, string message_type) {
@@ -68,7 +81,7 @@ namespace Xmpp.Xep.CallInvites {
switch (relevant_node.name) {
case "accept":
- call_accepted(message.from, invite_id, message.type_);
+ call_accepted(message.from, message.to, invite_id, message.type_);
break;
case "retract":
call_retracted(message.from, message.to, invite_id, message.type_);