Diff

plugins/mod_pubsub/mod_pubsub.lua @ 6657:f1af4edd5722

mod_pubsub: Add option for default affiliation of non-existent nodes (thanks Flow)
author Kim Alvefur <zash@zash.se>
date Tue, 05 May 2015 12:21:32 +0200
parent 6515:c9a72c64c3e2
child 6666:42fdc8dddf04
child 6841:be87ab2d611c
line wrap: on
line diff
--- a/plugins/mod_pubsub/mod_pubsub.lua	Tue May 05 00:48:55 2015 +0200
+++ b/plugins/mod_pubsub/mod_pubsub.lua	Tue May 05 12:21:32 2015 +0200
@@ -125,11 +125,15 @@
 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)