diff options
author | Kim Alvefur <zash@zash.se> | 2020-03-22 22:32:26 +0100 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2020-03-22 22:32:26 +0100 |
commit | ad142872d43a94c419cffe4f8dbc37a19cd34d33 (patch) | |
tree | cf4f1b2ef55ef17d0bd71afa38704a1983c432c3 | |
parent | 026503297c7d88508761b2bb70d6dacc5c6bc783 (diff) | |
download | prosody-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.lua | 11 |
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 () |