Changeset

243:6202ce4d12d6

mod_archive: added some config options. mod_archive_muc: added some config options.
author shinysky<shinysky1986(AT)gmail.com>
date Fri, 13 Aug 2010 20:21:39 +0800
parents 242:161067865850
children 244:e0802b2716c3
files mod_archive/mod_archive.lua mod_archive_muc/mod_archive_muc.lua
diffstat 2 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mod_archive/mod_archive.lua	Thu Aug 12 23:07:14 2010 +0200
+++ b/mod_archive/mod_archive.lua	Fri Aug 13 20:21:39 2010 +0800
@@ -14,10 +14,10 @@
 local PREFS_DIR = "archive_prefs";
 local ARCHIVE_DIR = "archive";
 local xmlns_rsm = "http://jabber.org/protocol/rsm";
-local DEFAULT_MAX = 100;
 
-local FORCE_ARCHIVING = false;
-local AUTO_ARCHIVING_ENABLED = true;
+local DEFAULT_MAX = module:get_option_number("default_max", 100);
+local FORCE_ARCHIVING = module:get_option_boolean("force_archiving", false);
+local AUTO_ARCHIVING_ENABLED = module:get_option_boolean("auto_archiving_enabled", true);
 
 module:add_feature("urn:xmpp:archive");
 module:add_feature("urn:xmpp:archive:auto");
--- a/mod_archive_muc/mod_archive_muc.lua	Thu Aug 12 23:07:14 2010 +0200
+++ b/mod_archive_muc/mod_archive_muc.lua	Fri Aug 13 20:21:39 2010 +0800
@@ -15,7 +15,7 @@
 local PREFS_DIR = "archive_muc_prefs";
 local ARCHIVE_DIR = "archive_muc";
 
-local AUTO_ARCHIVING_ENABLED = true;
+local AUTO_MUC_ARCHIVING_ENABLED = module:get_option_boolean("auto_muc_archiving_enabled", true);
 
 module:add_feature("urn:xmpp:archive#preferences");
 module:add_feature("urn:xmpp:archive#management");
@@ -143,7 +143,7 @@
 local function apply_pref(node, host, jid)
     local pref = load_prefs(node, host);
     if not pref then
-        return AUTO_ARCHIVING_ENABLED;
+        return AUTO_MUC_ARCHIVING_ENABLED;
     end
     local always = pref:child_with_name('always');
     if always and is_in(always, jid) then
@@ -161,7 +161,7 @@
     elseif default == 'never' then
         return false;
     end
-    return AUTO_ARCHIVING_ENABLED;
+    return AUTO_MUC_ARCHIVING_ENABLED;
 end
 
 local function store_msg(msg, node, host)
@@ -196,4 +196,3 @@
 
 module:hook("message/bare", msg_handler, 20);
 
--- TODO prefs: [1] = "\n      ";