aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/muc/muc.lib.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-05-18 15:29:10 +0100
committerMatthew Wild <mwild1@gmail.com>2013-05-18 15:29:10 +0100
commit5cea0b157002bff872b559c59aa77b30ec2634df (patch)
tree70b848e70291673d0a6447885341141bd3644248 /plugins/muc/muc.lib.lua
parent5950b8bdd2cf6554204090fa6a69867d8236e749 (diff)
downloadprosody-5cea0b157002bff872b559c59aa77b30ec2634df.tar.gz
prosody-5cea0b157002bff872b559c59aa77b30ec2634df.zip
mod_muc: Pass actor (requesting JID) when generating the config form, and to the muc-config-form event handler
Diffstat (limited to 'plugins/muc/muc.lib.lua')
-rw-r--r--plugins/muc/muc.lib.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua
index 6b3bdcb0..68e36e83 100644
--- a/plugins/muc/muc.lib.lua
+++ b/plugins/muc/muc.lib.lua
@@ -594,11 +594,11 @@ end
function room_mt:send_form(origin, stanza)
origin.send(st.reply(stanza):query("http://jabber.org/protocol/muc#owner")
- :add_child(self:get_form_layout():form())
+ :add_child(self:get_form_layout(stanza.attr.from):form())
);
end
-function room_mt:get_form_layout()
+function room_mt:get_form_layout(actor)
local form = dataform.new({
title = "Configuration for "..self.jid,
instructions = "Complete and submit this form to configure the room.",
@@ -671,7 +671,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;
+ return module:fire_event("muc-config-form", { room = self, actor = actor, form = form }) or form;
end
function room_mt:process_form(origin, stanza)
@@ -682,7 +682,7 @@ function room_mt:process_form(origin, stanza)
if form.attr.type == "cancel" then origin.send(st.reply(stanza)); return; end
if form.attr.type ~= "submit" then origin.send(st.error_reply(stanza, "cancel", "bad-request", "Not a submitted form")); return; end
- local fields = self:get_form_layout():data(form);
+ local fields = self:get_form_layout(stanza.attr.from):data(form);
if fields.FORM_TYPE ~= "http://jabber.org/protocol/muc#roomconfig" then origin.send(st.error_reply(stanza, "cancel", "bad-request", "Form is not of type room configuration")); return; end