diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_bosh.lua | 14 | ||||
-rw-r--r-- | plugins/mod_selftests.lua | 5 | ||||
-rw-r--r-- | plugins/mod_tls.lua | 5 | ||||
-rw-r--r-- | plugins/mod_version.lua | 24 | ||||
-rw-r--r-- | plugins/mod_watchregistrations.lua | 8 | ||||
-rw-r--r-- | plugins/mod_welcome.lua | 4 |
6 files changed, 25 insertions, 35 deletions
diff --git a/plugins/mod_bosh.lua b/plugins/mod_bosh.lua index 743ebdef..615ad30b 100644 --- a/plugins/mod_bosh.lua +++ b/plugins/mod_bosh.lua @@ -6,7 +6,6 @@ -- COPYING file in the source package for more information. -- - module.host = "*" -- Global module local hosts = _G.hosts; @@ -23,14 +22,13 @@ local st = require "util.stanza"; local logger = require "util.logger"; local log = logger.init("mod_bosh"); local stream_callbacks = { stream_tag = "http://jabber.org/protocol/httpbind|body" }; -local config = require "core.configmanager"; local xmlns_bosh = "http://jabber.org/protocol/httpbind"; -- (hard-coded into a literal in session.send) -local BOSH_DEFAULT_HOLD = tonumber(config.get("*", "core", "bosh_default_hold")) or 1; -local BOSH_DEFAULT_INACTIVITY = tonumber(config.get("*", "core", "bosh_max_inactivity")) or 60; -local BOSH_DEFAULT_POLLING = tonumber(config.get("*", "core", "bosh_max_polling")) or 5; -local BOSH_DEFAULT_REQUESTS = tonumber(config.get("*", "core", "bosh_max_requests")) or 2; -local BOSH_DEFAULT_MAXPAUSE = tonumber(config.get("*", "core", "bosh_max_pause")) or 300; +local BOSH_DEFAULT_HOLD = tonumber(module:get_option("bosh_default_hold")) or 1; +local BOSH_DEFAULT_INACTIVITY = tonumber(module:get_option("bosh_max_inactivity")) or 60; +local BOSH_DEFAULT_POLLING = tonumber(module:get_option("bosh_max_polling")) or 5; +local BOSH_DEFAULT_REQUESTS = tonumber(module:get_option("bosh_max_requests")) or 2; +local BOSH_DEFAULT_MAXPAUSE = tonumber(module:get_option("bosh_max_pause")) or 300; local default_headers = { ["Content-Type"] = "text/xml; charset=utf-8" }; @@ -275,7 +273,7 @@ function on_timer() end end -local ports = config.get(module.host, "core", "bosh_ports") or { 5280 }; +local ports = module:get_option("bosh_ports") or { 5280 }; httpserver.new_from_config(ports, "http-bind", handle_request); server.addtimer(on_timer); diff --git a/plugins/mod_selftests.lua b/plugins/mod_selftests.lua index 6a26dfc3..1f413634 100644 --- a/plugins/mod_selftests.lua +++ b/plugins/mod_selftests.lua @@ -6,14 +6,13 @@ -- COPYING file in the source package for more information. -- - +module.host = "*" -- Global module 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 ping_hosts = module:get_option("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 = {}; diff --git a/plugins/mod_tls.lua b/plugins/mod_tls.lua index 8926edfc..158285f6 100644 --- a/plugins/mod_tls.lua +++ b/plugins/mod_tls.lua @@ -6,14 +6,11 @@ -- COPYING file in the source package for more information. -- - - local st = require "util.stanza"; local xmlns_starttls ='urn:ietf:params:xml:ns:xmpp-tls'; -local config = require "core.configmanager"; -local secure_auth_only = config.get("*", "core", "require_encryption"); +local secure_auth_only = module:get_option("require_encryption"); module:add_handler("c2s_unauthed", "starttls", xmlns_starttls, function (session, stanza) diff --git a/plugins/mod_version.lua b/plugins/mod_version.lua index 87bff5d9..9af830f8 100644 --- a/plugins/mod_version.lua +++ b/plugins/mod_version.lua @@ -6,17 +6,13 @@ -- COPYING file in the source package for more information. -- - -local prosody = prosody; local st = require "util.stanza"; -local xmlns_version = "jabber:iq:version" - -module:add_feature(xmlns_version); +module:add_feature("jabber:iq:version"); local version = "the best operating system ever!"; -if not require "core.configmanager".get("*", "core", "hide_os_type") then +if not module:get_option("hide_os_type") then if os.getenv("WINDIR") then version = "Windows"; else @@ -31,11 +27,15 @@ end version = version:match("^%s*(.-)%s*$") or version; -module:add_iq_handler({"c2s", "s2sin"}, xmlns_version, function(session, stanza) - if stanza.attr.type == "get" then - session.send(st.reply(stanza):query(xmlns_version) - :tag("name"):text("Prosody"):up() - :tag("version"):text(prosody.version):up() - :tag("os"):text(version)); +local query = st.stanza("query", {xmlns = "jabber:iq:version"}) + :tag("name"):text("Prosody"):up() + :tag("version"):text(prosody.version):up() + :tag("os"):text(version); + +module:hook("iq/host/jabber:iq:version:query", function(event) + local stanza = event.stanza; + if stanza.attr.type == "get" and stanza.attr.to == module.host then + event.origin.send(st.reply(stanza):add_child(query)); + return true; end end); diff --git a/plugins/mod_watchregistrations.lua b/plugins/mod_watchregistrations.lua index 9457313f..6a2af853 100644 --- a/plugins/mod_watchregistrations.lua +++ b/plugins/mod_watchregistrations.lua @@ -9,12 +9,10 @@ local host = module:get_host(); -local config = require "core.configmanager"; +local registration_watchers = module:get_option("registration_watchers") + or module:get_option("admins") or {}; -local registration_watchers = config.get(host, "core", "registration_watchers") - or config.get(host, "core", "admins") or {}; - -local registration_alert = config.get(host, "core", "registration_notification") or "User $username just registered on $host from $ip"; +local registration_alert = module:get_option("registration_notification") or "User $username just registered on $host from $ip"; local st = require "util.stanza"; diff --git a/plugins/mod_welcome.lua b/plugins/mod_welcome.lua index 5c0da8b8..cc50cba3 100644 --- a/plugins/mod_welcome.lua +++ b/plugins/mod_welcome.lua @@ -6,10 +6,8 @@ -- COPYING file in the source package for more information. -- -local config = require "core.configmanager"; - local host = module:get_host(); -local welcome_text = config.get("*", "core", "welcome_message") or "Hello $user, welcome to the $host IM server!"; +local welcome_text = module:get_option("welcome_message") or "Hello $user, welcome to the $host IM server!"; local st = require "util.stanza"; |