util/jid.lua

Tue, 30 Sep 2008 19:49:36 +0100

author
Matthew Wild <mwild1@gmail.com>
date
Tue, 30 Sep 2008 19:49:36 +0100
changeset 29
b847875801e5
parent 27
859b316e2fb0
child 104
cfbd3b849f9e
permissions
-rw-r--r--

jid.split(): Return nil when passed nil


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

mercurial