Diff

plugins/mod_muc_mam.lua @ 10671:5e1384298e97

Merge 0.11->trunk
author Kim Alvefur <zash@zash.se>
date Thu, 27 Feb 2020 19:50:30 +0100
parent 10585:2d8535338099
parent 10670:5376f882cf82
child 10683:2f0b7f1d5e75
line wrap: on
line diff
--- a/plugins/mod_muc_mam.lua	Wed Feb 26 22:46:15 2020 +0000
+++ b/plugins/mod_muc_mam.lua	Thu Feb 27 19:50:30 2020 +0100
@@ -361,11 +361,14 @@
 	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