Diff

plugins/muc/muc.lib.lua @ 10662:46373b97e648

mod_muc: add muc-private-message event This seems to be the one place handling MUC-PMs. This event is added so that plugins (such as muc_occupant_id) can edit them without having to redo the work.
author Maxime “pep” Buquet <pep@bouah.net>
date Mon, 24 Feb 2020 14:16:45 +0100
parent 10553:4d8119ffd433
child 10684:de607875d4bd
line wrap: on
line diff
--- a/plugins/muc/muc.lib.lua	Mon Feb 24 09:10:28 2020 +0100
+++ b/plugins/muc/muc.lib.lua	Mon Feb 24 14:16:45 2020 +0100
@@ -814,7 +814,9 @@
 	stanza = muc_util.filter_muc_x(st.clone(stanza));
 	stanza:tag("x", { xmlns = "http://jabber.org/protocol/muc#user" }):up();
 	stanza.attr.from = current_nick;
-	self:route_to_occupant(o_data, stanza)
+	if module:fire_event("muc-private-message", { room = self, origin = origin, stanza = stanza }) ~= false then
+		self:route_to_occupant(o_data, stanza)
+	end
 	-- TODO: Remove x tag?
 	stanza.attr.from = from;
 	return true;