projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
037b327
)
Fixing jid.split() for all JIDs
author
Matthew Wild
<mwild1@gmail.com>
Sat, 27 Sep 2008 18:17:40 +0000
(19:17 +0100)
committer
Matthew Wild
<mwild1@gmail.com>
Sat, 27 Sep 2008 18:17:40 +0000
(19:17 +0100)
util/jid.lua
patch
|
blob
|
history
diff --git
a/util/jid.lua
b/util/jid.lua
index 9d01e2afa4966f2b2676fda15415f06b678b268d..b7116fdfad5ce7983ffa78890cada05d5dcc0e4f 100644
(file)
--- 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