diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-03-22 14:14:40 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-03-22 14:14:40 +0000 |
commit | ecf8df36d0a59d209f295ba4ae2a1ba7a97a1251 (patch) | |
tree | 16641301ae7f18398d274d630ad389b40dbce48e | |
parent | c918df533431f4d3d72cfb83d1c0b0fc5b2ae223 (diff) | |
download | prosody-ecf8df36d0a59d209f295ba4ae2a1ba7a97a1251.tar.gz prosody-ecf8df36d0a59d209f295ba4ae2a1ba7a97a1251.zip |
prosody: Expose net_activate_ports as a global function for use by plugins
-rwxr-xr-x | prosody | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -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; |