Changeset

10595:17bab303daf5

core.moduleapi: Hook correct event type in some cases In rare cases, module.host can be a bare JID, in which case this test did the wrong thing.
author Kim Alvefur <zash@zash.se>
date Thu, 16 Jan 2020 16:30:26 +0100
parents 10594:13d5fb74648f
children 10599:4f655918fef1
files core/moduleapi.lua
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/core/moduleapi.lua	Wed Jan 15 21:18:30 2020 +0100
+++ b/core/moduleapi.lua	Thu Jan 16 16:30:26 2020 +0100
@@ -19,6 +19,7 @@
 local promise = require "util.promise";
 local time_now = require "util.time".now;
 local format = require "util.format".format;
+local jid_node = require "util.jid".node;
 
 local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat;
 local error, setmetatable, type = error, setmetatable, type;
@@ -379,7 +380,7 @@
 	end
 
 	local event_type;
-	if stanza.attr.from == self.host then
+	if not jid_node(stanza.attr.from) then
 		event_type = "host";
 	else -- assume bare since we can't hook full jids
 		event_type = "bare";