Software /
code /
prosody
Comparison
plugins/muc/mod_muc.lua @ 13233:37d67b5f9768
mod_muc: Use enum config API for 'restrict_room_creation'
This communicates the accepted values in case the config diverges from
them. Note that older documentation used an "admin" value behaving like
an alias to true, but this is no longer handled. Should it?
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 21 Jul 2023 22:49:01 +0200 |
parent | 13229:bb7177efbf41 |
comparison
equal
deleted
inserted
replaced
13232:e0ab20519ce5 | 13233:37d67b5f9768 |
---|---|
410 tombstone:save(true); | 410 tombstone:save(true); |
411 return true; | 411 return true; |
412 end, -10); | 412 end, -10); |
413 end | 413 end |
414 | 414 |
415 local restrict_room_creation = module:get_option("restrict_room_creation"); | 415 local restrict_room_creation = module:get_option_enum("restrict_room_creation", false, true, "local"); |
416 module:default_permission(restrict_room_creation == true and "prosody:admin" or "prosody:registered", ":create-room"); | 416 module:default_permission(restrict_room_creation == true and "prosody:admin" or "prosody:registered", ":create-room"); |
417 module:hook("muc-room-pre-create", function(event) | 417 module:hook("muc-room-pre-create", function(event) |
418 local origin, stanza = event.origin, event.stanza; | 418 local origin, stanza = event.origin, event.stanza; |
419 if restrict_room_creation ~= false and not module:may(":create-room", event) then | 419 if restrict_room_creation ~= false and not module:may(":create-room", event) then |
420 origin.send(st.error_reply(stanza, "cancel", "not-allowed", "Room creation is restricted", module.host)); | 420 origin.send(st.error_reply(stanza, "cancel", "not-allowed", "Room creation is restricted", module.host)); |