Comparison

tools/openfire2prosody.lua @ 13142:879a6a33c21b

tools: Update imports to use new prosody.* namespace
author Kim Alvefur <zash@zash.se>
date Thu, 08 Jun 2023 09:37:01 +0200
parent 5776:bd0ff8ae98a8
comparison
equal deleted inserted replaced
13141:451cb119026e 13142:879a6a33c21b
13 if my_name:match("[/\\]") then 13 if my_name:match("[/\\]") then
14 package.path = package.path..";"..my_name:gsub("[^/\\]+$", "../?.lua"); 14 package.path = package.path..";"..my_name:gsub("[^/\\]+$", "../?.lua");
15 package.cpath = package.cpath..";"..my_name:gsub("[^/\\]+$", "../?.so"); 15 package.cpath = package.cpath..";"..my_name:gsub("[^/\\]+$", "../?.so");
16 end 16 end
17 17
18 if not pcall(require, "prosody.loader") then
19 pcall(require, "loader");
20 end
21
18 -- ugly workaround for getting datamanager to work outside of prosody :( 22 -- ugly workaround for getting datamanager to work outside of prosody :(
19 prosody = { }; 23 prosody = { };
20 prosody.platform = "unknown"; 24 prosody.platform = "unknown";
21 if os.getenv("WINDIR") then 25 if os.getenv("WINDIR") then
22 prosody.platform = "windows"; 26 prosody.platform = "windows";
23 elseif package.config:sub(1,1) == "/" then 27 elseif package.config:sub(1,1) == "/" then
24 prosody.platform = "posix"; 28 prosody.platform = "posix";
25 end 29 end
26 30
27 local parse_xml = require "util.xml".parse; 31 local parse_xml = require "prosody.util.xml".parse;
28 32
29 ----------------------------------------------------------------------- 33 -----------------------------------------------------------------------
30 34
31 package.loaded["util.logger"] = {init = function() return function() end; end} 35 package.loaded["util.logger"] = {init = function() return function() end; end}
32 local dm = require "util.datamanager" 36 local dm = require "prosody.util.datamanager"
33 dm.set_data_path("data"); 37 dm.set_data_path("data");
34 38
35 local arg = ...; 39 local arg = ...;
36 local help = "/? -? ? /h -h /help -help --help"; 40 local help = "/? -? ? /h -h /help -help --help";
37 if not arg or help:find(arg, 1, true) then 41 if not arg or help:find(arg, 1, true) then