Comparison

mod_muc_rtbl/mod_muc_rtbl.lua @ 5274:8cfbcbc0fb89

mod_muc_rtbl: Handle node purge Prevents the module from going out of sync with the node in case this event ever happens.
author Kim Alvefur <zash@zash.se>
date Fri, 17 Mar 2023 22:29:55 +0100
parent 5177:f6b5f04d4b28
child 5352:f6577cdb1d91
comparison
equal deleted inserted replaced
5273:40be37652d70 5274:8cfbcbc0fb89
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" })