Changeset

10358:a77d9b3885bb

util.jid: Add a 'strict' flag for jidprep calls
author Kim Alvefur <zash@zash.se>
date Mon, 09 Sep 2019 22:15:04 +0200
parents 10357:72e6d0d7ff9b
children 10359:4ef785f45aa2
files util/jid.lua
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/util/jid.lua	Wed Apr 24 15:01:00 2019 +0200
+++ b/util/jid.lua	Mon Sep 09 22:15:04 2019 +0200
@@ -45,20 +45,20 @@
 	return host;
 end
 
-local function prepped_split(jid)
+local function prepped_split(jid, strict)
 	local node, host, resource = split(jid);
 	if host and host ~= "." then
 		if sub(host, -1, -1) == "." then -- Strip empty root label
 			host = sub(host, 1, -2);
 		end
-		host = nameprep(host);
+		host = nameprep(host, strict);
 		if not host then return; end
 		if node then
-			node = nodeprep(node);
+			node = nodeprep(node, strict);
 			if not node then return; end
 		end
 		if resource then
-			resource = resourceprep(resource);
+			resource = resourceprep(resource, strict);
 			if not resource then return; end
 		end
 		return node, host, resource;
@@ -77,8 +77,8 @@
 	return host;
 end
 
-local function prep(jid)
-	local node, host, resource = prepped_split(jid);
+local function prep(jid, strict)
+	local node, host, resource = prepped_split(jid, strict);
 	return join(node, host, resource);
 end