Software /
code /
prosody
Comparison
util/jid.lua @ 368:34e88709b1b5
Remove old TODO
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 21 Nov 2008 05:06:35 +0000 |
parent | 367:cc26368294a3 |
child | 369:42de92add67b |
comparison
equal
deleted
inserted
replaced
367:cc26368294a3 | 368:34e88709b1b5 |
---|---|
3 | 3 |
4 module "jid" | 4 module "jid" |
5 | 5 |
6 function split(jid) | 6 function split(jid) |
7 if not jid then return; end | 7 if not jid then return; end |
8 -- TODO verify JID, and return; if invalid | |
9 local node, nodelen = match(jid, "^([^@]+)@()"); | 8 local node, nodelen = match(jid, "^([^@]+)@()"); |
10 local host, hostlen = match(jid, "^([^@/]+)()", nodelen) | 9 local host, hostlen = match(jid, "^([^@/]+)()", nodelen) |
11 if node and not host then return nil, nil, nil; end | 10 if node and not host then return nil, nil, nil; end |
12 local resource = match(jid, "^/(.+)$", hostlen); | 11 local resource = match(jid, "^/(.+)$", hostlen); |
13 if (not host) or ((not resource) and #jid >= hostlen) then return nil, nil, nil; end | 12 if (not host) or ((not resource) and #jid >= hostlen) then return nil, nil, nil; end |