From ea8e101a96e9e0150ddf86fcf5475285f4427f3e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 12 Aug 2014 15:38:48 +0200 Subject: mod_blocklist: Fix any unblock emptying the blocklist --- plugins/mod_blocklist.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_blocklist.lua b/plugins/mod_blocklist.lua index 41a66f35..1a43dfd3 100644 --- a/plugins/mod_blocklist.lua +++ b/plugins/mod_blocklist.lua @@ -127,7 +127,7 @@ local function edit_blocklist(event) 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 -- cgit v1.2.3 From 49c8878c9dfdea2269eb131cec83b06eb6c1dd32 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 12 Aug 2014 15:40:00 +0200 Subject: mod_blocklist: Correct comment --- plugins/mod_blocklist.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_blocklist.lua b/plugins/mod_blocklist.lua index 1a43dfd3..3d528eb1 100644 --- a/plugins/mod_blocklist.lua +++ b/plugins/mod_blocklist.lua @@ -98,7 +98,7 @@ module:hook("iq-get/self/urn:xmpp:blocking:blocklist", function (event) 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; -- cgit v1.2.3 From 7315c5156d8fada5ee2c504b72f94f1262ed74d1 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 12 Aug 2014 15:42:20 +0200 Subject: mod_blocklist: Use full word as variable name, we can afford that --- plugins/mod_blocklist.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_blocklist.lua b/plugins/mod_blocklist.lua index 3d528eb1..dca729f0 100644 --- a/plugins/mod_blocklist.lua +++ b/plugins/mod_blocklist.lua @@ -103,11 +103,11 @@ end); 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 @@ local function edit_blocklist(event) 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 @@ -156,7 +156,7 @@ local function edit_blocklist(event) 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 -- cgit v1.2.3 From 44a989459cd0943b099df727214fc04a0f87d3b3 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Wed, 13 Aug 2014 19:19:34 +0200 Subject: mod_private: Fix traceback due to missing table index --- plugins/mod_private.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins') diff --git a/plugins/mod_private.lua b/plugins/mod_private.lua index 872d3760..8bca5154 100644 --- a/plugins/mod_private.lua +++ b/plugins/mod_private.lua @@ -27,7 +27,7 @@ module:hook("iq/self/jabber:iq:private:query", function(event) end if stanza.attr.type == "get" then if data and data[key] then - return origin.send(st.reply(stanza):query("jabber:iq:private"):add_child(st.deserialize(data))); + return origin.send(st.reply(stanza):query("jabber:iq:private"):add_child(st.deserialize(data[key]))); else return origin.send(st.reply(stanza):add_child(query)); end -- cgit v1.2.3