From 4075e5deb748cf7eac25d6209bfc48344aff8ac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=B0=D0=BC=D1=8F=D0=BD=20=D0=9C=D0=B8=D0=BD=D0=BA?= =?UTF-8?q?=D0=BE=D0=B2?= Date: Thu, 15 Jul 2021 16:31:29 +0300 Subject: [PATCH] fix: Fix speakerstats reports. --- .../mod_speakerstats_component.lua | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/resources/prosody-plugins/mod_speakerstats_component.lua b/resources/prosody-plugins/mod_speakerstats_component.lua index 0c7a8c7ac..26df7647d 100644 --- a/resources/prosody-plugins/mod_speakerstats_component.lua +++ b/resources/prosody-plugins/mod_speakerstats_component.lua @@ -166,21 +166,19 @@ function occupant_joined(event) end end - if next(users_json) == nil then - return; + if next(users_json) ~= nil then + local body_json = {}; + body_json.type = 'speakerstats'; + body_json.users = users_json; + + local stanza = st.message({ + from = module.host; + to = occupant.jid; }) + :tag("json-message", {xmlns='http://jitsi.org/jitmeet'}) + :text(json.encode(body_json)):up(); + + room:route_stanza(stanza); end - - local body_json = {}; - body_json.type = 'speakerstats'; - body_json.users = users_json; - - local stanza = st.message({ - from = module.host; - to = occupant.jid; }) - :tag("json-message", {xmlns='http://jitsi.org/jitmeet'}) - :text(json.encode(body_json)):up(); - - room:route_stanza(stanza); end local context_user = event.origin and event.origin.jitsi_meet_context_user or nil;