Software /
code /
prosody
Comparison
plugins/mod_blocklist.lua @ 7620:c27c9695d130
mod_blocklist: Decrease priority of iq hooks to ease handling by other modules
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 20 Aug 2016 17:24:08 +0200 |
parent | 7079:f094683ae6eb |
child | 7621:b8c03df6e8ca |
comparison
equal
deleted
inserted
replaced
7618:5a09c1166d89 | 7620:c27c9695d130 |
---|---|
111 end | 111 end |
112 end | 112 end |
113 origin.interested_blocklist = true; -- Gets notified about changes | 113 origin.interested_blocklist = true; -- Gets notified about changes |
114 origin.send(reply); | 114 origin.send(reply); |
115 return true; | 115 return true; |
116 end); | 116 end, -1); |
117 | 117 |
118 -- Add or remove some jid(s) from the blocklist | 118 -- Add or remove some jid(s) from the blocklist |
119 -- We want this to be atomic and not do a partial update | 119 -- We want this to be atomic and not do a partial update |
120 local function edit_blocklist(event) | 120 local function edit_blocklist(event) |
121 local origin, stanza = event.origin, event.stanza; | 121 local origin, stanza = event.origin, event.stanza; |
213 end | 213 end |
214 | 214 |
215 return true; | 215 return true; |
216 end | 216 end |
217 | 217 |
218 module:hook("iq-set/self/urn:xmpp:blocking:block", edit_blocklist); | 218 module:hook("iq-set/self/urn:xmpp:blocking:block", edit_blocklist, -1); |
219 module:hook("iq-set/self/urn:xmpp:blocking:unblock", edit_blocklist); | 219 module:hook("iq-set/self/urn:xmpp:blocking:unblock", edit_blocklist, -1); |
220 | 220 |
221 -- Cache invalidation, solved! | 221 -- Cache invalidation, solved! |
222 module:hook_global("user-deleted", function (event) | 222 module:hook_global("user-deleted", function (event) |
223 if event.host == module.host then | 223 if event.host == module.host then |
224 cache2:set(event.username, nil); | 224 cache2:set(event.username, nil); |