Software /
code /
prosody
Comparison
util/jid.lua @ 5945:51ead0aa3a02
Merge 0.9->0.10
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 16 Dec 2013 02:04:16 +0000 |
parent | 5776:bd0ff8ae98a8 |
parent | 5944:f3817912e8b2 |
child | 6338:736c388748fd |
comparison
equal
deleted
inserted
replaced
5941:31f14991070b | 5945:51ead0aa3a02 |
---|---|
6 -- COPYING file in the source package for more information. | 6 -- COPYING file in the source package for more information. |
7 -- | 7 -- |
8 | 8 |
9 | 9 |
10 | 10 |
11 local match = string.match; | 11 local match, sub = string.match, string.sub; |
12 local nodeprep = require "util.encodings".stringprep.nodeprep; | 12 local nodeprep = require "util.encodings".stringprep.nodeprep; |
13 local nameprep = require "util.encodings".stringprep.nameprep; | 13 local nameprep = require "util.encodings".stringprep.nameprep; |
14 local resourceprep = require "util.encodings".stringprep.resourceprep; | 14 local resourceprep = require "util.encodings".stringprep.resourceprep; |
15 | 15 |
16 local escapes = { | 16 local escapes = { |
45 end | 45 end |
46 | 46 |
47 local function _prepped_split(jid) | 47 local function _prepped_split(jid) |
48 local node, host, resource = _split(jid); | 48 local node, host, resource = _split(jid); |
49 if host then | 49 if host then |
50 if sub(host, -1, -1) == "." then -- Strip empty root label | |
51 host = sub(host, 1, -2); | |
52 end | |
50 host = nameprep(host); | 53 host = nameprep(host); |
51 if not host then return; end | 54 if not host then return; end |
52 if node then | 55 if node then |
53 node = nodeprep(node); | 56 node = nodeprep(node); |
54 if not node then return; end | 57 if not node then return; end |