From b586aebbac20ea03509e42e54f1632d654ea968d Mon Sep 17 00:00:00 2001 From: Marvin W Date: Sat, 12 Feb 2022 17:18:03 +0100 Subject: Calls: Fix OMEMO in group calls --- xmpp-vala/src/module/xep/0166_jingle/jingle_module.vala | 15 ++++++++++++++- xmpp-vala/src/module/xep/0166_jingle/session.vala | 2 ++ 2 files changed, 16 insertions(+), 1 deletion(-) (limited to 'xmpp-vala/src/module/xep/0166_jingle') diff --git a/xmpp-vala/src/module/xep/0166_jingle/jingle_module.vala b/xmpp-vala/src/module/xep/0166_jingle/jingle_module.vala index 186848f6..cdcb9130 100644 --- a/xmpp-vala/src/module/xep/0166_jingle/jingle_module.vala +++ b/xmpp-vala/src/module/xep/0166_jingle/jingle_module.vala @@ -102,7 +102,7 @@ namespace Xmpp.Xep.Jingle { return (yield is_jingle_available(stream, full_jid)) && (yield select_transport(stream, type, components, full_jid, Set.empty())) != null; } - public async Session create_session(XmppStream stream, Gee.List contents, Jid receiver_full_jid, string? sid = null) throws Error { + public async Session create_session(XmppStream stream, Gee.List contents, Jid receiver_full_jid, string? sid = null, Jid? muji_room = null) throws Error { if (!yield is_jingle_available(stream, receiver_full_jid)) { throw new Error.NO_SHARED_PROTOCOLS("No Jingle support"); } @@ -138,6 +138,10 @@ namespace Xmpp.Xep.Jingle { initiate_jingle_iq.put_node(content_node); } + if (muji_room != null) { + initiate_jingle_iq.put_node(new StanzaNode.build("muji", Xep.Muji.NS_URI).add_self_xmlns().put_attribute("room", muji_room.to_string())); + } + Iq.Stanza iq = new Iq.Stanza.set(initiate_jingle_iq) { to=receiver_full_jid }; stream.get_flag(Flag.IDENTITY).add_session(session); @@ -158,6 +162,15 @@ namespace Xmpp.Xep.Jingle { Session session = new Session.initiate_received(stream, sid, my_jid, iq.from); session.terminated.connect((stream) => { stream.get_flag(Flag.IDENTITY).remove_session(sid); }); + string? muji_room_str = iq.stanza.get_deep_attribute(NS_URI + ":jingle", Xep.Muji.NS_URI + ":muji", "room"); + if (muji_room_str != null) { + try { + session.muji_room = new Jid(muji_room_str); + } catch (InvalidJidError e) { + // Ignore + } + } + stream.get_flag(Flag.IDENTITY).pre_add_session(session.sid); foreach (ContentNode content_node in get_content_nodes(jingle)) { diff --git a/xmpp-vala/src/module/xep/0166_jingle/session.vala b/xmpp-vala/src/module/xep/0166_jingle/session.vala index e5084880..577792ff 100644 --- a/xmpp-vala/src/module/xep/0166_jingle/session.vala +++ b/xmpp-vala/src/module/xep/0166_jingle/session.vala @@ -29,6 +29,8 @@ public class Xmpp.Xep.Jingle.Session : Object { public SecurityParameters? security { get { return contents.to_array()[0].security_params; } } + public Jid muji_room { get; set; } + public Session.initiate_sent(XmppStream stream, string sid, Jid local_full_jid, Jid peer_full_jid) { this.stream = stream; this.sid = sid; -- cgit v1.2.3-70-g09d2