summaryrefslogtreecommitdiff
path: root/lib/jabber.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlezvous.ca>2008-06-23 21:56:16 -0400
committerEvan Prodromou <evan@controlezvous.ca>2008-06-23 21:56:16 -0400
commite330eb50d2c36505270375360303083decedee98 (patch)
tree6161803dd219ade3d3150f1b2c9d988cae91be44 /lib/jabber.php
parent939a3e48d896f318a40c8ef2e1b13e79d6e7eb94 (diff)
more robust handling of new JIDs
darcs-hash:20080624015616-34904-c1ff985257c8c57aacf68439488d628a8b4d2e38.gz
Diffstat (limited to 'lib/jabber.php')
-rw-r--r--lib/jabber.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/jabber.php b/lib/jabber.php
index e6529446b..97d02544d 100644
--- a/lib/jabber.php
+++ b/lib/jabber.php
@@ -27,11 +27,14 @@ function jabber_valid_base_jid($jid) {
}
function jabber_normalize_jid($jid) {
- preg_match("/(?:([^\@]+)\@)?([^\/]+)(?:\/(.*))?$/", $jid, $matches);
- $node = $matches[1];
- $server = $matches[2];
- $resource = $matches[3];
- return strtolower($node.'@'.$server);
+ if (preg_match("/(?:([^\@]+)\@)?([^\/]+)(?:\/(.*))?$/", $jid, $matches)) {
+ $node = $matches[1];
+ $server = $matches[2];
+ $resource = $matches[3];
+ return strtolower($node.'@'.$server);
+ } else {
+ return NULL;
+ }
}
function jabber_connect($resource=NULL) {