Mercurial > prosody-hg
comparison plugins/mod_selftests.lua @ 375:a6a4ea3633b0
Fix mod_selftests syntax, and switch it to use config
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Sun, 23 Nov 2008 02:11:58 +0000 |
| parents | 02b8f2ffa6a7 |
| children | e717ecc97d2e |
comparison
equal
deleted
inserted
replaced
| 374:ff502dada372 | 375:a6a4ea3633b0 |
|---|---|
| 1 | 1 |
| 2 local st = require "util.stanza"; | 2 local st = require "util.stanza"; |
| 3 local register_component = require "core.componentmanager".register_component; | 3 local register_component = require "core.componentmanager".register_component; |
| 4 local core_route_stanza = core_route_stanza; | 4 local core_route_stanza = core_route_stanza; |
| 5 local socket = require "socket"; | 5 local socket = require "socket"; |
| 6 local config = require "core.configmanager"; | |
| 7 local ping_hosts = config.get("*", "mod_selftests", "ping_hosts") or { "jabber.org" }; | |
| 6 | 8 |
| 7 local open_pings = {}; | 9 local open_pings = {}; |
| 8 | 10 |
| 9 local t_insert = table.insert; | 11 local t_insert = table.insert; |
| 10 | 12 |
| 11 local log = require "util.logger".init("mod_selftests"); | 13 local log = require "util.logger".init("mod_selftests"); |
| 12 | 14 |
| 13 local tests_jid, host; "self_tests@getjabber.ath.cx"; | 15 local tests_jid = "self_tests@getjabber.ath.cx"; |
| 14 local host = "getjabber.ath.cx"; | 16 local host = "getjabber.ath.cx"; |
| 15 | 17 |
| 16 if not (tests_jid and host) then | 18 if not (tests_jid and host) then |
| 17 for currhost in pairs(host) do | 19 for currhost in pairs(host) do |
| 18 if currhost ~= "localhost" then | 20 if currhost ~= "localhost" then |
| 42 log("info", "Sending ping to %s", to); | 44 log("info", "Sending ping to %s", to); |
| 43 core_route_stanza(our_origin, st.iq{ to = to, from = tests_jid, id = id, type = "get" }:tag("ping", ping_attr)); | 45 core_route_stanza(our_origin, st.iq{ to = to, from = tests_jid, id = id, type = "get" }:tag("ping", ping_attr)); |
| 44 open_pings[id] = socket.gettime(); | 46 open_pings[id] = socket.gettime(); |
| 45 end | 47 end |
| 46 | 48 |
| 47 send_ping "matthewwild.co.uk" | 49 for _, host in ipairs(ping_hosts) do |
| 48 send_ping "snikket.com" | 50 send_ping(host); |
| 49 send_ping "gmail.com" | 51 end |
| 50 send_ping "isode.com" | |
| 51 send_ping "jabber.org" | |
| 52 send_ping "chrome.pl" | |
| 53 send_ping "swissjabber.ch" | |
| 54 send_ping "soapbox.net" | |
| 55 send_ping "jabber.ccc.de" | |
| 56 end); | 52 end); |
| 57 end | 53 end |
