Comparison

util/jid.lua @ 2820:0ad29a5485d6

util.jid: Add join(node, host, resource) function to join the components and return nil if invalid
author Matthew Wild <mwild1@gmail.com>
date Fri, 27 Nov 2009 17:33:55 +0000
parent 1523:841d61be198f
child 2923:b7049746bd29
comparison
equal deleted inserted replaced
2819:49e9a8d57981 2820:0ad29a5485d6
63 end 63 end
64 end 64 end
65 return host; 65 return host;
66 end 66 end
67 67
68 function join(node, host, resource)
69 if node and host and resource then
70 return node.."@"..host.."/"..resource;
71 elseif node and host then
72 return node.."@"..host;
73 elseif host and resource then
74 return host.."/"..resource;
75 elseif host then
76 return host;
77 end
78 return nil; -- Invalid JID
79 end
80
68 return _M; 81 return _M;