diff --git a/util/jid.lua b/util/jid.lua index 9d01e2afa..b7116fdfa 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