# HG changeset patch # User Matthew Wild # Date 1367230897 -3600 # Node ID 1997671d5e46ac360e7dab2995aa611b142bb09f # Parent 0ae7ed378405a90b4017e69d07986dccb7fb5002 MUC: Allow plugins to add and handle options in the MUC config form diff -r 0ae7ed378405 -r 1997671d5e46 plugins/muc/muc.lib.lua --- a/plugins/muc/muc.lib.lua Mon Apr 29 10:52:23 2013 +0100 +++ b/plugins/muc/muc.lib.lua Mon Apr 29 11:21:37 2013 +0100 @@ -580,10 +580,9 @@ 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 @@ 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 @@ 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);