Changeset

12972:ead41e25ebc0

core: Prefix module imports with prosody namespace
author Kim Alvefur <zash@zash.se>
date Fri, 17 Mar 2023 16:23:07 +0100
parents 12971:7214baed9e9d
children 12973:cc215923297f
files core/certmanager.lua core/configmanager.lua core/features.lua core/hostmanager.lua core/loggingmanager.lua core/moduleapi.lua core/modulemanager.lua core/portmanager.lua core/rostermanager.lua core/s2smanager.lua core/sessionmanager.lua core/stanza_router.lua core/statsmanager.lua core/storagemanager.lua core/usermanager.lua
diffstat 15 files changed, 102 insertions(+), 102 deletions(-) [+]
line wrap: on
line diff
--- a/core/certmanager.lua	Fri Mar 17 16:29:54 2023 +0100
+++ b/core/certmanager.lua	Fri Mar 17 16:23:07 2023 +0100
@@ -7,13 +7,13 @@
 --
 
 local ssl = require "ssl";
-local configmanager = require "core.configmanager";
-local log = require "util.logger".init("certmanager");
+local configmanager = require "prosody.core.configmanager";
+local log = require "prosody.util.logger".init("certmanager");
 local ssl_newcontext = ssl.newcontext;
-local new_config = require"net.server".tls_builder;
+local new_config = require"prosody.net.server".tls_builder;
 local stat = require "lfs".attributes;
 
-local x509 = require "util.x509";
+local x509 = require "prosody.util.x509";
 local lfs = require "lfs";
 
 local tonumber, tostring = tonumber, tostring;
@@ -27,7 +27,7 @@
 local pcall = pcall;
 
 local prosody = prosody;
-local pathutil = require"util.paths";
+local pathutil = require"prosody.util.paths";
 local resolve_path = pathutil.resolve_relative_path;
 local config_path = prosody.paths.config or ".";
 
--- a/core/configmanager.lua	Fri Mar 17 16:29:54 2023 +0100
+++ b/core/configmanager.lua	Fri Mar 17 16:23:07 2023 +0100
@@ -11,14 +11,14 @@
       setmetatable, rawget, rawset, io, os, error, dofile, type, pairs, ipairs;
 local format, math_max, t_insert = string.format, math.max, table.insert;
 
-local envload = require"util.envload".envload;
-local deps = require"util.dependencies";
-local resolve_relative_path = require"util.paths".resolve_relative_path;
-local glob_to_pattern = require"util.paths".glob_to_pattern;
+local envload = require"prosody.util.envload".envload;
+local deps = require"prosody.util.dependencies";
+local resolve_relative_path = require"prosody.util.paths".resolve_relative_path;
+local glob_to_pattern = require"prosody.util.paths".glob_to_pattern;
 local path_sep = package.config:sub(1,1);
-local get_traceback_table = require "util.debug".get_traceback_table;
+local get_traceback_table = require "prosody.util.debug".get_traceback_table;
 
-local encodings = deps.softreq"util.encodings";
+local encodings = deps.softreq"prosody.util.encodings";
 local nameprep = encodings and encodings.stringprep.nameprep or function (host) return host:lower(); end
 
 local _M = {};
