# HG changeset patch # User Kim Alvefur # Date 1584912746 -3600 # Node ID 2cffb5ce9f7a629a612f01bad4327f7640bad49f # Parent 06307833684b68b4b9b336c3087ec68409be569e 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. diff -r 06307833684b -r 2cffb5ce9f7a core/moduleapi.lua --- a/core/moduleapi.lua Sun Mar 29 22:12:42 2020 +0200 +++ b/core/moduleapi.lua Sun Mar 22 22:32:26 2020 +0100 @@ -436,7 +436,16 @@ 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 ()