diff options
author | Matthew Wild <mwild1@gmail.com> | 2008-09-27 19:17:40 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2008-09-27 19:17:40 +0100 |
commit | 58d1a65408ee32d590071c2ced7260b5592b5d3c (patch) | |
tree | 9df957448af5e12da37af49e82c297e6a059a75c | |
parent | f81b3a5d1fb29f636cb17e6520fea752c12767df (diff) | |
download | prosody-58d1a65408ee32d590071c2ced7260b5592b5d3c.tar.gz prosody-58d1a65408ee32d590071c2ced7260b5592b5d3c.zip |
Fixing jid.split() for all JIDs
-rw-r--r-- | util/jid.lua | 5 |
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 |