# HG changeset patch # User Matthew Wild # Date 1259343235 0 # Node ID 0ad29a5485d6d3cca93d759a7dafc18d27f4d152 # Parent 49e9a8d57981abc6cd39fed2d335959770d25765 util.jid: Add join(node, host, resource) function to join the components and return nil if invalid diff -r 49e9a8d57981 -r 0ad29a5485d6 util/jid.lua --- a/util/jid.lua Wed Nov 25 22:00:33 2009 +0500 +++ b/util/jid.lua Fri Nov 27 17:33:55 2009 +0000 @@ -65,4 +65,17 @@ return host; end +function join(node, host, resource) + if node and host and resource then + return node.."@"..host.."/"..resource; + elseif node and host then + return node.."@"..host; + elseif host and resource then + return host.."/"..resource; + elseif host then + return host; + end + return nil; -- Invalid JID +end + return _M;