Merge roster & presence from waqas
[prosody.git] / util / jid.lua
1
2 local match = string.match;
3
4 module "jid"
5
6 function split(jid)
7         if not jid then return; end
8         -- TODO verify JID, and return; if invalid
9         local node = match(jid, "^([^@]+)@");
10         local server = (node and match(jid, ".-@([^@/]+)")) or match(jid, "^([^@/]+)");
11         local resource = match(jid, "/(.+)$");
12         return node, server, resource;
13 end
14
15 return _M;