Comparison

util/pubsub.lua @ 7703:74e755674e0f

util.pubsub: Rename loop variable to avoid name clash [luacheck]
author Kim Alvefur <zash@zash.se>
date Tue, 18 Oct 2016 15:29:23 +0200
parent 7696:1c410b4f3a58
child 7704:5022e6181193
child 7726:29c20eefa306
comparison
equal deleted inserted replaced
7702:9385c367e920 7703:74e755674e0f
369 local subs = self.subscriptions[normal_jid]; 369 local subs = self.subscriptions[normal_jid];
370 -- We return the subscription object from the node to save 370 -- We return the subscription object from the node to save
371 -- a get_subscription() call for each node. 371 -- a get_subscription() call for each node.
372 local ret = {}; 372 local ret = {};
373 if subs then 373 if subs then
374 for jid, subscribed_nodes in pairs(subs) do 374 for subscribed_jid, subscribed_nodes in pairs(subs) do
375 if node then -- Return only subscriptions to this node 375 if node then -- Return only subscriptions to this node
376 if subscribed_nodes[node] then 376 if subscribed_nodes[node] then
377 ret[#ret+1] = { 377 ret[#ret+1] = {
378 node = node; 378 node = node;
379 jid = jid; 379 jid = subscribed_jid;
380 subscription = node_obj.subscribers[jid]; 380 subscription = node_obj.subscribers[subscribed_jid];
381 }; 381 };
382 end 382 end
383 else -- Return subscriptions to all nodes 383 else -- Return subscriptions to all nodes
384 local nodes = self.nodes; 384 local nodes = self.nodes;
385 for subscribed_node in pairs(subscribed_nodes) do 385 for subscribed_node in pairs(subscribed_nodes) do
386 ret[#ret+1] = { 386 ret[#ret+1] = {
387 node = subscribed_node; 387 node = subscribed_node;
388 jid = jid; 388 jid = subscribed_jid;
389 subscription = nodes[subscribed_node].subscribers[jid]; 389 subscription = nodes[subscribed_node].subscribers[subscribed_jid];
390 }; 390 };
391 end 391 end
392 end 392 end
393 end 393 end
394 end 394 end