# HG changeset patch # User Kim Alvefur # Date 1522852304 -7200 # Node ID cb8d65b40fb46385069b8e108f2620a62764a51d # Parent 926aaaeb0d21930351e3d7c2943cf7daa1002ee3 mod_query_client_ver: Add a simple adhoc command that queries all currently connected clients diff -r 926aaaeb0d21 -r cb8d65b40fb4 mod_query_client_ver/mod_query_client_ver.lua --- a/mod_query_client_ver/mod_query_client_ver.lua Wed Apr 04 15:55:09 2018 +0200 +++ b/mod_query_client_ver/mod_query_client_ver.lua Wed Apr 04 16:31:44 2018 +0200 @@ -56,3 +56,15 @@ module:hook("iq-error/host/"..disco_id, function() return true; -- Doesn't reply to disco#info? Weird, but ignore for now. end); + +module:add_item("adhoc", + module:require "adhoc".new("Query all currently connected clients", "ping", + function (self, data, state) + for jid, session in pairs(prosody.full_sessions) do + if session.jid == module.host then + session.send(st.iq({ id = version_id, type = "get", from = module.host, to = session.full_jid }):query(xmlns_iq_version)); + end + end + return { info = "Ok, check your logs for results", status = "completed" } + end)); +