CIM: Announce accepted method

This commit is contained in:
Marvin W 2022-02-12 19:15:52 +01:00
parent 602834bdf7
commit 3f169c64d7
No known key found for this signature in database
GPG key ID: 072E9235DB996F2A
3 changed files with 20 additions and 4 deletions

View file

@ -100,7 +100,17 @@ public class Dino.CallState : Object {
if (use_cim) { if (use_cim) {
XmppStream stream = stream_interactor.get_stream(call.account); XmppStream stream = stream_interactor.get_stream(call.account);
if (stream == null) return; 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 { } else {
foreach (PeerState peer in peers.values) { foreach (PeerState peer in peers.values) {
peer.accept(); peer.accept();

View file

@ -426,7 +426,7 @@ public class Xmpp.Xep.Jingle.Session : Object {
reason_node.put_node(new StanzaNode.build(reason_name, NS_URI)); reason_node.put_node(new StanzaNode.build(reason_name, NS_URI));
} }
if (reason_text != null) { 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); terminate_iq.put_node(reason_node);
} }

View file

@ -40,8 +40,14 @@ namespace Xmpp.Xep.CallInvites {
send_message(stream, to, call_id, "retract", "cancel", message_type); send_message(stream, to, call_id, "retract", "cancel", message_type);
} }
public void send_accept(XmppStream stream, Jid to, string call_id, string message_type) { public void send_accept(XmppStream stream, Jid inviter, string call_id, StanzaNode? inner_node, string message_type) {
send_message(stream, to, call_id, "accept", null, 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) { public void send_reject(XmppStream stream, Jid to, string call_id, string message_type) {