# HG changeset patch # User Matthew Wild # Date 1367231237 -3600 # Node ID d3f5165c4113b5df9f6a424228591ac6ed4661a5 # Parent 34ec169206857aae7175b192af9b431d80c83263# Parent 329ebdfb39a2360394f5ce89afa072b07b802fee Merge 0.9->trunk diff -r 34ec16920685 -r d3f5165c4113 plugins/muc/muc.lib.lua --- a/plugins/muc/muc.lib.lua Mon Apr 29 10:54:25 2013 +0100 +++ b/plugins/muc/muc.lib.lua Mon Apr 29 11:27:17 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); @@ -1049,11 +1053,12 @@ return session and session.role or nil; end function room_mt:can_set_role(actor_jid, occupant_jid, role) - local actor = self._occupants[self._jid_nick[actor_jid]]; local occupant = self._occupants[occupant_jid]; - if not occupant or not actor then return nil, "modify", "not-acceptable"; end + if actor_jid == true then return true; end + + local actor = self._occupants[self._jid_nick[actor_jid]]; if actor.role == "moderator" then if occupant.affiliation ~= "owner" and occupant.affiliation ~= "admin" then if actor.affiliation == "owner" or actor.affiliation == "admin" then