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
commit7e181e31e0fdce18e0ce326f612edb2e9428fc13 (patch)
treecf4f1b2ef55ef17d0bd71afa38704a1983c432c3
parentd7f8fa848d1c2391a35ed8ebc41a9cb228466fa4 (diff)
downloadprosody-7e181e31e0fdce18e0ce326f612edb2e9428fc13.tar.gz
prosody-7e181e31e0fdce18e0ce326f612edb2e9428fc13.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 ()