Software /
code /
prosody
Comparison
util/jid.lua @ 27:859b316e2fb0
Fixing jid.split() for all JIDs
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 27 Sep 2008 19:17:40 +0100 |
parent | 0:3e3171b59028 |
child | 29:b847875801e5 |
comparison
equal
deleted
inserted
replaced
26:23cab333d014 | 27:859b316e2fb0 |
---|---|
2 local match = string.match; | 2 local match = string.match; |
3 | 3 |
4 module "jid" | 4 module "jid" |
5 | 5 |
6 function split(jid) | 6 function split(jid) |
7 return match(jid, "^([^@]+)@([^/]+)/?(.*)$"); | 7 local node = match(jid, "^([^@]+)@"); |
8 local server = (node and match(jid, ".-@([^@/]+)")) or match(jid, "^([^@/]+)"); | |
9 local resource = match(jid, "/(.+)$"); | |
10 return node, server, resource; | |
8 end | 11 end |