aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-01-16 16:30:26 +0100
committerKim Alvefur <zash@zash.se>2020-01-16 16:30:26 +0100
commit23ded0507b5f4fa41a1ca46e84cc676840eb6ed9 (patch)
tree445db78113f3d38b342143e3b3b8d48213d7cb51
parentdc65ddc4a43daabb97ee1f2af7dedac7c5406688 (diff)
downloadprosody-23ded0507b5f4fa41a1ca46e84cc676840eb6ed9.tar.gz
prosody-23ded0507b5f4fa41a1ca46e84cc676840eb6ed9.zip
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.
-rw-r--r--core/moduleapi.lua3
1 files changed, 2 insertions, 1 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index 5e8438a8..87c337d6 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -19,6 +19,7 @@ local errors = require "util.error";
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 @@ function api:send_iq(stanza, origin, timeout)
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";