Software /
code /
prosody
Comparison
util/jid.lua @ 369:42de92add67b
Better names for variables
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 21 Nov 2008 05:07:41 +0000 |
parent | 368:34e88709b1b5 |
child | 384:4542bcdb7f55 |
comparison
equal
deleted
inserted
replaced
368:34e88709b1b5 | 369:42de92add67b |
---|---|
3 | 3 |
4 module "jid" | 4 module "jid" |
5 | 5 |
6 function split(jid) | 6 function split(jid) |
7 if not jid then return; end | 7 if not jid then return; end |
8 local node, nodelen = match(jid, "^([^@]+)@()"); | 8 local node, nodepos = match(jid, "^([^@]+)@()"); |
9 local host, hostlen = match(jid, "^([^@/]+)()", nodelen) | 9 local host, hostpos = match(jid, "^([^@/]+)()", nodepos) |
10 if node and not host then return nil, nil, nil; end | 10 if node and not host then return nil, nil, nil; end |
11 local resource = match(jid, "^/(.+)$", hostlen); | 11 local resource = match(jid, "^/(.+)$", hostpos); |
12 if (not host) or ((not resource) and #jid >= hostlen) then return nil, nil, nil; end | 12 if (not host) or ((not resource) and #jid >= hostpos) then return nil, nil, nil; end |
13 return node, host, resource; | 13 return node, host, resource; |
14 end | 14 end |
15 | 15 |
16 function bare(jid) | 16 function bare(jid) |
17 local node, host = split(jid); | 17 local node, host = split(jid); |