Comparison

core/moduleapi.lua @ 10705:2cffb5ce9f7a

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.
author Kim Alvefur <zash@zash.se>
date Sun, 22 Mar 2020 22:32:26 +0100
parent 10595:17bab303daf5
child 10706:0230ceecb8a9
comparison
equal deleted inserted replaced
10704:06307833684b 10705:2cffb5ce9f7a
434 text = "Could not store IQ tracking data" 434 text = "Could not store IQ tracking data"
435 })); 435 }));
436 return; 436 return;
437 end 437 end
438 438
439 self:send(stanza, origin); 439 local wrapped_origin = setmetatable({
440 -- XXX Needed in some cases for replies to work correctly when sending queries internally.
441 send = function (stanza)
442 resolve({ stanza = stanza });
443 end;
444 }, {
445 __index = origin or hosts[self.host];
446 });
447
448 self:send(stanza, wrapped_origin);
440 end); 449 end);
441 450
442 p:finally(function () 451 p:finally(function ()
443 local iq = iq_cache:get(cache_key); 452 local iq = iq_cache:get(cache_key);
444 if iq then 453 if iq then