summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-09-01 23:03:31 -0400
committerEvan Prodromou <evan@prodromou.name>2008-09-01 23:03:31 -0400
commitab92ba78ba42397054254d785556df493067d962 (patch)
tree8ad61a74abe10f7927f69e73a4281ca73b392470
parentc6c3cd40f6304b49f5d4841e9999641a183e987b (diff)
slightly more robust connection code
darcs-hash:20080902030331-84dde-bb2db886d90623785f930bb7c5c3c406d407f808.gz
-rw-r--r--lib/jabber.php13
1 files changed, 9 insertions, 4 deletions
diff --git a/lib/jabber.php b/lib/jabber.php
index 3e74cbbb8..68bd0d8d3 100644
--- a/lib/jabber.php
+++ b/lib/jabber.php
@@ -57,16 +57,21 @@ function jabber_connect($resource=NULL) {
common_config('xmpp', 'debug') ?
XMPPHP_Log::LEVEL_VERBOSE : NULL
);
- $conn->autoSubscribe();
- $conn->useEncryption(common_config('xmpp', 'encryption'));
if (!$conn) {
return false;
}
- $conn->connect(true); # true = persistent connection
- if ($conn->isDisconnected()) {
+
+ $conn->autoSubscribe();
+ $conn->useEncryption(common_config('xmpp', 'encryption'));
+
+ try {
+ $conn->connect(true); # true = persistent connection
+ } catch (XMPPHP_Exception $e) {
+ common_log(LOG_ERROR, $e->getMessage());
return false;
}
+
$conn->processUntil('session_start');
}
return $conn;