Comparison

mod_privacy/mod_privacy.lua @ 19:e400ee8471b0

mod_privacy: removed trunk dependency; make it work when no lists already are exiting
author Thilo Cestonaro <thilo@cestona.ro>
date Tue, 29 Sep 2009 12:59:42 +0200
parent 18:2df11ec081fe
child 20:2675dc25445b
comparison
equal deleted inserted replaced
18:2df11ec081fe 19:e400ee8471b0
6 -- This project is MIT/X11 licensed. Please see the 6 -- This project is MIT/X11 licensed. Please see the
7 -- COPYING file in the source package for more information. 7 -- COPYING file in the source package for more information.
8 -- 8 --
9 9
10 local prosody = prosody; 10 local prosody = prosody;
11 local helpers = require "util/helpers";
12 local st = require "util.stanza"; 11 local st = require "util.stanza";
13 local datamanager = require "util.datamanager"; 12 local datamanager = require "util.datamanager";
14 local bare_sessions = bare_sessions; 13 local bare_sessions = bare_sessions;
15 local util_Jid = require "util.jid"; 14 local util_Jid = require "util.jid";
16 local jid_bare = util_Jid.bare; 15 local jid_bare = util_Jid.bare;
188 reply:tag("default", {name=privacy_lists.default or ""}):up(); 187 reply:tag("default", {name=privacy_lists.default or ""}):up();
189 if privacy_lists.lists then 188 if privacy_lists.lists then
190 for _,list in ipairs(privacy_lists.lists) do 189 for _,list in ipairs(privacy_lists.lists) do
191 reply:tag("list", {name=list.name}):up(); 190 reply:tag("list", {name=list.name}):up();
192 end 191 end
193 ret = true; 192 end
194 end 193 ret = true;
195 else 194 else
196 local idx = findNamedList(privacy_lists, name); 195 local idx = findNamedList(privacy_lists, name);
197 module:log("debug", "list idx: %d", idx or -1); 196 module:log("debug", "list idx: %d", idx or -1);
198 if idx ~= nil then 197 if idx ~= nil then
199 list = privacy_lists.lists[idx]; 198 list = privacy_lists.lists[idx];
458 module:hook("iq/host", preCheckIncoming, 500); 457 module:hook("iq/host", preCheckIncoming, 500);
459 module:hook("presence/full", preCheckIncoming, 500); 458 module:hook("presence/full", preCheckIncoming, 500);
460 module:hook("presence/bare", preCheckIncoming, 500); 459 module:hook("presence/bare", preCheckIncoming, 500);
461 module:hook("presence/host", preCheckIncoming, 500); 460 module:hook("presence/host", preCheckIncoming, 500);
462 461
463 -- helpers.log_events(hosts["albastru.de"].events, "albastru.de");
464 -- helpers.log_events(prosody.events, "*");
465
466 module:log("info", "mod_privacy loaded ..."); 462 module:log("info", "mod_privacy loaded ...");