2 local match = string.match;
7 if not jid then return; end
8 -- TODO verify JID, and return; if invalid
9 local node, nodelen = match(jid, "^([^@]+)@()");
10 local host, hostlen = match(jid, "^([^@/]+)()", nodelen)
11 if node and not host then return nil, nil, nil; end
12 local resource = match(jid, "^/(.+)$", hostlen);
13 if (not host) or ((not resource) and #jid >= hostlen) then return nil, nil, nil; end
14 return node, host, resource;
18 local node, host = split(jid);
20 return node.."@"..host;