# HG changeset patch # User Matthew Wild # Date 1259343235 0 # Node ID df9e18f5c808085331cd97730436a33a1382c86e # Parent 730038d3e9e31fd9f1deeb31b6733b6a0c4ec42e util.jid: Add join(node, host, resource) function to join the components and return nil if invalid diff -r 730038d3e9e3 -r df9e18f5c808 util/jid.lua --- a/util/jid.lua Fri Nov 27 16:51:05 2009 +0000 +++ 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;