Software /
code /
prosody
Changeset
27:859b316e2fb0
Fixing jid.split() for all JIDs
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 27 Sep 2008 19:17:40 +0100 |
parents | 26:23cab333d014 |
children | 28:4a238233f278 |
files | util/jid.lua |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/util/jid.lua Wed Sep 17 21:33:05 2008 +0100 +++ b/util/jid.lua Sat Sep 27 19:17:40 2008 +0100 @@ -4,5 +4,8 @@ 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