mod_muc_rtbl: Optimize case with zero hashes
authorKim Alvefur <zash@zash.se>
Mon, 06 Dec 2021 18:19:19 +0100
changeset 4817 0a257d1402c3
parent 4816 9cdbb1b5e6f2
child 4818 5f12c75fd210
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.
mod_muc_rtbl/mod_muc_rtbl.lua
--- a/mod_muc_rtbl/mod_muc_rtbl.lua	Mon Dec 06 12:27:16 2021 +0000
+++ b/mod_muc_rtbl/mod_muc_rtbl.lua	Mon Dec 06 18:19:19 2021 +0100
@@ -92,6 +92,8 @@
 module:hook("iq-result/host/rtbl-request", update_list);
 
 module:hook("muc-occupant-pre-join", function (event)
+	if next(banned_hashes) == nil then return end
+
 	local from_bare = jid.bare(event.stanza.attr.from);
 
 	local affiliation = event.room:get_affiliation(from_bare);