X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmod_selftests.lua;h=9b0e5a7bb739f282e51b26c38e3dfd80ddf46edb;hb=37bb197d13c606a5de9ede4c7cd32f77f0398eb1;hp=fe09e52904477ef548a18c1cfcdacc8313ff3306;hpb=d4d9f099f69c3504cecd79e1bda21b70750ba8f0;p=prosody.git diff --git a/plugins/mod_selftests.lua b/plugins/mod_selftests.lua index fe09e529..9b0e5a7b 100644 --- a/plugins/mod_selftests.lua +++ b/plugins/mod_selftests.lua @@ -1,8 +1,19 @@ +-- Prosody IM v0.4 +-- Copyright (C) 2008-2009 Matthew Wild +-- Copyright (C) 2008-2009 Waqas Hussain +-- +-- This project is MIT/X11 licensed. Please see the +-- COPYING file in the source package for more information. +-- + + local st = require "util.stanza"; local register_component = require "core.componentmanager".register_component; local core_route_stanza = core_route_stanza; local socket = require "socket"; +local config = require "core.configmanager"; +local ping_hosts = config.get("*", "mod_selftests", "ping_hosts") or { "coversant.interop.xmpp.org", "djabberd.interop.xmpp.org", "djabberd-trunk.interop.xmpp.org", "ejabberd.interop.xmpp.org", "openfire.interop.xmpp.org" }; local open_pings = {}; @@ -10,7 +21,7 @@ local t_insert = table.insert; local log = require "util.logger".init("mod_selftests"); -local tests_jid, host; "self_tests@getjabber.ath.cx"; +local tests_jid = "self_tests@getjabber.ath.cx"; local host = "getjabber.ath.cx"; if not (tests_jid and host) then @@ -34,7 +45,7 @@ if tests_jid and host then local our_origin = hosts[host]; - add_event_hook("server-started", + module:add_event_hook("server-started", function () local id = st.new_id(); local ping_attr = { xmlns = 'urn:xmpp:ping' }; @@ -44,14 +55,8 @@ if tests_jid and host then open_pings[id] = socket.gettime(); end - send_ping "matthewwild.co.uk" - send_ping "snikket.com" - send_ping "gmail.com" - send_ping "isode.com" - send_ping "jabber.org" - send_ping "chrome.pl" - send_ping "swissjabber.ch" - send_ping "soapbox.net" - send_ping "jabber.ccc.de" + for _, host in ipairs(ping_hosts) do + send_ping(host); + end end); end