Mercurial > prosody-modules
comparison mod_compat_muc_admin/mod_compat_muc_admin.lua @ 628:c72be31941fa
mod_compat_muc_admin: we shall make sure that only owners can destroy rooms and not everyone, isn't it?
| author | Marco Cirillo <maranda@lightwitch.org> |
|---|---|
| date | Tue, 27 Mar 2012 16:07:52 +0000 |
| parents | a8ff69c9b498 |
| children | 7d4cde86b12e |
comparison
equal
deleted
inserted
replaced
| 627:a8ff69c9b498 | 628:c72be31941fa |
|---|---|
| 115 self:process_form(origin, stanza); | 115 self:process_form(origin, stanza); |
| 116 end | 116 end |
| 117 elseif xmlns == xmlns_mo and stanza.tags[1].tags[1] then | 117 elseif xmlns == xmlns_mo and stanza.tags[1].tags[1] then |
| 118 local child = stanza.tags[1].tags[1]; | 118 local child = stanza.tags[1].tags[1]; |
| 119 if child.name == "destroy" then | 119 if child.name == "destroy" then |
| 120 local newjid = child.attr.jid; | 120 if self:get_affiliation(stanza.attr.from) == "owner" then |
| 121 local reason, password; | 121 local newjid = child.attr.jid; |
| 122 for _,tag in ipairs(child.tags) do | 122 local reason, password; |
| 123 if tag.name == "reason" then | 123 for _,tag in ipairs(child.tags) do |
| 124 reason = #tag.tags == 0 and tag[1]; | 124 if tag.name == "reason" then |
| 125 elseif tag.name == "password" then | 125 reason = #tag.tags == 0 and tag[1]; |
| 126 password = #tag.tags == 0 and tag[1]; | 126 elseif tag.name == "password" then |
| 127 end | 127 password = #tag.tags == 0 and tag[1]; |
| 128 end | 128 end |
| 129 self:destroy(newjid, reason, password); | 129 end |
| 130 origin.send(st.reply(stanza)); | 130 self:destroy(newjid, reason, password); |
| 131 origin.send(st.reply(stanza)); | |
| 132 else origin.send(st.error_reply(stanza, "auth", "forbidden", "Only owners can destroy rooms")); end | |
| 131 else | 133 else |
| 132 self:compat_iq(origin, stanza, xmlns); | 134 self:compat_iq(origin, stanza, xmlns); |
| 133 end | 135 end |
| 134 else | 136 else |
| 135 origin.send(st.error_reply(stanza, "modify", "bad-request")); | 137 origin.send(st.error_reply(stanza, "modify", "bad-request")); |
