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
commit243dc405ce0cb16de1d1bed31197492dcc0d1f63 (patch)
tree70eb91cfca1f77a5c477e7ec0cbe04569a44ce47 /util/jid.lua
parent3a73d58d69b57a0cd40280d35019d5d6410d72b1 (diff)
downloadprosody-243dc405ce0cb16de1d1bed31197492dcc0d1f63.tar.gz
prosody-243dc405ce0cb16de1d1bed31197492dcc0d1f63.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;