plugins/mod_pep_plus.lua
changeset 8217 da8bc600902a
parent 6452 24cd03cd1847
child 8218 835bb32c36b4
--- a/plugins/mod_pep_plus.lua	Sat Apr 15 01:21:55 2017 +0100
+++ b/plugins/mod_pep_plus.lua	Sat Apr 15 01:26:19 2017 +0100
@@ -12,7 +12,6 @@
 
 local lib_pubsub = module:require "pubsub";
 local handlers = lib_pubsub.handlers;
-local pubsub_error_reply = lib_pubsub.pubsub_error_reply;
 
 local empty_set = set_new();
 
@@ -179,8 +178,8 @@
 
 function handle_pubsub_iq(event)
 	local origin, stanza = event.origin, event.stanza;
-	local pubsub = stanza.tags[1];
-	local action = pubsub.tags[1];
+	local pubsub_tag = stanza.tags[1];
+	local action = pubsub_tag.tags[1];
 	if not action then
 		return origin.send(st.error_reply(stanza, "cancel", "bad-request"));
 	end
@@ -225,7 +224,7 @@
 local function resend_last_item(jid, node, service)
 	local ok, items = service:get_items(node, jid);
 	if not ok then return; end
-	for i, id in ipairs(items) do
+	for _, id in ipairs(items) do
 		service.config.broadcaster("items", node, { [jid] = true }, items[id]);
 	end
 end
@@ -271,7 +270,6 @@
 	local user = stanza.attr.to or (origin.username..'@'..origin.host);
 	local t = stanza.attr.type;
 	local self = not stanza.attr.to;
-	local service = get_pep_service(user);
 
 	if not t then -- available presence
 		if self or subscription_presence(user, stanza.attr.from) then