aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_muc_mam.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-02-27 19:50:30 +0100
committerKim Alvefur <zash@zash.se>2020-02-27 19:50:30 +0100
commit26847e013082876eca1c274eeca00e2cbaada12e (patch)
treea3b85e75196deee0269c59648468242901a4fbef /plugins/mod_muc_mam.lua
parentf6a365c970146c2bef638f29eb5cc1b8587a6f98 (diff)
parent2de7db5f8bfa212294e2afeaa96da96f76e8489a (diff)
downloadprosody-26847e013082876eca1c274eeca00e2cbaada12e.tar.gz
prosody-26847e013082876eca1c274eeca00e2cbaada12e.zip
Merge 0.11->trunk
Diffstat (limited to 'plugins/mod_muc_mam.lua')
-rw-r--r--plugins/mod_muc_mam.lua13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/mod_muc_mam.lua b/plugins/mod_muc_mam.lua
index e7506bbb..be345d79 100644
--- a/plugins/mod_muc_mam.lua
+++ b/plugins/mod_muc_mam.lua
@@ -361,11 +361,14 @@ local function save_to_history(self, stanza)
if stanza.name == "message" and self:get_whois() == "anyone" then
stored_stanza = st.clone(stanza);
stored_stanza.attr.to = nil;
- local actor = jid_bare(self._occupants[stanza.attr.from].jid);
- local affiliation = self:get_affiliation(actor) or "none";
- local role = self:get_role(actor) or self:get_default_role(affiliation);
- stored_stanza:add_direct_child(st.stanza("x", { xmlns = xmlns_muc_user })
- :tag("item", { affiliation = affiliation; role = role; jid = actor }));
+ local occupant = self._occupants[stanza.attr.from];
+ if occupant then
+ local actor = jid_bare(occupant.jid);
+ local affiliation = self:get_affiliation(actor) or "none";
+ local role = self:get_role(actor) or self:get_default_role(affiliation);
+ stored_stanza:add_direct_child(st.stanza("x", { xmlns = xmlns_muc_user })
+ :tag("item", { affiliation = affiliation; role = role; jid = actor }));
+ end
end
-- Policy check