File

util/jid.lua @ 27:859b316e2fb0

Fixing jid.split() for all JIDs
author Matthew Wild <mwild1@gmail.com>
date Sat, 27 Sep 2008 19:17:40 +0100
parent 0:3e3171b59028
child 29:b847875801e5
line wrap: on
line source


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