From 4f256ec71cd3ce70f7269d5caecb3364dce4809a Mon Sep 17 00:00:00 2001 From: emrah Date: Thu, 28 Sep 2023 15:13:51 +0300 Subject: [PATCH] auth_hybrid_matrix_token, fix: increase the overwrite interval --- .../mod_matrix_affiliation.lua | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/auth_hybrid_matrix_token/mod_matrix_affiliation.lua b/auth_hybrid_matrix_token/mod_matrix_affiliation.lua index 1d6746e..60ab07c 100644 --- a/auth_hybrid_matrix_token/mod_matrix_affiliation.lua +++ b/auth_hybrid_matrix_token/mod_matrix_affiliation.lua @@ -62,13 +62,16 @@ module:hook("muc-occupant-joined", function (event) -- users who are not a Matrix owner (even they have a valid token). -- A timer is used because Jicofo will update the affiliation after this -- internal authentication phase is completed. It should be overwritten. - local i = 0.0 - while (i < 2.0) do - timer.add_task(i, function() - room:set_affiliation(true, occupant.bare_jid, "member") - end) - i = i + 0.2 + local i = 0 + local function setAffiliation() + room:set_affiliation(true, occupant.bare_jid, "member") + if i > 8 then return end + + i = i + 1 + timer.add_task(0.2 * i, setAffiliation) end + setAffiliation() + module:log( "info", "affiliation is downgraded, occupant: %s", occupant.bare_jid