diff options
Diffstat (limited to 'util')
-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 |