aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-04-29 11:27:17 +0100
committerMatthew Wild <mwild1@gmail.com>2013-04-29 11:27:17 +0100
commit201ccbe3b55104da18c030c22b1b8f897fa13710 (patch)
tree597ff844cc8161cd1787290e9eda8f1fe60eadbe
parent40f947f6e9650955cfbf4cd58e8a6a9d427cc660 (diff)
parent362a2f35ba63df76c7b6b3d9aa7d2de4fe5d38b7 (diff)
downloadprosody-201ccbe3b55104da18c030c22b1b8f897fa13710.tar.gz
prosody-201ccbe3b55104da18c030c22b1b8f897fa13710.zip
Merge 0.9->trunk
-rw-r--r--plugins/muc/muc.lib.lua17
1 files changed, 11 insertions, 6 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 3af8c766..a5aba3c8 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);
@@ -1049,11 +1053,12 @@ function room_mt:get_role(nick)
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