# HG changeset patch # User Emmanuel Gil Peyrot # Date 1548167889 -3600 # Node ID c424bfb927b15112c3a3d0f48674910f1f4c040f # Parent 41e1cacf3c4ea3a607b2ee3d475fbd4a349843d1 mod_cache_c2s_caps: Switch to the new module:send_iq() API. diff -r 41e1cacf3c4e -r c424bfb927b1 mod_cache_c2s_caps/mod_cache_c2s_caps.lua --- a/mod_cache_c2s_caps/mod_cache_c2s_caps.lua Mon Jan 21 19:52:04 2019 +0100 +++ b/mod_cache_c2s_caps/mod_cache_c2s_caps.lua Tue Jan 22 15:38:09 2019 +0100 @@ -26,7 +26,6 @@ query.attr.node = node_query; end iq_node_map[from..id] = nil; - in_flight_iqs[from..node_string] = nil; if node_string ~= node_query then origin.log("debug", "Wrong node for our disco#info query, expected %s, received %s", node_string, node_query); @@ -88,11 +87,10 @@ iq_node_map[from..id] = node_query local iq = st_iq({ type = "get", from = module.host, to = from, id = id }) :tag("query", { xmlns = "http://jabber.org/protocol/disco#info", node = node_query }); - module:hook("iq-result/host/"..id, iq_result_handler); - module:hook("iq-error/host/"..id, iq_error_handler); - module:send(iq); - in_flight_iqs[from..node_query] = true; + module:send_iq(iq, origin) + :next(iq_result_handler, iq_error_handler) + :finally(function () in_flight_iqs[from..node_query] = nil; end) end -- Handle only non-directed presences for now.