aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-04-24 23:27:21 +0200
committerKim Alvefur <zash@zash.se>2017-04-24 23:27:21 +0200
commit68985af22031ad9bb33b9a7b7978996f800b59f2 (patch)
tree725bbb1ec01ab96866bb3f16b00677df259db26b
parenta1f3236d0fde818156046c50c7d1afbbefb18963 (diff)
downloadprosody-68985af22031ad9bb33b9a7b7978996f800b59f2.tar.gz
prosody-68985af22031ad9bb33b9a7b7978996f800b59f2.zip
mod_pep: Handle disco#info queries to nodes (fixes #805)
-rw-r--r--plugins/mod_pep.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/plugins/mod_pep.lua b/plugins/mod_pep.lua
index 7b1a50af..1025be37 100644
--- a/plugins/mod_pep.lua
+++ b/plugins/mod_pep.lua
@@ -294,11 +294,21 @@ module:hook("account-disco-items", function(event)
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