# HG changeset patch # User Kim Alvefur # Date 1430821292 -7200 # Node ID f1af4edd5722fe66416f4b055b3b3b7e4bd22af3 # Parent 99fa40d498cc05f5d3d5663c98377f215776aa89 mod_pubsub: Add option for default affiliation of non-existent nodes (thanks Flow) diff -r 99fa40d498cc -r f1af4edd5722 plugins/mod_pubsub/mod_pubsub.lua --- 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)