From 6619b204e37f7d0b7c18a1194688f3c85e8447fa Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Mon, 8 Aug 2022 20:33:44 +0200 Subject: doap: Update XEP versions for which no code changes appear needed XEP-0004: Partial forms are handled XEP-0045: We're already strict with GC 1.0 XEP-0060: Change in semantics wrt 'pubsub#type', but not in code XEP-0115: No protocol change XEP-0138: Specification moved to Obsolete XEP-0163: Editorial only change XEP-0215: Minor schema change XEP-0280: Editorial change XEP-0297: Had the wrong version number XEP-0106: Note missing piece for version 1.1 XEP-0313: Editorial change XEP-0363: Editorial clarification, no code change required XEP-0380: Registry additions, no code change needed XEP-0384: Not directly supported, only here because people will ask otherwise XEP-0445: Broken out of XEP-0401 --- util/jid.lua | 1 + 1 file changed, 1 insertion(+) (limited to 'util/jid.lua') diff --git a/util/jid.lua b/util/jid.lua index 694a6b1f..759af746 100644 --- a/util/jid.lua +++ b/util/jid.lua @@ -111,6 +111,7 @@ local function resource(jid) return (select(3, split(jid))); end +-- TODO Forbid \20 at start and end of escaped output per XEP-0106 v1.1 local function escape(s) return s and (s:gsub("\\%x%x", backslash_escapes):gsub("[\"&'/:<>@ ]", escapes)); end local function unescape(s) return s and (s:gsub("\\%x%x", unescapes)); end -- cgit v1.2.3 From 6ae850c963db802a606b2fd11d670e599a43626f Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 11 Oct 2022 13:33:19 +0100 Subject: util.jid: Remove redundant check from split() (micro-optimization?) --- util/jid.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'util/jid.lua') diff --git a/util/jid.lua b/util/jid.lua index 759af746..3e1336fc 100644 --- a/util/jid.lua +++ b/util/jid.lua @@ -35,8 +35,7 @@ local function split(jid) if jid == nil then return; end local node, nodepos = match(jid, "^([^@/]+)@()"); local host, hostpos = match(jid, "^([^@/]+)()", nodepos); - if node ~= nil and host == nil then return nil, nil, nil; end - local resource = match(jid, "^/(.+)$", hostpos); + local resource = host and match(jid, "^/(.+)$", hostpos); if (host == nil) or ((resource == nil) and #jid >= hostpos) then return nil, nil, nil; end return node, host, resource; end -- cgit v1.2.3 From 120e01f16248ddc9148b96eef5e061be7ce850be Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Tue, 11 Oct 2022 13:35:09 +0100 Subject: util.jid: Simplify boolean logic in conditionals --- util/jid.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'util/jid.lua') diff --git a/util/jid.lua b/util/jid.lua index 3e1336fc..55567ea2 100644 --- a/util/jid.lua +++ b/util/jid.lua @@ -90,9 +90,9 @@ local function compare(jid, acl) -- TODO compare to table of rules? local jid_node, jid_host, jid_resource = split(jid); local acl_node, acl_host, acl_resource = split(acl); - if ((acl_node ~= nil and acl_node == jid_node) or acl_node == nil) and - ((acl_host ~= nil and acl_host == jid_host) or acl_host == nil) and - ((acl_resource ~= nil and acl_resource == jid_resource) or acl_resource == nil) then + if (acl_node == nil or acl_node == jid_node) and + (acl_host == nil or acl_host == jid_host) and + (acl_resource == nil or acl_resource == jid_resource) then return true end return false -- cgit v1.2.3