aboutsummaryrefslogtreecommitdiffstats
path: root/util/jid.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2009-11-27 17:33:55 +0000
committerMatthew Wild <mwild1@gmail.com>2009-11-27 17:33:55 +0000
commitd6a193d93e2670cb2ed48db22051b6fc9922c787 (patch)
tree34e25ca6a7bfaec3b2529db943ba957e3fde9449 /util/jid.lua
parent70ab443a15224fb4ca15a9dde4adb5227bcbda1f (diff)
downloadprosody-d6a193d93e2670cb2ed48db22051b6fc9922c787.tar.gz
prosody-d6a193d93e2670cb2ed48db22051b6fc9922c787.zip
util.jid: Add join(node, host, resource) function to join the components and return nil if invalid
Diffstat (limited to 'util/jid.lua')
-rw-r--r--util/jid.lua13
1 files changed, 13 insertions, 0 deletions
diff --git a/util/jid.lua b/util/jid.lua
index ccc8309c..b43247cc 100644
--- a/util/jid.lua
+++ b/util/jid.lua
@@ -65,4 +65,17 @@ function prep(jid)
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;