comparison mod_muc_rtbl/mod_muc_rtbl.lua @ 4813:0a257d1402c3

mod_muc_rtbl: Optimize case with zero hashes On the assumption that during quiet times between torrents of spam, the hash set would be empty. There would be no point in doing the operations and hashes to check for a match in that case.
author Kim Alvefur <zash@zash.se>
date Mon, 06 Dec 2021 18:19:19 +0100
parents 9cdbb1b5e6f2
children 460f78654864
comparison
equal deleted inserted replaced
4812:9cdbb1b5e6f2 4813:0a257d1402c3
90 end 90 end
91 91
92 module:hook("iq-result/host/rtbl-request", update_list); 92 module:hook("iq-result/host/rtbl-request", update_list);
93 93
94 module:hook("muc-occupant-pre-join", function (event) 94 module:hook("muc-occupant-pre-join", function (event)
95 if next(banned_hashes) == nil then return end
96
95 local from_bare = jid.bare(event.stanza.attr.from); 97 local from_bare = jid.bare(event.stanza.attr.from);
96 98
97 local affiliation = event.room:get_affiliation(from_bare); 99 local affiliation = event.room:get_affiliation(from_bare);
98 if affiliation and affiliation ~= "none" then 100 if affiliation and affiliation ~= "none" then
99 -- Skip check for affiliated users 101 -- Skip check for affiliated users