aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc/muc.lib.lua
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/muc/muc.lib.lua')
-rw-r--r--plugins/muc/muc.lib.lua20
1 files changed, 19 insertions, 1 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 32d539e7..5d20b78a 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -212,7 +212,7 @@ end
function room_mt:get_disco_info(stanza)
return st.reply(stanza):query("http://jabber.org/protocol/disco#info")
- :tag("identity", {category="conference", type="text"}):up()
+ :tag("identity", {category="conference", type="text", name=self:get_name()}):up()
:tag("feature", {var="http://jabber.org/protocol/muc"}):up()
:tag("feature", {var=self:get_password() and "muc_passwordprotected" or "muc_unsecured"}):up()
:tag("feature", {var=self:is_moderated() and "muc_moderated" or "muc_unmoderated"}):up()
@@ -251,6 +251,16 @@ local function build_unavailable_presence_from_error(stanza)
:tag('status'):text(error_message);
end
+function room_mt:set_name(name)
+ if name == "" or type(name) ~= "string" then name = nil; end
+ if self._data.name ~= name then
+ self._data.name = name;
+ if self.save then self:save(true); end
+ end
+end
+function room_mt:get_name()
+ return self._data.name;
+end
function room_mt:set_password(password)
if password == "" or type(password) ~= "string" then password = nil; end
if self._data.password ~= password then
@@ -501,6 +511,9 @@ function room_mt:send_form(origin, stanza)
:tag("x", {xmlns='jabber:x:data', type='form'})
:tag("title"):text(title):up()
:tag("instructions"):text(title):up()
+ :tag("field", {type='text-single', label='Room Title', var='muc#roomconfig_roomname'})
+ :tag("value"):text(self:get_name() or ""):up()
+ :up()
:tag("field", {type='hidden', var='FORM_TYPE'}):tag("value"):text("http://jabber.org/protocol/muc#roomconfig"):up():up()
:tag("field", {type='boolean', label='Make Room Persistent?', var='muc#roomconfig_persistentroom'})
:tag("value"):text(self:is_persistent() and "1" or "0"):up()
@@ -551,6 +564,11 @@ function room_mt:process_form(origin, stanza)
local dirty = false
+ local name = fields['muc#roomconfig_roomname'];
+ if name then
+ self:set_name(name);
+ end
+
local persistent = fields['muc#roomconfig_persistentroom'];
if persistent == "0" or persistent == "false" then persistent = nil; elseif persistent == "1" or persistent == "true" then persistent = true;
else origin.send(st.error_reply(stanza, "cancel", "bad-request")); return; end