]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
better connection handling in scripts
authorEvan Prodromou <evan@prodromou.name>
Tue, 2 Sep 2008 16:57:35 +0000 (12:57 -0400)
committerEvan Prodromou <evan@prodromou.name>
Tue, 2 Sep 2008 16:57:35 +0000 (12:57 -0400)
darcs-hash:20080902165735-84dde-e522711214832e6f992b9897aaf8904b1d5c6a2e.gz

scripts/publicqueuehandler.php
scripts/xmppconfirmhandler.php
scripts/xmppqueuehandler.php

index b482d029a78b5d3097b516cd2dce2c328cdf08d2..49e5f5b8f50a705cd20b6986ac429c4973f66106 100755 (executable)
@@ -42,8 +42,13 @@ class PublicQueueHandler extends QueueHandler {
        function start() {
                $this->log(LOG_INFO, "INITIALIZE");
                # Low priority; we don't want to receive messages
-               $this->conn = jabber_connect($this->_id, NULL, -1);
-               $this->conn->addEventHandler('message', 'forward_message', $this);
+
+               $this->conn = jabber_connect($this->_id);
+               if ($this->conn) {
+                       $this->conn->addEventHandler('message', 'forward_message', $this);
+                       $this->conn->addEventHandler('reconnect', 'handle_reconnect', $this);
+                       jabber_send_presence("Send me a message to post an notice", 'available', NULL, 'available', -1);
+               }
                return !is_null($this->conn);
        }
 
index c63498f5519a468f52c7ecae5d22ad6c23eeab26..6cb44ce09711d647d1e23ebcda2388aa1d8dbb94 100755 (executable)
@@ -48,8 +48,12 @@ class XmppConfirmHandler {
        function start() {
                # Low priority; we don't want to receive messages
                $this->log(LOG_INFO, "INITIALIZE");
-               $this->conn = jabber_connect($this->_id, NULL, -1);
-               $this->conn->addEventHandler('message', 'forward_message', $this);
+               $this->conn = jabber_connect($this->_id);
+               if ($this->conn) {
+                       $this->conn->addEventHandler('message', 'forward_message', $this);
+                       $this->conn->addEventHandler('reconnect', 'handle_reconnect', $this);
+                       jabber_send_presence("Send me a message to post an notice", 'available', NULL, 'available', -1);
+               }
                return !is_null($this->conn);
        }
        
index 49d3df0f50924a669154691169bf4ee32dacd8fc..c2c7a65023cd5ca7a0c13acc31796e1f0e230751 100755 (executable)
@@ -44,8 +44,12 @@ class XmppQueueHandler extends QueueHandler {
        function start() {
                $this->log(LOG_INFO, "INITIALIZE");
                # Low priority; we don't want to receive messages
-               $this->conn = jabber_connect($this->_id, NULL, -1);
-               $this->conn->addEventHandler('message', 'forward_message', $this);
+               $this->conn = jabber_connect($this->_id);
+               if ($this->conn) {
+                       $this->conn->addEventHandler('message', 'forward_message', $this);
+                       $this->conn->addEventHandler('reconnect', 'handle_reconnect', $this);
+                       jabber_send_presence("Send me a message to post an notice", 'available', NULL, 'available', -1);
+               }
                return !is_null($this->conn);
        }