Diff

util/jid.lua @ 6339:1c19464cde77

util.jid: Use existing join function in jid.prep
author Kim Alvefur <zash@zash.se>
date Thu, 07 Aug 2014 17:35:11 +0200
parent 6338:736c388748fd
child 6340:7e820979fd9b
line wrap: on
line diff
--- a/util/jid.lua	Thu Aug 07 17:20:51 2014 +0200
+++ b/util/jid.lua	Thu Aug 07 17:35:11 2014 +0200
@@ -65,21 +65,8 @@
 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 @@
 	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