Software /
code /
prosody
Comparison
plugins/mod_mimicking.lua @ 11848:b4d4f0339e16
mod_mimicking: Correctly hook the *global* user-deleted event
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 12 Oct 2021 17:55:53 +0200 |
parent | 9986:9cb639ef5c72 |
child | 12977:74b9e05af71e |
comparison
equal
deleted
inserted
replaced
11847:2b3ce80ffece | 11848:b4d4f0339e16 |
---|---|
27 if not ok then | 27 if not ok then |
28 module:log("error", "Unable to store mimicry data (%q => %q): %s", user.username, skel, err); | 28 module:log("error", "Unable to store mimicry data (%q => %q): %s", user.username, skel, err); |
29 end | 29 end |
30 end); | 30 end); |
31 | 31 |
32 module:hook("user-deleted", function(user) | 32 module:hook_global("user-deleted", function(user) |
33 if user.host ~= module.host then return end | |
33 local skel = skeleton(user.username); | 34 local skel = skeleton(user.username); |
34 local ok, err = skeletons:set(skel, nil); | 35 local ok, err = skeletons:set(skel, nil); |
35 if not ok and err then | 36 if not ok and err then |
36 module:log("error", "Unable to clear mimicry data (%q): %s", skel, err); | 37 module:log("error", "Unable to clear mimicry data (%q): %s", skel, err); |
37 end | 38 end |