Comparison

plugins/mod_pep.lua @ 8125:5f0c642a41a1

mod_pep: Handle disco#info queries to nodes (fixes #805)
author Kim Alvefur <zash@zash.se>
date Mon, 24 Apr 2017 23:27:21 +0200
parent 8124:20e92f6688b2
child 8329:83bab3c84671
comparison
equal deleted inserted replaced
8124:20e92f6688b2 8125:5f0c642a41a1
292 local bare = reply.attr.to; 292 local bare = reply.attr.to;
293 local user_data = data[bare]; 293 local user_data = data[bare];
294 294
295 if user_data then 295 if user_data then
296 for node, _ in pairs(user_data) do 296 for node, _ in pairs(user_data) do
297 reply:tag('item', {jid=bare, node=node}):up(); -- TODO we need to handle queries to these nodes 297 reply:tag('item', {jid=bare, node=node}):up();
298 end 298 end
299 end
300 end);
301
302 module:hook("account-disco-info-node", function (event)
303 local session, stanza, node = event.origin, event.stanza, event.node;
304 local user = stanza.attr.to;
305 local user_data = data[user];
306 if user_data and user_data[node] then
307 event.exists = true;
308 event.reply:tag('identity', {category='pubsub', type='leaf'}):up();
299 end 309 end
300 end); 310 end);
301 311
302 module:hook("resource-unbind", function (event) 312 module:hook("resource-unbind", function (event)
303 local user_bare_jid = event.session.username.."@"..event.session.host; 313 local user_bare_jid = event.session.username.."@"..event.session.host;