diff options
author | Kim Alvefur <zash@zash.se> | 2018-06-03 14:43:06 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2018-06-03 14:43:06 +0200 |
commit | f541295344f14d2be19dd8197c260f319ea6d20c (patch) | |
tree | 64fc6f8eb3f8902bd84d1d3b557ff3a748e9d1fb /plugins/muc/mod_muc.lua | |
parent | 5e5a66ffa7ff4d3c57e0d07660f118ac63f24a60 (diff) | |
download | prosody-f541295344f14d2be19dd8197c260f319ea6d20c.tar.gz prosody-f541295344f14d2be19dd8197c260f319ea6d20c.zip |
MUC: Add support for setting MUC room defaults from the config file
Defaults are roughtly like this:
muc_rooom_default_public = true
muc_rooom_default_persistent = false
muc_rooom_default_members_only = false
muc_rooom_default_moderated = false
muc_rooom_default_public_jids = false
muc_rooom_default_change_subject = false
muc_room_default_history_length = 20
muc_room_default_language = nil
Diffstat (limited to 'plugins/muc/mod_muc.lua')
-rw-r--r-- | plugins/muc/mod_muc.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/plugins/muc/mod_muc.lua b/plugins/muc/mod_muc.lua index adbfb64c..7be8c2d3 100644 --- a/plugins/muc/mod_muc.lua +++ b/plugins/muc/mod_muc.lua @@ -283,6 +283,18 @@ module:hook("host-disco-items", function(event) end end); +module:hook("muc-room-pre-create", function (event) + local room = event.room; + room:set_public(module:get_option_boolean("muc_rooom_default_public", room:get_public())); + room:set_persistent(module:get_option_boolean("muc_rooom_default_persistent", room:get_persistent())); + room:set_members_only(module:get_option_boolean("muc_rooom_default_members_only", room:get_members_only())); + room:set_moderated(module:get_option_boolean("muc_rooom_default_moderated", room:get_moderated())); + room:set_whois(module:get_option_boolean("muc_rooom_default_public_jids", room:get_whois() == "anyone") and "anyone" or "moderators"); + room:set_changesubject(module:get_option_boolean("muc_rooom_default_change_subject", room:get_changesubject())); + room:set_historylength(module:get_option_number("muc_room_default_history_length", room:get_historylength())); + room:set_language(module:get_option_string("muc_room_default_language")); +end, 1); + module:hook("muc-room-pre-create", function(event) local origin, stanza = event.origin, event.stanza; if not track_room(event.room) then |