From 5bffff6d27fa8551156478edb458e48284448279 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Fri, 24 Apr 2009 00:34:49 +0500 Subject: mod_muc: The default room name is the room node --- plugins/mod_muc.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/mod_muc.lua b/plugins/mod_muc.lua index 8fbe1e91..6af5df7c 100644 --- a/plugins/mod_muc.lua +++ b/plugins/mod_muc.lua @@ -274,6 +274,7 @@ function handle_to_occupant(origin, stanza) -- PM, vCards, etc log("debug", "%s joining as %s", from, to); local data; if not rooms:get(room) and not rooms_info:get(room) then -- new room + rooms_info:set(room, 'name', (jid_split(room))); data = {affiliation='owner', role='moderator', jid=from, sessions={[from]=get_filtered_presence(stanza)}}; end if not data then -- new occupant -- cgit v1.2.3 From 947502344678e30873405e4f0ca2859740a09273 Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Fri, 24 Apr 2009 00:35:50 +0500 Subject: mod_muc: The default component name is now 'Chatrooms' --- plugins/mod_muc.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_muc.lua b/plugins/mod_muc.lua index 6af5df7c..2f63ed0c 100644 --- a/plugins/mod_muc.lua +++ b/plugins/mod_muc.lua @@ -21,7 +21,7 @@ if module:get_host_type() ~= "component" then end local muc_domain = module:get_host(); -local muc_name = "MUCMUCMUC!!!"; +local muc_name = "Chatrooms"; local history_length = 20; -- room_name -> room -- cgit v1.2.3 From 580571ef6a072a10ba4cf0ed55efd49bb78c3dc2 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 23 Apr 2009 21:34:03 +0100 Subject: mod_posix: Fix for removing the pidfile on exit --- plugins/mod_posix.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua index 36ca9a8c..7fbdfa93 100644 --- a/plugins/mod_posix.lua +++ b/plugins/mod_posix.lua @@ -18,7 +18,7 @@ local pidfile_written; local function remove_pidfile() if pidfile_written then - os.remove(pidfile); + os.remove(pidfile_written); pidfile_written = nil; end end -- cgit v1.2.3 From e30b37c42448a4ab41333d5efaa5dd6b26242f58 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Thu, 23 Apr 2009 21:35:24 +0100 Subject: mod_posix: Fix calls to log() (replace with module:log) and make some global accesses explicit --- plugins/mod_posix.lua | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/plugins/mod_posix.lua b/plugins/mod_posix.lua index 7fbdfa93..b1c7e01b 100644 --- a/plugins/mod_posix.lua +++ b/plugins/mod_posix.lua @@ -6,7 +6,7 @@ if pposix._VERSION ~= want_pposix_version then module:log("warn", "Unknown versi local signal = select(2, pcall(require, "util.signal")); if type(signal) == "string" then - log("warn", "Couldn't load signal library, won't respond to SIGTERM"); + module:log("warn", "Couldn't load signal library, won't respond to SIGTERM"); end local config_get = require "core.configmanager".get; @@ -27,11 +27,11 @@ local function write_pidfile() if pidfile_written then remove_pidfile(); end - local pidfile = config.get("*", "core", "pidfile"); + local pidfile = config_get("*", "core", "pidfile"); if pidfile then local pf, err = io.open(pidfile, "w+"); if not pf then - log("error", "Couldn't write pidfile; %s", err); + module:log("error", "Couldn't write pidfile; %s", err); else pf:write(tostring(pposix.getpid())); pf:close(); @@ -61,11 +61,11 @@ if not config_get("*", "core", "no_daemonize") then local function daemonize_server() local ok, ret = pposix.daemonize(); if not ok then - log("error", "Failed to daemonize: %s", ret); + module:log("error", "Failed to daemonize: %s", ret); elseif ret and ret > 0 then os.exit(0); else - log("info", "Successfully daemonized to PID %d", pposix.getpid()); + module:log("info", "Successfully daemonized to PID %d", pposix.getpid()); write_pidfile(); end end @@ -80,13 +80,13 @@ module:add_event_hook("server-stopped", remove_pidfile); -- Set signal handler if signal.signal then signal.signal("SIGTERM", function () - log("warn", "Received SIGTERM..."); - unlock_globals(); - if prosody_shutdown then - prosody_shutdown("Received SIGTERM"); + module:log("warn", "Received SIGTERM..."); + _G.unlock_globals(); + if _G.prosody_shutdown then + _G.prosody_shutdown("Received SIGTERM"); else - log("warn", "...no prosody_shutdown(), ignoring."); + module:log("warn", "...no prosody_shutdown(), ignoring."); end - lock_globals(); + _G.lock_globals(); end); end -- cgit v1.2.3 From d5d6bf5e7fb4cfc9f53f83d4b9d0656503678cbd Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 28 Apr 2009 22:53:51 +0100 Subject: configure: Honour --sysconfdir parameter; thanks to Michael Scherer --- configure | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/configure b/configure index 1fe3b85d..2d304dc2 100755 --- a/configure +++ b/configure @@ -78,6 +78,10 @@ do PREFIX="$value" PREFIX_SET=yes ;; + --sysconfdir=*) + SYSCONFDIR="$value" + SYSCONFDIR_SET=yes + ;; --ostype=*) OSTYPE="$value" OSTYPE_SET=yes -- cgit v1.2.3 From 3ba4121e11d4696a40e59486db4f005bf2c7eccd Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 29 Apr 2009 02:06:05 +0100 Subject: core.componentmanager: Really fix marking components as disconnected when unregistered --- core/componentmanager.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/componentmanager.lua b/core/componentmanager.lua index 96b78bf2..524d334b 100644 --- a/core/componentmanager.lua +++ b/core/componentmanager.lua @@ -104,7 +104,7 @@ end function deregister_component(host) if components[host] then modulemanager.unload(host, "dialback"); - host.connected = nil; + hosts[host].connected = nil; local host_config = configmanager.getconfig()[host]; if host_config and ((host_config.core.enabled == nil or host_config.core.enabled) and type(host_config.core.component_module) == "string") then -- Set default handler -- cgit v1.2.3 From e241b85a56b96bbda1719448a08e68cf5b8eed56 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 29 Apr 2009 02:08:12 +0100 Subject: mod_*: Fix many unnecessary global accesses in modules (already committed to main repo) --- plugins/mod_component.lua | 11 ++++++++--- plugins/mod_console.lua | 1 + plugins/mod_dialback.lua | 2 +- plugins/mod_legacyauth.lua | 3 +++ plugins/mod_muc.lua | 2 ++ plugins/mod_register.lua | 4 +++- plugins/mod_saslauth.lua | 6 ++++-- plugins/mod_vcard.lua | 6 +++--- 8 files changed, 25 insertions(+), 10 deletions(-) diff --git a/plugins/mod_component.lua b/plugins/mod_component.lua index bbd49c5e..e5ea47a2 100644 --- a/plugins/mod_component.lua +++ b/plugins/mod_component.lua @@ -10,14 +10,19 @@ if module:get_host_type() ~= "component" then error("Don't load mod_component manually, it should be for a component, please see http://prosody.im/doc/components", 0); end +local hosts = _G.hosts; + local t_concat = table.concat; +local lxp = require "lxp"; +local logger = require "util.logger"; +local config = require "core.configmanager"; local connlisteners = require "net.connlisteners"; local cm_register_component = require "core.componentmanager".register_component; local cm_deregister_component = require "core.componentmanager".deregister_component; local uuid_gen = require "util.uuid".generate; local sha1 = require "util.hashes".sha1; -local st = stanza; +local st = require "util.stanza"; local init_xmlhandlers = require "core.xmlhandlers"; local sessions = {}; @@ -211,8 +216,8 @@ connlisteners.register('component', component_listener); module:add_event_hook("server-started", function () - if net_activate_ports then - net_activate_ports("component", "component", {5437}, "tcp"); + if _G.net_activate_ports then + _G.net_activate_ports("component", "component", {5437}, "tcp"); else error("No net_activate_ports: Using an incompatible version of Prosody?"); end diff --git a/plugins/mod_console.lua b/plugins/mod_console.lua index bd0095d7..502e0d06 100644 --- a/plugins/mod_console.lua +++ b/plugins/mod_console.lua @@ -8,6 +8,7 @@ module.host = "*"; +local hosts = _G.hosts; local connlisteners_register = require "net.connlisteners".register; local console_listener = { default_port = 5582; default_mode = "*l"; }; diff --git a/plugins/mod_dialback.lua b/plugins/mod_dialback.lua index 042e2087..fe65d394 100644 --- a/plugins/mod_dialback.lua +++ b/plugins/mod_dialback.lua @@ -7,7 +7,7 @@ -- - +local hosts = _G.hosts; local send_s2s = require "core.s2smanager".send_to_host; local s2s_make_authenticated = require "core.s2smanager".make_authenticated; local s2s_verify_dialback = require "core.s2smanager".verify_dialback; diff --git a/plugins/mod_legacyauth.lua b/plugins/mod_legacyauth.lua index 648aa01a..fa14f5e7 100644 --- a/plugins/mod_legacyauth.lua +++ b/plugins/mod_legacyauth.lua @@ -11,6 +11,9 @@ local st = require "util.stanza"; local t_concat = table.concat; +local sessionmanager = require "core.sessionmanager"; +local usermanager = require "core.usermanager"; + module:add_feature("jabber:iq:auth"); module:add_event_hook("stream-features", function (session, features) if not session.username then features:tag("auth", {xmlns='http://jabber.org/features/iq-auth'}):up(); end diff --git a/plugins/mod_muc.lua b/plugins/mod_muc.lua index 2f63ed0c..ffa0bb85 100644 --- a/plugins/mod_muc.lua +++ b/plugins/mod_muc.lua @@ -6,6 +6,8 @@ -- COPYING file in the source package for more information. -- +local datamanager = require "util.datamanager"; +local datetime = require "util.datetime"; local register_component = require "core.componentmanager".register_component; local deregister_component = require "core.componentmanager".deregister_component; diff --git a/plugins/mod_register.lua b/plugins/mod_register.lua index c04eca0a..14c00767 100644 --- a/plugins/mod_register.lua +++ b/plugins/mod_register.lua @@ -7,8 +7,10 @@ -- - +local hosts = _G.hosts; local st = require "util.stanza"; +local config = require "core.configmanager"; +local datamanager = require "util.datamanager"; local usermanager_user_exists = require "core.usermanager".user_exists; local usermanager_create_user = require "core.usermanager".create_user; local datamanager_store = require "util.datamanager".store; diff --git a/plugins/mod_saslauth.lua b/plugins/mod_saslauth.lua index 31d62325..f7b30aab 100644 --- a/plugins/mod_saslauth.lua +++ b/plugins/mod_saslauth.lua @@ -10,8 +10,10 @@ local st = require "util.stanza"; local sm_bind_resource = require "core.sessionmanager".bind_resource; +local sm_make_authenticated = require "core.sessionmanager".make_authenticated; local base64 = require "util.encodings".base64; +local datamanager_load = require "util.datamanager".load; local usermanager_validate_credentials = require "core.usermanager".validate_credentials; local t_concat, t_insert = table.concat, table.insert; local tostring = tostring; @@ -49,14 +51,14 @@ local function handle_status(session, status) session.sasl_handler = nil; elseif status == "success" then if not session.sasl_handler.username then error("SASL succeeded but we didn't get a username!"); end -- TODO move this to sessionmanager - sessionmanager.make_authenticated(session, session.sasl_handler.username); + sm_make_authenticated(session, session.sasl_handler.username); session.sasl_handler = nil; session:reset_stream(); end end local function password_callback(node, host, mechanism, decoder) - local password = (datamanager.load(node, host, "accounts") or {}).password; -- FIXME handle hashed passwords + local password = (datamanager_load(node, host, "accounts") or {}).password; -- FIXME handle hashed passwords local func = function(x) return x; end; if password then if mechanism == "PLAIN" then diff --git a/plugins/mod_vcard.lua b/plugins/mod_vcard.lua index c4afb128..2e8aea02 100644 --- a/plugins/mod_vcard.lua +++ b/plugins/mod_vcard.lua @@ -8,13 +8,13 @@ -require "util.datamanager" -local datamanager = datamanager; +local hosts = _G.hosts; +local datamanager = require "util.datamanager" local st = require "util.stanza" local t_concat, t_insert = table.concat, table.insert; -require "util.jid" +local jid = require "util.jid" local jid_split = jid.split; module:add_feature("vcard-temp"); -- cgit v1.2.3