-function join(node, host, resource)
- if node and host and resource then
- return node.."@"..host.."/"..resource;
- elseif node and host then
- return node.."@"..host;
- elseif host and resource then
- return host.."/"..resource;
- elseif host then
- return host;
+local function prep(jid)
+ local node, host, resource = prepped_split(jid);
+ return join(node, host, resource);
+end
+
+local function compare(jid, acl)
+ -- compare jid to single acl rule
+ -- TODO compare to table of rules?
+ local jid_node, jid_host, jid_resource = split(jid);
+ local acl_node, acl_host, acl_resource = split(acl);
+ if ((acl_node ~= nil and acl_node == jid_node) or acl_node == nil) and
+ ((acl_host ~= nil and acl_host == jid_host) or acl_host == nil) and
+ ((acl_resource ~= nil and acl_resource == jid_resource) or acl_resource == nil) then
+ return true