]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
slightly more robust connection code
authorEvan Prodromou <evan@prodromou.name>
Tue, 2 Sep 2008 03:03:31 +0000 (23:03 -0400)
committerEvan Prodromou <evan@prodromou.name>
Tue, 2 Sep 2008 03:03:31 +0000 (23:03 -0400)
darcs-hash:20080902030331-84dde-bb2db886d90623785f930bb7c5c3c406d407f808.gz

lib/jabber.php

index 3e74cbbb82d8601541a9ef35d5f8712ea1cfb266..68bd0d8d35a652fc08339838859b10aada55bae9 100644 (file)
@@ -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;