diff options
author | Matthew Wild <mwild1@gmail.com> | 2009-11-27 17:33:55 +0000 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2009-11-27 17:33:55 +0000 |
commit | 243dc405ce0cb16de1d1bed31197492dcc0d1f63 (patch) | |
tree | 70eb91cfca1f77a5c477e7ec0cbe04569a44ce47 | |
parent | 3a73d58d69b57a0cd40280d35019d5d6410d72b1 (diff) | |
download | prosody-243dc405ce0cb16de1d1bed31197492dcc0d1f63.tar.gz prosody-243dc405ce0cb16de1d1bed31197492dcc0d1f63.zip |
util.jid: Add join(node, host, resource) function to join the components and return nil if invalid
-rw-r--r-- | util/jid.lua | 13 |
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; |