Software /
code /
prosody
Comparison
util/jid.lua @ 109:7efedc96352a
Minor edit, and added a TODO
author | Waqas Hussain <waqas20@gmail.com> |
---|---|
date | Wed, 22 Oct 2008 21:18:50 +0500 |
parent | 104:cfbd3b849f9e |
child | 365:a59300fc22ec |
comparison
equal
deleted
inserted
replaced
108:1d79da482c5d | 109:7efedc96352a |
---|---|
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 if not jid then return nil; end | 7 if not jid then return; end |
8 -- TODO verify JID, and return; if invalid | |
8 local node = match(jid, "^([^@]+)@"); | 9 local node = match(jid, "^([^@]+)@"); |
9 local server = (node and match(jid, ".-@([^@/]+)")) or match(jid, "^([^@/]+)"); | 10 local server = (node and match(jid, ".-@([^@/]+)")) or match(jid, "^([^@/]+)"); |
10 local resource = match(jid, "/(.+)$"); | 11 local resource = match(jid, "/(.+)$"); |
11 return node, server, resource; | 12 return node, server, resource; |
12 end | 13 end |