# HG changeset patch # User Kim Alvefur # Date 1407950528 -7200 # Node ID bbb4a82db32e43db4107e38bc1594026316a34b4 # Parent 0cee68dd35f8405f836398b889d2c62f7d6f6dd9# Parent a868d5d6a83f2b5883c94905508939f89c745754 Merge 0.10->trunk diff -r 0cee68dd35f8 -r bbb4a82db32e plugins/mod_blocklist.lua --- a/plugins/mod_blocklist.lua Tue Aug 12 11:38:12 2014 +0200 +++ b/plugins/mod_blocklist.lua Wed Aug 13 19:22:08 2014 +0200 @@ -98,16 +98,16 @@ return origin.send(reply); end); --- Add or remove a bare jid from the blocklist +-- Add or remove some jid(s) from the blocklist -- We want this to be atomic and not do a partial update local function edit_blocklist(event) local origin, stanza = event.origin, event.stanza; local username = origin.username; - local act = stanza.tags[1]; + local action = stanza.tags[1]; local new = {}; local jid; - for item in act:childtags("item") do + for item in action:childtags("item") do jid = jid_prep(item.attr.jid); if not jid then return origin.send(st_error_reply(stanza, "modify", "jid-malformed")); @@ -116,7 +116,7 @@ new[jid] = is_contact_subscribed(username, host, jid) or false; end - local mode = act.name == "block" or nil; + local mode = action.name == "block" or nil; if mode and not next(new) then -- element does not contain at least one child element @@ -127,7 +127,7 @@ local new_blocklist = {}; - if mode and next(new) then + if mode or next(new) then for jid in pairs(blocklist) do new_blocklist[jid] = true; end @@ -156,7 +156,7 @@ end if sessions[username] then local blocklist_push = st.iq({ type = "set", id = "blocklist-push" }) - :add_child(act); -- I am lazy + :add_child(action); -- I am lazy for _, session in pairs(sessions[username].sessions) do if session.interested_blocklist then diff -r 0cee68dd35f8 -r bbb4a82db32e plugins/mod_private.lua