comparison mod_blocking/mod_blocking.lua @ 163:9fe6d314fd07

mod_blocking: Only count rules with action == "deny" as blocked JIDs
author Matthew Wild <mwild1@gmail.com>
date Thu, 03 Jun 2010 11:19:50 +0100
parents fda7faee7677
children 0b238b2b0801
comparison
equal deleted inserted replaced
162:fe9c4daee076 163:9fe6d314fd07
39 if not default_list then return; end 39 if not default_list then return; end
40 local items = default_list.items; 40 local items = default_list.items;
41 local item; 41 local item;
42 for i=1,#items do -- order must be unique 42 for i=1,#items do -- order must be unique
43 item = items[i]; 43 item = items[i];
44 if item.type == "jid" and item.value == jid then 44 if item.type == "jid" and item.action == "deny" and item.value == jid then
45 table.remove(items, i); 45 table.remove(items, i);
46 return true; 46 return true;
47 end 47 end
48 end 48 end
49 end 49 end
58 local items = default_list.items; 58 local items = default_list.items;
59 local item; 59 local item;
60 local jid_list = {}; 60 local jid_list = {};
61 for i=1,#items do -- order must be unique 61 for i=1,#items do -- order must be unique
62 item = items[i]; 62 item = items[i];
63 if item.type == "jid" then 63 if item.type == "jid" and item.action == "deny" then
64 jid_list[#jid_list+1] = item.value; 64 jid_list[#jid_list+1] = item.value;
65 end 65 end
66 end 66 end
67 return jid_list; 67 return jid_list;
68 end 68 end