diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-04-29 11:21:37 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-04-29 11:21:37 +0100 |
commit | 6fab120cf50b15b2afdf8befe1c39c4c955ab394 (patch) | |
tree | 0d45e6331e40690eabf05e8024cfefdaf8f6882f /plugins | |
parent | c01af4ad34666bc41d100aaedbd50c129c56d703 (diff) | |
download | prosody-6fab120cf50b15b2afdf8befe1c39c4c955ab394.tar.gz prosody-6fab120cf50b15b2afdf8befe1c39c4c955ab394.zip |
MUC: Allow plugins to add and handle options in the MUC config form
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/muc/muc.lib.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 3af8c766..d3e6b1ee 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -580,10 +580,9 @@ function room_mt:send_form(origin, stanza) end function room_mt:get_form_layout() - local title = "Configuration for "..self.jid; - return dataform.new({ - title = title, - instructions = title, + local form = dataform.new({ + title = "Configuration for "..self.jid, + instructions = "Complete and submit this form to configure the room.", { name = 'FORM_TYPE', type = 'hidden', @@ -653,6 +652,7 @@ function room_mt:get_form_layout() value = tostring(self:get_historylength()) } }); + return module:fire_event("muc-config-form", { room = self, form = form }) or form; end local valid_whois = { @@ -673,6 +673,10 @@ function room_mt:process_form(origin, stanza) local dirty = false + local event = { room = self, fields = fields, changed = dirty }; + module:fire_event("muc-config-submitted", event); + dirty = event.changed or dirty; + local name = fields['muc#roomconfig_roomname']; if name ~= self:get_name() then self:set_name(name); |