aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_pubsub/mod_pubsub.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2017-10-18 09:38:45 +0200
committerKim Alvefur <zash@zash.se>2017-10-18 09:38:45 +0200
commit7aa48bf4096cad84f7c2fd6d790cc2d4cb38a3b1 (patch)
tree4d2097de1c4ca9ae0c25743a0854ff290c4f5d43 /plugins/mod_pubsub/mod_pubsub.lua
parentb97c23393ad658dd84ad45aa974b24b0612fecad (diff)
downloadprosody-7aa48bf4096cad84f7c2fd6d790cc2d4cb38a3b1.tar.gz
prosody-7aa48bf4096cad84f7c2fd6d790cc2d4cb38a3b1.zip
mod_pubsub: Move service feature dection to pubsub.lib to allow reuse
Diffstat (limited to 'plugins/mod_pubsub/mod_pubsub.lua')
-rw-r--r--plugins/mod_pubsub/mod_pubsub.lua28
1 files changed, 2 insertions, 26 deletions
diff --git a/plugins/mod_pubsub/mod_pubsub.lua b/plugins/mod_pubsub/mod_pubsub.lua
index 6ebbe765..0e00c427 100644
--- a/plugins/mod_pubsub/mod_pubsub.lua
+++ b/plugins/mod_pubsub/mod_pubsub.lua
@@ -60,33 +60,9 @@ end
module:hook("iq/host/"..xmlns_pubsub..":pubsub", handle_pubsub_iq);
module:hook("iq/host/"..xmlns_pubsub_owner..":pubsub", handle_pubsub_iq);
-local feature_map = {
- create = { "create-nodes", "instant-nodes", "item-ids", "create-and-configure" };
- retract = { "delete-items", "retract-items" };
- purge = { "purge-nodes" };
- publish = { "publish", autocreate_on_publish and "auto-create" };
- delete = { "delete-nodes" };
- get_items = { "retrieve-items" };
- add_subscription = { "subscribe" };
- get_subscriptions = { "retrieve-subscriptions" };
- set_node_config = { "config-node" };
- node_defaults = { "retrieve-default" };
-};
-
local function add_disco_features_from_service(service)
- for method, features in pairs(feature_map) do
- if service[method] then
- for _, feature in ipairs(features) do
- if feature then
- module:add_feature(xmlns_pubsub.."#"..feature);
- end
- end
- end
- end
- for affiliation in pairs(service.config.capabilities) do
- if affiliation ~= "none" and affiliation ~= "owner" then
- module:add_feature(xmlns_pubsub.."#"..affiliation.."-affiliation");
- end
+ for feature in lib_pubsub.get_feature_set(service) do
+ module:add_feature(xmlns_pubsub.."#"..feature);
end
end