comparison util/jid.lua @ 3376:529bc6ea24e2

Merge Zash->trunk
author Matthew Wild <mwild1@gmail.com>
date Fri, 16 Jul 2010 15:10:45 +0100
parents 29e51e1c7c3d
children 97831dfe7f72
comparison
equal deleted inserted replaced
3374:ce52f1d5cb74 3376:529bc6ea24e2
76 return host; 76 return host;
77 end 77 end
78 return nil; -- Invalid JID 78 return nil; -- Invalid JID
79 end 79 end
80 80
81 function compare(jid, acl)
82 -- compare jid to single acl rule
83 -- TODO compare to table of rules?
84 local jid_node, jid_host, jid_resource = _split(jid);
85 local acl_node, acl_host, acl_resource = _split(acl);
86 if ((acl_node ~= nil and acl_node == jid_node) or acl_node == nil) and
87 ((acl_host ~= nil and acl_host == jid_host) or acl_host == nil) and
88 ((acl_resource ~= nil and acl_resource == jid_resource) or acl_resource == nil) then
89 return true
90 end
91 return false
92 end
93
81 return _M; 94 return _M;