diff options
author | Matthew Wild <mwild1@gmail.com> | 2018-07-07 12:14:29 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2018-07-07 12:14:29 +0100 |
commit | 40c4305e2f23a6c32c51d711c6b8aca6fdfb33eb (patch) | |
tree | a95df5888ac3f95409b7a69dad57e8a912202358 /plugins/muc/name.lib.lua | |
parent | fe271c1641d61f8d72c99d970120b59c9a51471b (diff) | |
download | prosody-40c4305e2f23a6c32c51d711c6b8aca6fdfb33eb.tar.gz prosody-40c4305e2f23a6c32c51d711c6b8aca6fdfb33eb.zip |
MUC: Add roomconfig_roomname to disco#info, and ensure it's not auto-generated
Diffstat (limited to 'plugins/muc/name.lib.lua')
-rw-r--r-- | plugins/muc/name.lib.lua | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/plugins/muc/name.lib.lua b/plugins/muc/name.lib.lua index 2dcb979a..1449c1be 100644 --- a/plugins/muc/name.lib.lua +++ b/plugins/muc/name.lib.lua @@ -14,24 +14,27 @@ local function get_name(room) end local function set_name(room, name) - if name == "" or name == (jid_split(room.jid)) then name = nil; end + if name == "" then name = nil; end if room._data.name == name then return false; end room._data.name = name; return true; end -module:hook("muc-disco#info", function(event) - event.reply:tag("identity", {category="conference", type="text", name=get_name(event.room)}):up(); -end); - -module:hook("muc-config-form", function(event) +local function insert_name_into_form(event); table.insert(event.form, { name = "muc#roomconfig_roomname"; type = "text-single"; label = "Name"; - value = get_name(event.room) or ""; + value = event.room._data.name; }); -end, 100-1); +end + +module:hook("muc-disco#info", function(event) + event.reply:tag("identity", {category="conference", type="text", name=get_name(event.room)}):up(); + insert_name_into_form(event); +end); + +module:hook("muc-config-form", insert_name_into_form, 100-1); module:hook("muc-config-submitted/muc#roomconfig_roomname", function(event) if set_name(event.room, event.value) then |