comparison mod_archive_muc/mod_archive_muc.lua @ 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 ef0b580f434d
children 2c85635318a5
comparison
equal deleted inserted replaced
242:161067865850 243:6202ce4d12d6
13 local rom = require "core.rostermanager"; 13 local rom = require "core.rostermanager";
14 14
15 local PREFS_DIR = "archive_muc_prefs"; 15 local PREFS_DIR = "archive_muc_prefs";
16 local ARCHIVE_DIR = "archive_muc"; 16 local ARCHIVE_DIR = "archive_muc";
17 17
18 local AUTO_ARCHIVING_ENABLED = true; 18 local AUTO_MUC_ARCHIVING_ENABLED = module:get_option_boolean("auto_muc_archiving_enabled", true);
19 19
20 module:add_feature("urn:xmpp:archive#preferences"); 20 module:add_feature("urn:xmpp:archive#preferences");
21 module:add_feature("urn:xmpp:archive#management"); 21 module:add_feature("urn:xmpp:archive#management");
22 22
23 ------------------------------------------------------------ 23 ------------------------------------------------------------
141 end 141 end
142 142
143 local function apply_pref(node, host, jid) 143 local function apply_pref(node, host, jid)
144 local pref = load_prefs(node, host); 144 local pref = load_prefs(node, host);
145 if not pref then 145 if not pref then
146 return AUTO_ARCHIVING_ENABLED; 146 return AUTO_MUC_ARCHIVING_ENABLED;
147 end 147 end
148 local always = pref:child_with_name('always'); 148 local always = pref:child_with_name('always');
149 if always and is_in(always, jid) then 149 if always and is_in(always, jid) then
150 return true; 150 return true;
151 end 151 end
159 elseif default == 'always' then 159 elseif default == 'always' then
160 return true; 160 return true;
161 elseif default == 'never' then 161 elseif default == 'never' then
162 return false; 162 return false;
163 end 163 end
164 return AUTO_ARCHIVING_ENABLED; 164 return AUTO_MUC_ARCHIVING_ENABLED;
165 end 165 end
166 166
167 local function store_msg(msg, node, host) 167 local function store_msg(msg, node, host)
168 local forwarded = st.stanza('forwarded', {xmlns='urn:xmpp:forward:tmp'}); 168 local forwarded = st.stanza('forwarded', {xmlns='urn:xmpp:forward:tmp'});
169 forwarded:tag('delay', {xmlns='urn:xmpp:delay',stamp=date_time()}):up(); 169 forwarded:tag('delay', {xmlns='urn:xmpp:delay',stamp=date_time()}):up();
194 -- Archive management 194 -- Archive management
195 module:hook("iq/self/urn:xmpp:archive#management:query", management_handler); 195 module:hook("iq/self/urn:xmpp:archive#management:query", management_handler);
196 196
197 module:hook("message/bare", msg_handler, 20); 197 module:hook("message/bare", msg_handler, 20);
198 198
199 -- TODO prefs: [1] = "\n ";