slightly more robust connection code

darcs-hash:20080902030331-84dde-bb2db886d90623785f930bb7c5c3c406d407f808.gz
This commit is contained in:
Evan Prodromou 2008-09-01 23:03:31 -04:00
parent c6c3cd40f6
commit ab92ba78ba

View File

@ -57,16 +57,21 @@ function jabber_connect($resource=NULL) {
common_config('xmpp', 'debug') ? common_config('xmpp', 'debug') ?
XMPPHP_Log::LEVEL_VERBOSE : NULL XMPPHP_Log::LEVEL_VERBOSE : NULL
); );
$conn->autoSubscribe();
$conn->useEncryption(common_config('xmpp', 'encryption'));
if (!$conn) { if (!$conn) {
return false; return false;
} }
$conn->autoSubscribe();
$conn->useEncryption(common_config('xmpp', 'encryption'));
try {
$conn->connect(true); # true = persistent connection $conn->connect(true); # true = persistent connection
if ($conn->isDisconnected()) { } catch (XMPPHP_Exception $e) {
common_log(LOG_ERROR, $e->getMessage());
return false; return false;
} }
$conn->processUntil('session_start'); $conn->processUntil('session_start');
} }
return $conn; return $conn;