Software / code / prosody
Comparison
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 |
comparison
equal
deleted
inserted
replaced
| 6649:99fa40d498cc | 6657:f1af4edd5722 |
|---|---|
| 123 reply:tag("item", { jid = module.host, node = node, name = node_obj.config.name }):up(); | 123 reply:tag("item", { jid = module.host, node = node, name = node_obj.config.name }):up(); |
| 124 end | 124 end |
| 125 end); | 125 end); |
| 126 | 126 |
| 127 local admin_aff = module:get_option_string("default_admin_affiliation", "owner"); | 127 local admin_aff = module:get_option_string("default_admin_affiliation", "owner"); |
| 128 local function get_affiliation(jid) | 128 local unowned_aff = module:get_option_string("default_unowned_affiliation"); |
| 129 local function get_affiliation(jid, node) | |
| 129 local bare_jid = jid_bare(jid); | 130 local bare_jid = jid_bare(jid); |
| 130 if bare_jid == module.host or usermanager.is_admin(bare_jid, module.host) then | 131 if bare_jid == module.host or usermanager.is_admin(bare_jid, module.host) then |
| 131 return admin_aff; | 132 return admin_aff; |
| 133 end | |
| 134 if not node then | |
| 135 return unowned_aff; | |
| 132 end | 136 end |
| 133 end | 137 end |
| 134 | 138 |
| 135 function set_service(new_service) | 139 function set_service(new_service) |
| 136 service = new_service; | 140 service = new_service; |