aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2018-07-06 17:59:39 +0200
committerKim Alvefur <zash@zash.se>2018-07-06 17:59:39 +0200
commit509291661cb9c5980420d89ff8b765e2e1873959 (patch)
tree6e9da86d683c3d2b4a797e7a92f45441f18d4416 /plugins
parentb59c5e0f68407f7be7c1e1a78ceb7ccb11071844 (diff)
downloadprosody-509291661cb9c5980420d89ff8b765e2e1873959.tar.gz
prosody-509291661cb9c5980420d89ff8b765e2e1873959.zip
mod_pep_plus: Use service discovery helpers from pubsub.lib
Diffstat (limited to 'plugins')
-rw-r--r--plugins/mod_pep_plus.lua20
1 files changed, 4 insertions, 16 deletions
diff --git a/plugins/mod_pep_plus.lua b/plugins/mod_pep_plus.lua
index e06a65b3..539fe9af 100644
--- a/plugins/mod_pep_plus.lua
+++ b/plugins/mod_pep_plus.lua
@@ -423,17 +423,13 @@ module:hook("iq-result/bare/disco", function(event)
end);
module:hook("account-disco-info-node", function(event)
- local reply, stanza, origin = event.reply, event.stanza, event.origin;
+ local stanza, origin = event.stanza, event.origin;
local service_name = origin.username;
if stanza.attr.to ~= nil then
service_name = jid_split(stanza.attr.to);
end
local service = get_pep_service(service_name);
- local node = event.node;
- local ok = service:get_items(node, jid_bare(stanza.attr.from) or true);
- if not ok then return; end
- event.exists = true;
- reply:tag('identity', {category='pubsub', type='leaf'}):up();
+ return lib_pubsub.handle_disco_info_node(event, service);
end);
module:hook("account-disco-info", function(event)
@@ -461,22 +457,14 @@ module:hook("account-disco-info", function(event)
end);
module:hook("account-disco-items-node", function(event)
- local reply, stanza, origin = event.reply, event.stanza, event.origin;
- local node = event.node;
+ local stanza, origin = event.stanza, event.origin;
local is_self = stanza.attr.to == nil;
- local user_bare = jid_bare(stanza.attr.to);
local username = jid_split(stanza.attr.to);
if is_self then
username = origin.username;
- user_bare = jid_join(username, host);
end
local service = get_pep_service(username);
- local ok, ret = service:get_items(node, jid_bare(stanza.attr.from) or true);
- if not ok then return; end
- event.exists = true;
- for _, id in ipairs(ret) do
- reply:tag("item", { jid = user_bare, name = id }):up();
- end
+ return lib_pubsub.handle_disco_items_node(event, service);
end);
module:hook("account-disco-items", function(event)