comparison mod_muc_rtbl/mod_muc_rtbl.lua @ 5650:0eb2d5ea2428

merge
author Stephen Paul Weber <singpolyma@singpolyma.net>
date Sat, 06 May 2023 19:40:23 -0500
parents f6577cdb1d91
children ba71fdc8ea73
comparison
equal deleted inserted replaced
5649:2c69577b28c2 5650:0eb2d5ea2428
35 on_retract = function (event) 35 on_retract = function (event)
36 local hash = event.item.attr.id; 36 local hash = event.item.attr.id;
37 if not hash then return; end 37 if not hash then return; end
38 module:log("debug", "Retracted hash: %s", hash); 38 module:log("debug", "Retracted hash: %s", hash);
39 banned_hashes[hash] = nil; 39 banned_hashes[hash] = nil;
40 end;
41
42 purge = function()
43 module:log("debug", "Purge all hashes");
44 for hash in pairs(banned_hashes) do
45 banned_hashes[hash] = nil;
46 end
40 end; 47 end;
41 }); 48 });
42 49
43 function request_list() 50 function request_list()
44 local items_request = st.iq({ to = rtbl_service_jid, from = module.host, type = "get", id = "rtbl-request" }) 51 local items_request = st.iq({ to = rtbl_service_jid, from = module.host, type = "get", id = "rtbl-request" })
144 end 151 end
145 end); 152 end);
146 153
147 module:hook("muc-private-message", function(event) 154 module:hook("muc-private-message", function(event)
148 local occupant = event.room:get_occupant_by_nick(event.stanza.attr.from); 155 local occupant = event.room:get_occupant_by_nick(event.stanza.attr.from);
149 local affiliation = event.room:get_affiliation(event.occupant.bare_jid); 156 local affiliation = event.room:get_affiliation(occupant.bare_jid);
150 if affiliation and affiliation ~= "none" then 157 if affiliation and affiliation ~= "none" then
151 -- Skip check for affiliated users 158 -- Skip check for affiliated users
152 return; 159 return;
153 end 160 end
154 161