aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 ()