From 10adf716f3b94073f099dfb18ecdaf41dafcab2d Mon Sep 17 00:00:00 2001 From: fiaxh Date: Wed, 11 Nov 2020 11:27:31 +0100 Subject: Fix incoming muc voice request notification --- xmpp-vala/src/module/xep/0045_muc/module.vala | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'xmpp-vala') diff --git a/xmpp-vala/src/module/xep/0045_muc/module.vala b/xmpp-vala/src/module/xep/0045_muc/module.vala index aef3796b..dcfe8ace 100644 --- a/xmpp-vala/src/module/xep/0045_muc/module.vala +++ b/xmpp-vala/src/module/xep/0045_muc/module.vala @@ -69,7 +69,7 @@ public class Module : XmppStreamModule { public signal void received_occupant_role(XmppStream stream, Jid jid, Role? role); public signal void subject_set(XmppStream stream, string? subject, Jid jid); public signal void invite_received(XmppStream stream, Jid room_jid, Jid from_jid, string? password, string? reason); - public signal void voice_request_received(XmppStream stream, Jid room_jid, Jid from_jid, string? nick, string? role, string? label); + public signal void voice_request_received(XmppStream stream, Jid room_jid, Jid from_jid, string nick); public signal void room_info_updated(XmppStream stream, Jid muc_jid); public signal void self_removed_from_room(XmppStream stream, Jid jid, StatusCode code); @@ -559,8 +559,6 @@ public class ReceivedPipelineListener : StanzaListener { Gee.List? fields = x_field_node.get_subnodes("field", DataForms.NS_URI); Jid? from_jid = null; string? nick = null; - string? role = null; - string? label = null; if (fields.size!=0){ foreach (var field_node in fields){ @@ -579,13 +577,19 @@ public class ReceivedPipelineListener : StanzaListener { } else if (var_ == "muc#role"){ StanzaNode? value_node = field_node.get_subnode("value", DataForms.NS_URI); - if (value_node != null) role = value_node.get_string_content(); - } - else if (var_ == "muc#request_allow"){ - label = field_node.get_attribute("label"); + if (value_node != null) { + if (value_node.get_string_content() != "participant") { + warning("Voice request with role other than participant"); + } + } } } - outer.voice_request_received(stream, message.from, from_jid, nick, role, label); + if (from_jid == null || nick == null) { + warning("Voice request without from_jid or nick"); + return false; + } + + outer.voice_request_received(stream, message.from, from_jid, nick); return true; } } -- cgit v1.2.3-70-g09d2