# HG changeset patch # User Kim Alvefur # Date 1493069241 -7200 # Node ID 5f0c642a41a1cae1481444ed8a137f48a7f8572d # Parent 20e92f6688b26d9541a742d583d97419b3881487 mod_pep: Handle disco#info queries to nodes (fixes #805) diff -r 20e92f6688b2 -r 5f0c642a41a1 plugins/mod_pep.lua --- a/plugins/mod_pep.lua Mon Apr 24 22:19:27 2017 +0200 +++ b/plugins/mod_pep.lua Mon Apr 24 23:27:21 2017 +0200 @@ -294,11 +294,21 @@ if user_data then for node, _ in pairs(user_data) do - reply:tag('item', {jid=bare, node=node}):up(); -- TODO we need to handle queries to these nodes + reply:tag('item', {jid=bare, node=node}):up(); end end end); +module:hook("account-disco-info-node", function (event) + local session, stanza, node = event.origin, event.stanza, event.node; + local user = stanza.attr.to; + local user_data = data[user]; + if user_data and user_data[node] then + event.exists = true; + event.reply:tag('identity', {category='pubsub', type='leaf'}):up(); + end +end); + module:hook("resource-unbind", function (event) local user_bare_jid = event.session.username.."@"..event.session.host; if not bare_sessions[user_bare_jid] then -- User went offline