diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-05-18 15:29:10 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-05-18 15:29:10 +0100 |
commit | e3dd43d3a9975de0d8a5a211610af72926b2e5ca (patch) | |
tree | 70b848e70291673d0a6447885341141bd3644248 | |
parent | b6b3ddaa333a074597d474b4ffa790c37f496757 (diff) | |
download | prosody-e3dd43d3a9975de0d8a5a211610af72926b2e5ca.tar.gz prosody-e3dd43d3a9975de0d8a5a211610af72926b2e5ca.zip |
mod_muc: Pass actor (requesting JID) when generating the config form, and to the muc-config-form event handler
-rw-r--r-- | plugins/muc/muc.lib.lua | 8 |
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 |