From 49c6a0dd6fed572562840d7fcc9416c3663551d0 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Tue, 31 Jan 2017 22:49:09 +0100 Subject: Makefile: Install mod_mam (fixes #825) --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index b814736a..a5f75c19 100644 --- a/Makefile +++ b/Makefile @@ -44,12 +44,13 @@ install: prosody.install prosodyctl.install prosody.cfg.lua.install util/encodin $(INSTALL_DATA) util/*.so $(SOURCE)/util $(MKDIR) $(SOURCE)/util/sasl $(INSTALL_DATA) util/sasl/*.lua $(SOURCE)/util/sasl - $(MKDIR) $(MODULES)/mod_s2s $(MODULES)/mod_pubsub $(MODULES)/adhoc $(MODULES)/muc + $(MKDIR) $(MODULES)/mod_s2s $(MODULES)/mod_pubsub $(MODULES)/adhoc $(MODULES)/muc $(MODULES)/mod_mam $(INSTALL_DATA) plugins/*.lua $(MODULES) $(INSTALL_DATA) plugins/mod_s2s/*.lua $(MODULES)/mod_s2s $(INSTALL_DATA) plugins/mod_pubsub/*.lua $(MODULES)/mod_pubsub $(INSTALL_DATA) plugins/adhoc/*.lua $(MODULES)/adhoc $(INSTALL_DATA) plugins/muc/*.lua $(MODULES)/muc + $(INSTALL_DATA) plugins/mod_mam/*.lua $(MODULES)/mod_mam $(INSTALL_DATA) certs/* $(CONFIG)/certs $(INSTALL_DATA) man/prosodyctl.man $(MAN)/man1/prosodyctl.1 test -f $(CONFIG)/prosody.cfg.lua || $(INSTALL_DATA) prosody.cfg.lua.install $(CONFIG)/prosody.cfg.lua -- cgit v1.2.3 From f0918f4e1b59ca6f360a4b1ae2974a9c339e71a1 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 2 Feb 2017 20:11:25 +0100 Subject: migrator: Remove wrapper around envloadfile since envloadfile does the right thing in a compatible way --- tools/migration/prosody-migrator.lua | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/tools/migration/prosody-migrator.lua b/tools/migration/prosody-migrator.lua index b86e9892..8560ddb5 100644 --- a/tools/migration/prosody-migrator.lua +++ b/tools/migration/prosody-migrator.lua @@ -40,22 +40,13 @@ end local envloadfile = require "util.envload".envloadfile; --- Load config file -local function loadfilein(file, env) - if loadin then - return loadin(env, io.open(file):read("*a")); - else - return envloadfile(file, env); - end -end - local config_file = options.config or default_config; local from_store = arg[1] or "input"; local to_store = arg[2] or "output"; config = {}; local config_env = setmetatable({}, { __index = function(t, k) return function(tbl) config[k] = tbl; end; end }); -local config_chunk, err = loadfilein(config_file, config_env); +local config_chunk, err = envloadfile(config_file, config_env); if not config_chunk then print("There was an error loading the config file, check the file exists"); print("and that the syntax is correct:"); -- cgit v1.2.3 From 0a385a3953bff3088fb3d4d53cf6a5a9b618f006 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 2 Feb 2017 20:49:09 +0100 Subject: tools/migration/migrator/*: Remove use of module() --- tools/migration/migrator/jabberd14.lua | 7 ++++--- tools/migration/migrator/mtools.lua | 10 ++++++---- tools/migration/migrator/prosody_files.lua | 10 ++++++---- tools/migration/migrator/prosody_sql.lua | 10 ++++++---- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/tools/migration/migrator/jabberd14.lua b/tools/migration/migrator/jabberd14.lua index 2f0b0b78..a4eef3f7 100644 --- a/tools/migration/migrator/jabberd14.lua +++ b/tools/migration/migrator/jabberd14.lua @@ -9,7 +9,6 @@ local ipairs = ipairs; local coroutine = coroutine; local print = print; -module "jabberd14" local function is_dir(path) return lfs.attributes(path, "mode") == "directory"; end local function is_file(path) return lfs.attributes(path, "mode") == "file"; end @@ -128,7 +127,7 @@ local function loop_over_hosts(path, cb) end end -function reader(input) +local function reader(input) local path = clean_path(assert(input.path, "no input.path specified")); assert(is_dir(path), "input.path is not a directory"); @@ -139,4 +138,6 @@ function reader(input) end end -return _M; +return { + reader = reader; +}; diff --git a/tools/migration/migrator/mtools.lua b/tools/migration/migrator/mtools.lua index e7b774bb..cfbfcce8 100644 --- a/tools/migration/migrator/mtools.lua +++ b/tools/migration/migrator/mtools.lua @@ -4,9 +4,8 @@ local print = print; local t_insert = table.insert; local t_sort = table.sort; -module "mtools" -function sorted(params) +local function sorted(params) local reader = params.reader; -- iterator to get items from local sorter = params.sorter; -- sorting function @@ -28,7 +27,7 @@ function sorted(params) end -function merged(reader, merger) +local function merged(reader, merger) local item1 = reader(); local merged = { item1 }; @@ -53,4 +52,7 @@ function merged(reader, merger) end -return _M; +return { + sorted = sorted; + merged = merged; +} diff --git a/tools/migration/migrator/prosody_files.lua b/tools/migration/migrator/prosody_files.lua index c9367d9c..4de09273 100644 --- a/tools/migration/migrator/prosody_files.lua +++ b/tools/migration/migrator/prosody_files.lua @@ -18,7 +18,6 @@ local error = error; prosody = {}; local dm = require "util.datamanager" -module "prosody_files" local function is_dir(path) return lfs.attributes(path, "mode") == "directory"; end local function is_file(path) return lfs.attributes(path, "mode") == "file"; end @@ -88,7 +87,7 @@ local function decode_user(item) return userdata; end -function reader(input) +local function reader(input) local path = clean_path(assert(input.path, "no input.path specified")); assert(is_dir(path), "input.path is not a directory"); local iter = coroutine.wrap(function()handle_root_dir(path);end); @@ -127,7 +126,7 @@ function reader(input) end end -function writer(output) +local function writer(output) local path = clean_path(assert(output.path, "no output.path specified")); assert(is_dir(path), "output.path is not a directory"); return function(item) @@ -139,4 +138,7 @@ function writer(output) end end -return _M; +return { + reader = reader; + writer = writer; +} diff --git a/tools/migration/migrator/prosody_sql.lua b/tools/migration/migrator/prosody_sql.lua index 180ae910..0041ca9e 100644 --- a/tools/migration/migrator/prosody_sql.lua +++ b/tools/migration/migrator/prosody_sql.lua @@ -15,7 +15,6 @@ if not have_DBI then error("LuaDBI (required for SQL support) was not found, please see http://prosody.im/doc/depends#luadbi", 0); end -module "prosody_sql" local function create_table(connection, params) local create_sql = "CREATE TABLE `prosody` (`host` TEXT, `user` TEXT, `store` TEXT, `key` TEXT, `type` TEXT, `value` TEXT);"; @@ -110,7 +109,7 @@ local function decode_user(item) return userdata; end -function reader(input) +local function reader(input) local dbh = assert(DBI.Connect( assert(input.driver, "no input.driver specified"), assert(input.database, "no input.database specified"), @@ -154,7 +153,7 @@ function reader(input) end; end -function writer(output, iter) +local function writer(output, iter) local dbh = assert(DBI.Connect( assert(output.driver, "no output.driver specified"), assert(output.database, "no output.database specified"), @@ -197,4 +196,7 @@ function writer(output, iter) end -return _M; +return { + reader = reader; + writer = writer; +} -- cgit v1.2.3 From 187cb3ac5eb01b962afd5dab47d45be7e7c9d45b Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 4 Feb 2017 00:57:34 +0100 Subject: mod_mam: Correct import of util.rsm --- plugins/mod_mam/mod_mam.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua index f6ca52c0..44141409 100644 --- a/plugins/mod_mam/mod_mam.lua +++ b/plugins/mod_mam/mod_mam.lua @@ -15,7 +15,7 @@ local xmlns_forward = "urn:xmpp:forward:0"; local um = require "core.usermanager"; local st = require "util.stanza"; -local rsm = require "rsm"; +local rsm = require "util.rsm"; local get_prefs = module:require"mamprefs".get; local set_prefs = module:require"mamprefs".set; local prefs_to_stanza = module:require"mamprefsxml".tostanza; -- cgit v1.2.3 From 310110c75d32ca27d60b97c9fa1dccc9099584ad Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 4 Feb 2017 00:58:48 +0100 Subject: mod_mam/mamprefs: Use 'prosody.hosts' instead of '_G.hosts' in case we ever deprecate the later --- plugins/mod_mam/mamprefs.lib.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/mod_mam/mamprefs.lib.lua b/plugins/mod_mam/mamprefs.lib.lua index 054b6861..09efc006 100644 --- a/plugins/mod_mam/mamprefs.lib.lua +++ b/plugins/mod_mam/mamprefs.lib.lua @@ -22,7 +22,7 @@ do }; end -local sessions = hosts[module.host].sessions; +local sessions = prosody.hosts[module.host].sessions; local archive_store = module:get_option_string("archive_store", "archive"); local prefs = module:open_store(archive_store .. "_prefs"); -- cgit v1.2.3 From 0e99534951484e5c1ab98897272c92ea6b13f8ff Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Sat, 4 Feb 2017 00:59:10 +0100 Subject: mod_mam: Ignore "indirectly mutating read-only global variable prosody" warning [luacheck] --- plugins/mod_mam/mamprefs.lib.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/plugins/mod_mam/mamprefs.lib.lua b/plugins/mod_mam/mamprefs.lib.lua index 09efc006..a561b9d5 100644 --- a/plugins/mod_mam/mamprefs.lib.lua +++ b/plugins/mod_mam/mamprefs.lib.lua @@ -8,6 +8,7 @@ -- -- XEP-0313: Message Archive Management for Prosody -- +-- luacheck: ignore 122/prosody local global_default_policy = module:get_option("default_archive_policy", true); -- cgit v1.2.3