From b199ffcb606dda6da46a749c4fc853a56b04cd1b Mon Sep 17 00:00:00 2001 From: Waqas Hussain Date: Sat, 16 May 2009 03:56:51 +0500 Subject: util.jid: Eliminate global method use --- util/jid.lua | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'util/jid.lua') 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; -- cgit v1.2.3