Fixed: util/jid.lua now returns module object
[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 nil; end
8         local node = match(jid, "^([^@]+)@");
9         local server = (node and match(jid, ".-@([^@/]+)")) or match(jid, "^([^@/]+)");
10         local resource = match(jid, "/(.+)$");
11         return node, server, resource;
12 end
13
14 return _M;