Fix mod_selftests syntax, and switch it to use config

Sun, 23 Nov 2008 02:11:58 +0000

author
Matthew Wild <mwild1@gmail.com>
date
Sun, 23 Nov 2008 02:11:58 +0000
changeset 375
a6a4ea3633b0
parent 374
ff502dada372
child 376
6d87944df37c

Fix mod_selftests syntax, and switch it to use config

plugins/mod_selftests.lua file | annotate | diff | comparison | revisions
--- a/plugins/mod_selftests.lua	Sat Nov 22 20:12:27 2008 +0000
+++ b/plugins/mod_selftests.lua	Sun Nov 23 02:11:58 2008 +0000
@@ -3,6 +3,8 @@
 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 { "jabber.org" };
 
 local open_pings = {};
 
@@ -10,7 +12,7 @@
 
 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
@@ -44,14 +46,8 @@
 							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

mercurial