aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2020-03-22 22:32:26 +0100
committerKim Alvefur <zash@zash.se>2020-03-22 22:32:26 +0100
commitad142872d43a94c419cffe4f8dbc37a19cd34d33 (patch)
treecf4f1b2ef55ef17d0bd71afa38704a1983c432c3
parent026503297c7d88508761b2bb70d6dacc5c6bc783 (diff)
downloadprosody-ad142872d43a94c419cffe4f8dbc37a19cd34d33.tar.gz
prosody-ad142872d43a94c419cffe4f8dbc37a19cd34d33.zip
moduleapi: Fix handling of replies to :send_iq from internal modules
Unclear exactly why, but replies to some queries to local modules would be discarded by stanza_router. This appears to fix it.
-rw-r--r--core/moduleapi.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/core/moduleapi.lua b/core/moduleapi.lua
index 87c337d6..71239a0c 100644
--- a/core/moduleapi.lua
+++ b/core/moduleapi.lua
@@ -436,7 +436,16 @@ function api:send_iq(stanza, origin, timeout)
return;
end
- self:send(stanza, origin);
+ local wrapped_origin = setmetatable({
+ -- XXX Needed in some cases for replies to work correctly when sending queries internally.
+ send = function (stanza)
+ resolve({ stanza = stanza });
+ end;
+ }, {
+ __index = origin or hosts[self.host];
+ });
+
+ self:send(stanza, wrapped_origin);
end);
p:finally(function ()