Mercurial > prosody-modules
comparison mod_query_client_ver/mod_query_client_ver.lua @ 2990:cb8d65b40fb4
mod_query_client_ver: Add a simple adhoc command that queries all currently connected clients
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Wed, 04 Apr 2018 16:31:44 +0200 |
| parents | 96eabf8591a6 |
| children | 9d205ec1fa00 |
comparison
equal
deleted
inserted
replaced
| 2989:926aaaeb0d21 | 2990:cb8d65b40fb4 |
|---|---|
| 54 end); | 54 end); |
| 55 | 55 |
| 56 module:hook("iq-error/host/"..disco_id, function() | 56 module:hook("iq-error/host/"..disco_id, function() |
| 57 return true; -- Doesn't reply to disco#info? Weird, but ignore for now. | 57 return true; -- Doesn't reply to disco#info? Weird, but ignore for now. |
| 58 end); | 58 end); |
| 59 | |
| 60 module:add_item("adhoc", | |
| 61 module:require "adhoc".new("Query all currently connected clients", "ping", | |
| 62 function (self, data, state) | |
| 63 for jid, session in pairs(prosody.full_sessions) do | |
| 64 if session.jid == module.host then | |
| 65 session.send(st.iq({ id = version_id, type = "get", from = module.host, to = session.full_jid }):query(xmlns_iq_version)); | |
| 66 end | |
| 67 end | |
| 68 return { info = "Ok, check your logs for results", status = "completed" } | |
| 69 end)); | |
| 70 |
