aboutsummaryrefslogtreecommitdiffstats
path: root/prosody
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-03-22 14:14:40 +0000
committerMatthew Wild <mwild1@gmail.com>2009-03-22 14:14:40 +0000
commitecf8df36d0a59d209f295ba4ae2a1ba7a97a1251 (patch)
tree16641301ae7f18398d274d630ad389b40dbce48e /prosody
parentc918df533431f4d3d72cfb83d1c0b0fc5b2ae223 (diff)
downloadprosody-ecf8df36d0a59d209f295ba4ae2a1ba7a97a1251.tar.gz
prosody-ecf8df36d0a59d209f295ba4ae2a1ba7a97a1251.zip
prosody: Expose net_activate_ports as a global function for use by plugins
Diffstat (limited to 'prosody')
-rwxr-xr-xprosody26
1 files changed, 13 insertions, 13 deletions
diff --git a/prosody b/prosody
index 45ee5983..06ea5837 100755
--- a/prosody
+++ b/prosody
@@ -111,17 +111,8 @@ require "util.datamanager".set_data_path(data_path);
eventmanager.fire_event("server-starting");
--- setup error handling
-setmetatable(_G, { __index = function (t, k) error("Attempt to read a non-existent global '"..k.."'", 2); end, __newindex = function (t, k, v) error("Attempt to set a global: "..tostring(k).." = "..tostring(v), 2); end });
-
-local global_ssl_ctx = config.get("*", "core", "ssl");
-if global_ssl_ctx then
- local default_ssl_ctx = { mode = "server", protocol = "sslv23", capath = "/etc/ssl/certs", verify = "none"; };
- setmetatable(global_ssl_ctx, { __index = default_ssl_ctx });
-end
-
-- start listening on sockets
-local function do_ports(option, listener, default, conntype)
+function net_activate_ports(option, listener, default, conntype)
local ports = config.get("*", "core", option) or default;
if type(ports) == "number" then ports = {ports} end;
@@ -138,9 +129,9 @@ local function do_ports(option, listener, default, conntype)
end
end
-do_ports("c2s_ports", "xmppclient", {5222}, (global_ssl_ctx and "tls") or "tcp");
-do_ports("s2s_ports", "xmppserver", {5269}, "tcp");
-do_ports("legacy_ssl_ports", "xmppclient", {}, "ssl");
+net_activate_ports("c2s_ports", "xmppclient", {5222}, (global_ssl_ctx and "tls") or "tcp");
+net_activate_ports("s2s_ports", "xmppserver", {5269}, "tcp");
+net_activate_ports("legacy_ssl_ports", "xmppclient", {}, "ssl");
if config.get("*", "core", "console_enabled") then
if cl.get("console") then
@@ -150,6 +141,15 @@ if config.get("*", "core", "console_enabled") then
end
end
+-- setup error handling
+setmetatable(_G, { __index = function (t, k) error("Attempt to read a non-existent global '"..k.."'", 2); end, __newindex = function (t, k, v) error("Attempt to set a global: "..tostring(k).." = "..tostring(v), 2); end });
+
+local global_ssl_ctx = config.get("*", "core", "ssl");
+if global_ssl_ctx then
+ local default_ssl_ctx = { mode = "server", protocol = "sslv23", capath = "/etc/ssl/certs", verify = "none"; };
+ setmetatable(global_ssl_ctx, { __index = default_ssl_ctx });
+end
+
eventmanager.fire_event("server-started");
local quitting;