Mercurial > prosody-hg
comparison util/jid.lua @ 2245:df9e18f5c808
util.jid: Add join(node, host, resource) function to join the components and return nil if invalid
| author | Matthew Wild <mwild1@gmail.com> |
|---|---|
| date | Fri, 27 Nov 2009 17:33:55 +0000 |
| parents | 841d61be198f |
| children | b7049746bd29 |
comparison
equal
deleted
inserted
replaced
| 2244:730038d3e9e3 | 2245:df9e18f5c808 |
|---|---|
| 63 end | 63 end |
| 64 end | 64 end |
| 65 return host; | 65 return host; |
| 66 end | 66 end |
| 67 | 67 |
| 68 function join(node, host, resource) | |
| 69 if node and host and resource then | |
| 70 return node.."@"..host.."/"..resource; | |
| 71 elseif node and host then | |
| 72 return node.."@"..host; | |
| 73 elseif host and resource then | |
| 74 return host.."/"..resource; | |
| 75 elseif host then | |
| 76 return host; | |
| 77 end | |
| 78 return nil; -- Invalid JID | |
| 79 end | |
| 80 | |
| 68 return _M; | 81 return _M; |
