Software /
code /
prosody
Changeset
6972:9e926e48cbf9
mod_blocklist: session[username] can't possibly be unset if that user is sending queries
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 06 Dec 2015 02:19:04 +0100 |
parents | 6971:96080d86bab8 |
children | 6973:f350f840a6f7 |
files | plugins/mod_blocklist.lua |
diffstat | 1 files changed, 8 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_blocklist.lua Sun Dec 06 02:12:28 2015 +0100 +++ b/plugins/mod_blocklist.lua Sun Dec 06 02:19:04 2015 +0100 @@ -162,7 +162,7 @@ if is_blocking then for jid, in_roster in pairs(new) do - if not blocklist[jid] and in_roster and sessions[username] then + if not blocklist[jid] and in_roster then for _, session in pairs(sessions[username].sessions) do if session.presence then module:send(st.presence({ type = "unavailable", to = jid, from = session.full_jid })); @@ -171,15 +171,14 @@ end end end - if sessions[username] then - local blocklist_push = st.iq({ type = "set", id = "blocklist-push" }) - :add_child(action); -- I am lazy + + local blocklist_push = st.iq({ type = "set", id = "blocklist-push" }) + :add_child(action); -- I am lazy - for _, session in pairs(sessions[username].sessions) do - if session.interested_blocklist then - blocklist_push.attr.to = session.full_jid; - session.send(blocklist_push); - end + for _, session in pairs(sessions[username].sessions) do + if session.interested_blocklist then + blocklist_push.attr.to = session.full_jid; + session.send(blocklist_push); end end