blob: b1e4131d067c7d6ee353d76179e4527a095e4e80 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
local match = string.match;
module "jid"
function split(jid)
if not jid then return; end
-- TODO verify JID, and return; if invalid
local node = match(jid, "^([^@]+)@");
local server = (node and match(jid, ".-@([^@/]+)")) or match(jid, "^([^@/]+)");
local resource = match(jid, "/(.+)$");
return node, server, resource;
end
return _M;
|