aboutsummaryrefslogtreecommitdiffstats
path: root/util/jid.lua
blob: b7116fdfad5ce7983ffa78890cada05d5dcc0e4f (plain)
1
2
3
4
5
6
7
8
9
10
11

local match = string.match;

module "jid"

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