aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2008-09-27 19:17:40 +0100
committerMatthew Wild <mwild1@gmail.com>2008-09-27 19:17:40 +0100
commit58d1a65408ee32d590071c2ced7260b5592b5d3c (patch)
tree9df957448af5e12da37af49e82c297e6a059a75c
parentf81b3a5d1fb29f636cb17e6520fea752c12767df (diff)
downloadprosody-58d1a65408ee32d590071c2ced7260b5592b5d3c.tar.gz
prosody-58d1a65408ee32d590071c2ced7260b5592b5d3c.zip
Fixing jid.split() for all JIDs
-rw-r--r--util/jid.lua5
1 files changed, 4 insertions, 1 deletions
diff --git a/util/jid.lua b/util/jid.lua
index 9d01e2af..b7116fdf 100644
--- a/util/jid.lua
+++ b/util/jid.lua
@@ -4,5 +4,8 @@ local match = string.match;
module "jid"
function split(jid)
- return match(jid, "^([^@]+)@([^/]+)/?(.*)$");
+ local node = match(jid, "^([^@]+)@");
+ local server = (node and match(jid, ".-@([^@/]+)")) or match(jid, "^([^@/]+)");
+ local resource = match(jid, "/(.+)$");
+ return node, server, resource;
end