File

util/jid.lua @ 99:ba08b8a4eeef

Abstract connections with "connection listeners" - Added connlistener for xmppclient - SASL/TLS now use a new session:reset_stream() method - main.lua on its way to being a bit neater
author Matthew Wild <mwild1@gmail.com>
date Wed, 22 Oct 2008 17:36:21 +0100
parent 29:b847875801e5
child 104:cfbd3b849f9e
line wrap: on
line source


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