core/moduleapi.lua
changeset 10709 2cffb5ce9f7a
parent 10599 17bab303daf5
child 10710 0230ceecb8a9
--- 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 ()