Software /
code /
prosody
Changeset
5601:f55ab5fa939f
mod_muc: Pass actor (requesting JID) when generating the config form, and to the muc-config-form event handler
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 18 May 2013 15:29:10 +0100 |
parents | 5600:1b326a1e4da6 |
children | 5602:e8a0e545ee05 |
files | plugins/muc/muc.lib.lua |
diffstat | 1 files changed, 4 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua Sat May 18 15:28:00 2013 +0100 +++ b/plugins/muc/muc.lib.lua Sat May 18 15:29:10 2013 +0100 @@ -594,11 +594,11 @@ 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 @@ 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 @@ 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