From b28517b48bddf4ac57cdfd57b618c53251685940 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 5 May 2015 12:21:32 +0200 Subject: mod_pubsub: Add option for default affiliation of non-existent nodes (thanks Flow) --- plugins/mod_pubsub/mod_pubsub.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'plugins/mod_pubsub/mod_pubsub.lua') diff --git a/plugins/mod_pubsub/mod_pubsub.lua b/plugins/mod_pubsub/mod_pubsub.lua index de027b58..40c28d27 100644 --- a/plugins/mod_pubsub/mod_pubsub.lua +++ b/plugins/mod_pubsub/mod_pubsub.lua @@ -125,11 +125,15 @@ module:hook("host-disco-items", function (event) end); local admin_aff = module:get_option_string("default_admin_affiliation", "owner"); -local function get_affiliation(jid) +local unowned_aff = module:get_option_string("default_unowned_affiliation"); +local function get_affiliation(jid, node) local bare_jid = jid_bare(jid); if bare_jid == module.host or usermanager.is_admin(bare_jid, module.host) then return admin_aff; end + if not node then + return unowned_aff; + end end function set_service(new_service) -- cgit v1.2.3