util/jid.lua
author Matthew Wild <mwild1@gmail.com>
Wed, 01 May 2013 13:54:44 +0100
branchtls
changeset 5556 7407b1160b46
parent 29 b847875801e5
child 104 cfbd3b849f9e
permissions -rw-r--r--
Close 'tls' branch


local match = string.match;

module "jid"

function split(jid)
	if not jid then return nil; end
	local node = match(jid, "^([^@]+)@");
	local server = (node and match(jid, ".-@([^@/]+)")) or match(jid, "^([^@/]+)");
	local resource = match(jid, "/(.+)$");
	return node, server, resource;
end