Mercurial > prosody-hg
comparison plugins/mod_muc_mam.lua @ 10670:5376f882cf82 0.11
mod_muc_mam: Fix traceback saving message from non-occupant (fixes #1497)
Caused by a plugin sending a message from the room itself.
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Thu, 27 Feb 2020 19:42:51 +0100 |
| parents | f4d12b1434c6 |
| children | 5e1384298e97 62ef68f95b6f |
comparison
equal
deleted
inserted
replaced
| 10665:69acda92d5a9 | 10670:5376f882cf82 |
|---|---|
| 333 local stored_stanza = stanza; | 333 local stored_stanza = stanza; |
| 334 | 334 |
| 335 if stanza.name == "message" and self:get_whois() == "anyone" then | 335 if stanza.name == "message" and self:get_whois() == "anyone" then |
| 336 stored_stanza = st.clone(stanza); | 336 stored_stanza = st.clone(stanza); |
| 337 stored_stanza.attr.to = nil; | 337 stored_stanza.attr.to = nil; |
| 338 local actor = jid_bare(self._occupants[stanza.attr.from].jid); | 338 local occupant = self._occupants[stanza.attr.from]; |
| 339 local affiliation = self:get_affiliation(actor) or "none"; | 339 if occupant then |
| 340 local role = self:get_role(actor) or self:get_default_role(affiliation); | 340 local actor = jid_bare(occupant.jid); |
| 341 stored_stanza:add_direct_child(st.stanza("x", { xmlns = xmlns_muc_user }) | 341 local affiliation = self:get_affiliation(actor) or "none"; |
| 342 :tag("item", { affiliation = affiliation; role = role; jid = actor })); | 342 local role = self:get_role(actor) or self:get_default_role(affiliation); |
| 343 stored_stanza:add_direct_child(st.stanza("x", { xmlns = xmlns_muc_user }) | |
| 344 :tag("item", { affiliation = affiliation; role = role; jid = actor })); | |
| 345 end | |
| 343 end | 346 end |
| 344 | 347 |
| 345 -- Policy check | 348 -- Policy check |
| 346 if not archiving_enabled(self) then return end -- Don't log | 349 if not archiving_enabled(self) then return end -- Don't log |
| 347 | 350 |