--- a/core/features.lua	Fri Mar 17 16:29:54 2023 +0100
+++ b/core/features.lua	Fri Mar 17 16:23:07 2023 +0100
@@ -1,4 +1,4 @@
-local set = require "util.set";
+local set = require "prosody.util.set";
 
 return {
 	available = set.new{
--- a/core/hostmanager.lua	Fri Mar 17 16:29:54 2023 +0100
+++ b/core/hostmanager.lua	Fri Mar 17 16:23:07 2023 +0100
@@ -6,18 +6,18 @@
 -- COPYING file in the source package for more information.
 --
 
-local configmanager = require "core.configmanager";
-local modulemanager = require "core.modulemanager";
-local events_new = require "util.events".new;
-local disco_items = require "util.multitable".new();
+local configmanager = require "prosody.core.configmanager";
+local modulemanager = require "prosody.core.modulemanager";
+local events_new = require "prosody.util.events".new;
+local disco_items = require "prosody.util.multitable".new();
 local NULL = {};
 
-local log = require "util.logger".init("hostmanager");
+local log = require "prosody.util.logger".init("hostmanager");
 
 local hosts = prosody.hosts;
 local prosody_events = prosody.events;
 if not _G.prosody.incoming_s2s then
-	require "core.s2smanager";
+	require "prosody.core.s2smanager";
 end
 local incoming_s2s = _G.prosody.incoming_s2s;
 local core_route_stanza = _G.prosody.core_route_stanza;
--- a/core/loggingmanager.lua	Fri Mar 17 16:29:54 2023 +0100
+++ b/core/loggingmanager.lua	Fri Mar 17 16:23:07 2023 +0100
@@ -6,20 +6,20 @@
 -- COPYING file in the source package for more information.
 --
 
-local format = require "util.format".format;
+local format = require "prosody.util.format".format;
 local setmetatable, rawset, pairs, ipairs, type =
 	setmetatable, rawset, pairs, ipairs, type;
 local stdout = io.stdout;
 local io_open = io.open;
 local math_max, rep = math.max, string.rep;
 local os_date = os.date;
-local getstyle, getstring = require "util.termcolours".getstyle, require "util.termcolours".getstring;
-local st = require "util.stanza";
+local getstyle, getstring = require "prosody.util.termcolours".getstyle, require "prosody.util.termcolours".getstring;
+local st = require "prosody.util.stanza";
 
-local config = require "core.configmanager";
-local logger = require "util.logger";
+local config = require "prosody.core.configmanager";
+local logger = require "prosody.util.logger";
 
-local have_pposix, pposix = pcall(require, "util.pposix");
+local have_pposix, pposix = pcall(require, "prosody.util.pposix");
 have_pposix = have_pposix and pposix._VERSION == "0.4.0";
 
 local _ENV = nil;
--- a/core/moduleapi.lua	Fri Mar 17 16:29:54 2023 +0100
+++ b/core/moduleapi.lua	Fri Mar 17 16:23:07 2023 +0100
@@ -6,21 +6,21 @@
 -- COPYING file in the source package for more information.
 --
 
-local array = require "util.array";
-local set = require "util.set";
-local it = require "util.iterators";
-local logger = require "util.logger";
-local timer = require "util.timer";
-local resolve_relative_path = require"util.paths".resolve_relative_path;
-local st = require "util.stanza";
-local cache = require "util.cache";
-local errors = require "util.error";
-local promise = require "util.promise";
-local time_now = require "util.time".now;
-local format = require "util.format".format;
-local jid_node = require "util.jid".node;
-local jid_split = require "util.jid".split;
-local jid_resource = require "util.jid".resource;
+local array = require "prosody.util.array";
+local set = require "prosody.util.set";
+local it = require "prosody.util.iterators";
+local logger = require "prosody.util.logger";
+local timer = require "prosody.util.timer";
+local resolve_relative_path = require"prosody.util.paths".resolve_relative_path;
+local st = require "prosody.util.stanza";
+local cache = require "prosody.util.cache";
+local errors = require "prosody.util.error";
+local promise = require "prosody.util.promise";
+local time_now = require "prosody.util.time".now;
+local format = require "prosody.util.format".format;
+local jid_node = require "prosody.util.jid".node;
+local jid_split = require "prosody.util.jid".split;
+local jid_resource = require "prosody.util.jid".resource;
 
 local t_insert, t_remove, t_concat = table.insert, table.remove, table.concat;
 local error, setmetatable, type = error, setmetatable, type;
@@ -129,14 +129,14 @@
 end
 
 function api:require(lib)
-	local modulemanager = require"core.modulemanager";
+	local modulemanager = require"prosody.core.modulemanager";
 	local f, n = modulemanager.loader:load_code_ext(self.name, lib, "lib.lua", self.environment);
 	if not f then error("Failed to load plugin library '"..lib.."', error: "..n); end -- FIXME better error message
 	return f();
 end
 
 function api:depends(name)
-	local modulemanager = require"core.modulemanager";
+	local modulemanager = require"prosody.core.modulemanager";
 	if self:get_option_inherited_set("modules_disabled", {}):contains(name) then
 		error("Dependency on disabled module mod_"..name);
 	end
@@ -205,7 +205,7 @@
 end
 
 function api:get_option(name, default_value)
-	local config = require "core.configmanager";
+	local config = require "prosody.core.configmanager";
 	local value = config.get(self.host, name);
 	if value == nil then
 		value = default_value;
@@ -333,7 +333,7 @@
 end
 
 function api:get_host_items(key)
-	local modulemanager = require"core.modulemanager";
+	local modulemanager = require"prosody.core.modulemanager";
 	local result = modulemanager.get_items(key, self.host) or {};
 	return result;
 end
@@ -543,11 +543,11 @@
 
 function api:open_store(name, store_type)
 	if self.host == "*" then return nil, "global-storage-not-supported"; end
-	return require"core.storagemanager".open(self.host, name or self.name, store_type);
+	return require"prosody.core.storagemanager".open(self.host, name or self.name, store_type);
 end
 
 function api:measure(name, stat_type, conf)
-	local measure = require "core.statsmanager".measure;
+	local measure = require "prosody.core.statsmanager".measure;
 	local fixed_label_key, fixed_label_value
 	if self.host ~= "*" then
 		fixed_label_key = "host"
@@ -562,7 +562,7 @@
 end
 
 function api:metric(type_, name, unit, description, label_keys, conf)
-	local metric = require "core.statsmanager".metric;
+	local metric = require "prosody.core.statsmanager".metric;
 	local is_scoped = self.host ~= "*"
 	if is_scoped then
 		-- prepend `host` label to label keys if this is not a global module
--- a/core/modulemanager.lua	Fri Mar 17 16:29:54 2023 +0100
+++ b/core/modulemanager.lua	Fri Mar 17 16:23:07 2023 +0100
@@ -6,23 +6,23 @@
 -- COPYING file in the source package for more information.
 --
 
-local array = require "util.array";
-local logger = require "util.logger";
+local array = require "prosody.util.array";
+local logger = require "prosody.util.logger";
 local log = logger.init("modulemanager");
-local config = require "core.configmanager";
-local pluginloader = require "util.pluginloader";
-local envload = require "util.envload";
-local set = require "util.set";
+local config = require "prosody.core.configmanager";
+local pluginloader = require "prosody.util.pluginloader";
+local envload = require "prosody.util.envload";
+local set = require "prosody.util.set";
 
-local core_features = require "core.features".available;
+local core_features = require "prosody.core.features".available;
 
-local new_multitable = require "util.multitable".new;
-local api = require "core.moduleapi"; -- Module API container
+local new_multitable = require "prosody.util.multitable".new;
+local api = require "prosody.core.moduleapi"; -- Module API container
 
 local prosody = prosody;
 local hosts = prosody.hosts;
 
-local xpcall = require "util.xpcall".xpcall;
+local xpcall = require "prosody.util.xpcall".xpcall;
 local debug_traceback = debug.traceback;
 local setmetatable, rawget = setmetatable, rawget;
 local ipairs, pairs, type, t_insert = ipairs, pairs, type, table.insert;
--- a/core/portmanager.lua	Fri Mar 17 16:29:54 2023 +0100
+++ b/core/portmanager.lua	Fri Mar 17 16:23:07 2023 +0100
@@ -1,11 +1,11 @@
-local config = require "core.configmanager";
-local certmanager = require "core.certmanager";
-local server = require "net.server";
+local config = require "prosody.core.configmanager";
+local certmanager = require "prosody.core.certmanager";
+local server = require "prosody.net.server";
 local socket = require "socket";
 
-local log = require "util.logger".init("portmanager");
-local multitable = require "util.multitable";
-local set = require "util.set";
+local log = require "prosody.util.logger".init("portmanager");
+local multitable = require "prosody.util.multitable";
+local set = require "prosody.util.set";
 
 local table = table;
 local setmetatable, rawset, rawget = setmetatable, rawset, rawget;
--- a/core/rostermanager.lua	Fri Mar 17 16:29:54 2023 +0100
+++ b/core/rostermanager.lua	Fri Mar 17 16:23:07 2023 +0100
@@ -9,10 +9,10 @@
 
 
 
-local log = require "util.logger".init("rostermanager");
+local log = require "prosody.util.logger".init("rostermanager");
 
-local new_id = require "util.id".short;
-local new_cache = require "util.cache".new;
+local new_id = require "prosody.util.id".short;
+local new_cache = require "prosody.util.cache".new;
 
 local pairs = pairs;
 local tostring = tostring;
@@ -21,9 +21,9 @@
 local hosts = prosody.hosts;
 local bare_sessions = prosody.bare_sessions;
 
-local um_user_exists = require "core.usermanager".user_exists;
-local st = require "util.stanza";
-local storagemanager = require "core.storagemanager";
+local um_user_exists = require "prosody.core.usermanager".user_exists;
+local st = require "prosody.util.stanza";
+local storagemanager = require "prosody.core.storagemanager";
 
 local _ENV = nil;
 -- luacheck: std none
--- a/core/s2smanager.lua	Fri Mar 17 16:29:54 2023 +0100
+++ b/core/s2smanager.lua	Fri Mar 17 16:23:07 2023 +0100
@@ -11,8 +11,8 @@
 local hosts = prosody.hosts;
 local pairs, setmetatable = pairs, setmetatable;
 
-local logger_init = require "util.logger".init;
-local sessionlib = require "util.session";
+local logger_init = require "prosody.util.logger".init;
+local sessionlib = require "prosody.util.session";
 
 local log = logger_init("s2smanager");
 
--- a/core/sessionmanager.lua	Fri Mar 17 16:29:54 2023 +0100
+++ b/core/sessionmanager.lua	Fri Mar 17 16:23:07 2023 +0100
@@ -14,16 +14,16 @@
 local full_sessions = prosody.full_sessions;
 local bare_sessions = prosody.bare_sessions;
 
-local logger = require "util.logger";
+local logger = require "prosody.util.logger";
 local log = logger.init("sessionmanager");
-local rm_load_roster = require "core.rostermanager".load_roster;
-local config_get = require "core.configmanager".get;
-local resourceprep = require "util.encodings".stringprep.resourceprep;
-local nodeprep = require "util.encodings".stringprep.nodeprep;
-local generate_identifier = require "util.id".short;
-local sessionlib = require "util.session";
+local rm_load_roster = require "prosody.core.rostermanager".load_roster;
+local config_get = require "prosody.core.configmanager".get;
+local resourceprep = require "prosody.util.encodings".stringprep.resourceprep;
+local nodeprep = require "prosody.util.encodings".stringprep.nodeprep;
+local generate_identifier = require "prosody.util.id".short;
+local sessionlib = require "prosody.util.session";
 
-local initialize_filters = require "util.filters".initialize;
+local initialize_filters = require "prosody.util.filters".initialize;
 local gettime = require "socket".gettime;
 
 local _ENV = nil;
--- a/core/stanza_router.lua	Fri Mar 17 16:29:54 2023 +0100
+++ b/core/stanza_router.lua	Fri Mar 17 16:23:07 2023 +0100
@@ -6,14 +6,14 @@
 -- COPYING file in the source package for more information.
 --
 
-local log = require "util.logger".init("stanzarouter")
+local log = require "prosody.util.logger".init("stanzarouter")
 
 local hosts = _G.prosody.hosts;
 local tostring = tostring;
-local st = require "util.stanza";
-local jid_split = require "util.jid".split;
-local jid_host = require "util.jid".host;
-local jid_prepped_split = require "util.jid".prepped_split;
+local st = require "prosody.util.stanza";
+local jid_split = require "prosody.util.jid".split;
+local jid_host = require "prosody.util.jid".host;
+local jid_prepped_split = require "prosody.util.jid".prepped_split;
 
 local full_sessions = _G.prosody.full_sessions;
 local bare_sessions = _G.prosody.bare_sessions;
--- a/core/statsmanager.lua	Fri Mar 17 16:29:54 2023 +0100
+++ b/core/statsmanager.lua	Fri Mar 17 16:23:07 2023 +0100
@@ -1,10 +1,10 @@
 
-local config = require "core.configmanager";
-local log = require "util.logger".init("stats");
-local timer = require "util.timer";
+local config = require "prosody.core.configmanager";
+local log = require "prosody.util.logger".init("stats");
+local timer = require "prosody.util.timer";
 local fire_event = prosody.events.fire_event;
-local array = require "util.array";
-local timed = require "util.openmetrics".timed;
+local array = require "prosody.util.array";
+local timed = require "prosody.util.openmetrics".timed;
 
 local stats_interval_config = config.get("*", "statistics_interval");
 local stats_interval = tonumber(stats_interval_config);
@@ -26,8 +26,8 @@
 end
 
 local builtin_providers = {
-	internal = "util.statistics";
-	statsd = "util.statsd";
+	internal = "prosody.util.statistics";
+	statsd = "prosody.util.statsd";
 };
 
 
--- a/core/storagemanager.lua	Fri Mar 17 16:29:54 2023 +0100
+++ b/core/storagemanager.lua	Fri Mar 17 16:23:07 2023 +0100
@@ -3,12 +3,12 @@
 local setmetatable = setmetatable;
 local rawset = rawset;
 
-local config = require "core.configmanager";
-local datamanager = require "util.datamanager";
-local modulemanager = require "core.modulemanager";
-local multitable = require "util.multitable";
-local log = require "util.logger".init("storagemanager");
-local async = require "util.async";
+local config = require "prosody.core.configmanager";
+local datamanager = require "prosody.util.datamanager";
+local modulemanager = require "prosody.core.modulemanager";
+local multitable = require "prosody.util.multitable";
+local log = require "prosody.util.logger".init("storagemanager");
+local async = require "prosody.util.async";
 local debug = debug;
 
 local prosody = prosody;
--- a/core/usermanager.lua	Fri Mar 17 16:29:54 2023 +0100
+++ b/core/usermanager.lua	Fri Mar 17 16:23:07 2023 +0100
@@ -6,13 +6,13 @@
 -- COPYING file in the source package for more information.
 --
 
-local modulemanager = require "core.modulemanager";
-local log = require "util.logger".init("usermanager");
+local modulemanager = require "prosody.core.modulemanager";
+local log = require "prosody.util.logger".init("usermanager");
 local type = type;
-local jid_split = require "util.jid".split;
-local config = require "core.configmanager";
-local sasl_new = require "util.sasl".new;
-local storagemanager = require "core.storagemanager";
+local jid_split = require "prosody.util.jid".split;
+local config = require "prosody.core.configmanager";
+local sasl_new = require "prosody.util.sasl".new;
+local storagemanager = require "prosody.core.storagemanager";
 
 local prosody = _G.prosody;
 local hosts = prosody.hosts;