changeset 3623:da2d58208574

mod_muc_defaults: Allow setting of `name` and `description Also fix setting of language
author JC Brand <jc@opkode.com>
date Thu, 20 Jun 2019 10:37:48 +0200
parents 21f870e1ba55
children 3109a65ab7f4
files mod_muc_defaults/README.markdown mod_muc_defaults/mod_muc_defaults.lua
diffstat 2 files changed, 10 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_defaults/README.markdown	Sun Jun 16 02:00:34 2019 +0200
+++ b/mod_muc_defaults/README.markdown	Thu Jun 20 10:37:48 2019 +0200
@@ -21,10 +21,12 @@
                   visitors = { "visitor@example.org" }
          },
          config = {
+                  name = "General Chat",
+                  description = "Public chatroom with no particular topic",
                   allow_member_invites = false,
                   change_subject = false,
                   history_length = 40,
-                  language = "en",
+                  lang = "en",
                   logging = true,
                   members_only = false,
                   moderated = false,
--- a/mod_muc_defaults/mod_muc_defaults.lua	Sun Jun 16 02:00:34 2019 +0200
+++ b/mod_muc_defaults/mod_muc_defaults.lua	Thu Jun 20 10:37:48 2019 +0200
@@ -15,6 +15,12 @@
 
 local function configure_room(room, config)
 	local should_save = false;
+	if config.name ~= nil then
+		should_save = room:set_name(config.name) or should_save;
+	end
+	if config.description ~= nil then
+		should_save = room:set_description(config.description) or should_save;
+	end
 	if config.allow_member_invites ~= nil then
 		should_save =
 			room:set_allow_member_invites(config.allow_member_invites)
@@ -31,7 +37,7 @@
 			or should_save;
 	end
 	if config.lang ~= nil then
-		should_save = room:set_language(config.language) or should_save;
+		should_save = room:set_language(config.lang) or should_save;
 	end
 	if config.members_only ~= nil then
 		should_save =