diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-05-16 03:56:51 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-05-16 03:56:51 +0500 |
commit | b199ffcb606dda6da46a749c4fc853a56b04cd1b (patch) | |
tree | ba1966af1592ae651f05ecafcdfdf8b400eae2f5 | |
parent | 58fd907dac5e304095e1419e16724be6eb5d9a42 (diff) | |
download | prosody-b199ffcb606dda6da46a749c4fc853a56b04cd1b.tar.gz prosody-b199ffcb606dda6da46a749c4fc853a56b04cd1b.zip |
util.jid: Eliminate global method use
-rw-r--r-- | util/jid.lua | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/util/jid.lua b/util/jid.lua index b6baf9dd..4f8b6d41 100644 --- a/util/jid.lua +++ b/util/jid.lua @@ -15,7 +15,7 @@ local resourceprep = require "util.encodings".stringprep.resourceprep; module "jid" -function split(jid) +local function _split(jid) if not jid then return; end local node, nodepos = match(jid, "^([^@]+)@()"); local host, hostpos = match(jid, "^([^@/]+)()", nodepos) @@ -24,17 +24,18 @@ function split(jid) if (not host) or ((not resource) and #jid >= hostpos) then return nil, nil, nil; end return node, host, resource; end +split = _split; function bare(jid) - local node, host = split(jid); + local node, host = _split(jid); if node and host then return node.."@"..host; end return host; end -function prepped_split(jid) - local node, host, resource = split(jid); +local function _prepped_split(jid) + local node, host, resource = _split(jid); if host then host = nameprep(host); if not host then return; end @@ -49,9 +50,10 @@ function prepped_split(jid) return node, host, resource; end end +prepped_split = _prepped_split; function prep(jid) - local node, host, resource = prepped_split(jid); + local node, host, resource = _prepped_split(jid); if host then if node then host = node .. "@" .. host; |