Comparison

util/jid.lua @ 6340:7e820979fd9b

util.jid: Optimize bare
author Kim Alvefur <zash@zash.se>
date Thu, 07 Aug 2014 17:43:28 +0200
parent 6339:1c19464cde77
child 6777:5de6b93d0190
comparison
equal deleted inserted replaced
6339:1c19464cde77 6340:7e820979fd9b
35 return node, host, resource; 35 return node, host, resource;
36 end 36 end
37 split = _split; 37 split = _split;
38 38
39 function bare(jid) 39 function bare(jid)
40 local node, host = _split(jid); 40 return jid and match(jid, "^[^/]+");
41 if node and host then
42 return node.."@"..host;
43 end
44 return host;
45 end 41 end
46 42
47 local function _prepped_split(jid) 43 local function _prepped_split(jid)
48 local node, host, resource = _split(jid); 44 local node, host, resource = _split(jid);
49 if host then 45 if host then