Software /
code /
prosody
Comparison
util/jid.lua @ 6338:736c388748fd
util.jid: Return early in join on invalid jids
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 07 Aug 2014 17:20:51 +0200 |
parent | 5945:51ead0aa3a02 |
child | 6339:1c19464cde77 |
comparison
equal
deleted
inserted
replaced
6337:925aceee8280 | 6338:736c388748fd |
---|---|
77 end | 77 end |
78 return host; | 78 return host; |
79 end | 79 end |
80 | 80 |
81 function join(node, host, resource) | 81 function join(node, host, resource) |
82 if node and host and resource then | 82 if not host then return end -- Invalid JID |
83 if node and resource then | |
83 return node.."@"..host.."/"..resource; | 84 return node.."@"..host.."/"..resource; |
84 elseif node and host then | 85 elseif node then |
85 return node.."@"..host; | 86 return node.."@"..host; |
86 elseif host and resource then | 87 elseif resource then |
87 return host.."/"..resource; | 88 return host.."/"..resource; |
88 elseif host then | |
89 return host; | |
90 end | 89 end |
91 return nil; -- Invalid JID | 90 return host; |
92 end | 91 end |
93 | 92 |
94 function compare(jid, acl) | 93 function compare(jid, acl) |
95 -- compare jid to single acl rule | 94 -- compare jid to single acl rule |
96 -- TODO compare to table of rules? | 95 -- TODO compare to table of rules? |