2 local match = string.match;
7 if not jid then return; end
8 local node, nodepos = match(jid, "^([^@]+)@()");
9 local host, hostpos = match(jid, "^([^@/]+)()", nodepos)
10 if node and not host then return nil, nil, nil; end
11 local resource = match(jid, "^/(.+)$", hostpos);
12 if (not host) or ((not resource) and #jid >= hostpos) then return nil, nil, nil; end
13 return node, host, resource;
17 local node, host = split(jid);
19 return node.."@"..host;