From df5bec6e971a0e0f2dda68eb97e3c39e80114f68 Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 7 Jan 2011 03:46:10 +0000 Subject: mod_motd: Process value to strip any indentation from the config --- plugins/mod_motd.lua | 2 ++ 1 file changed, 2 insertions(+) (limited to 'plugins') diff --git a/plugins/mod_motd.lua b/plugins/mod_motd.lua index f323e606..462670e6 100644 --- a/plugins/mod_motd.lua +++ b/plugins/mod_motd.lua @@ -13,6 +13,8 @@ local motd_jid = module:get_option("motd_jid") or host; local st = require "util.stanza"; +motd_text = motd_text:gsub("^%s*(.-)%s*$", "%1"):gsub("\n%s+", "\n"); -- Strip indentation from the config + module:hook("resource-bind", function (event) local session = event.session; -- cgit v1.2.3 From 909cdebf943ad24ce00d5d50e630994ba08a47ec Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Fri, 7 Jan 2011 04:22:28 +0000 Subject: storagemanager, mod_storage_internal: Split out default driver to mod_storage_internal, and greatly simplify storagemanager's error handling and fallback code --- plugins/mod_storage_internal.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 plugins/mod_storage_internal.lua (limited to 'plugins') diff --git a/plugins/mod_storage_internal.lua b/plugins/mod_storage_internal.lua new file mode 100644 index 00000000..821d1e1a --- /dev/null +++ b/plugins/mod_storage_internal.lua @@ -0,0 +1,19 @@ +local datamanager = require "core.storagemanager".olddm; + +local host = module.host; + +local driver = { name = "internal" }; +local driver_mt = { __index = driver }; + +function driver:open(store) + return setmetatable({ store = store }, driver_mt); +end +function driver:get(user) + return datamanager.load(user, host, self.store); +end + +function driver:set(user, data) + return datamanager.store(user, host, self.store, data); +end + +module:add_item("data-driver", driver); -- cgit v1.2.3