From d68e3b56200c4c208e38d75b3396ae8c9de27423 Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Thu, 7 Aug 2014 17:35:11 +0200 Subject: util.jid: Use existing join function in jid.prep --- util/jid.lua | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/util/jid.lua b/util/jid.lua index 5db3d1f0..14d8f2b4 100644 --- a/util/jid.lua +++ b/util/jid.lua @@ -65,21 +65,8 @@ local function _prepped_split(jid) end prepped_split = _prepped_split; -function prep(jid) - local node, host, resource = _prepped_split(jid); - if host then - if node then - host = node .. "@" .. host; - end - if resource then - host = host .. "/" .. resource; - end - end - return host; -end - -function join(node, host, resource) - if not host then return end -- Invalid JID +local function _join(node, host, resource) + if not host then return end if node and resource then return node.."@"..host.."/"..resource; elseif node then @@ -89,6 +76,12 @@ function join(node, host, resource) end return host; end +join = _join; + +function prep(jid) + local node, host, resource = _prepped_split(jid); + return _join(node, host, resource); +end function compare(jid, acl) -- compare jid to single acl rule -- cgit v1.2.3