Software /
code /
prosody-modules
Changeset
2580:aaff2716f022
mod_firewall: Compatibility fix for 0.9 (no module:unhook())
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 25 Feb 2017 17:05:40 +0000 |
parents | 2579:5e948d1392a5 |
children | 2581:0116672348c4 |
files | mod_firewall/mod_firewall.lua |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_firewall/mod_firewall.lua Sat Feb 25 16:55:02 2017 +0000 +++ b/mod_firewall/mod_firewall.lua Sat Feb 25 17:05:40 2017 +0000 @@ -604,6 +604,11 @@ module:log("debug", "Loaded %s", script); end +--COMPAT w/0.9 (no module:unhook()!) +local function module_unhook(event, handler) + return module:unhook_object_event((hosts[module.host] or prosody).events, event, handler); +end + function unload_script(script, is_reload) script = resolve_script_path(script); local script_info = loaded_scripts[script]; @@ -612,7 +617,7 @@ end local events_hooked = script_info.events_hooked; for event_name, event_handler in pairs(events_hooked) do - module:unhook(event_name, event_handler); + module_unhook(event_name, event_handler); events_hooked[event_name] = nil; end loaded_scripts[script] = nil;