Example #1
0
 function connect()
 {
     $connect_to = $this->host ? $this->host : $this->server;
     $this->log(LOG_INFO, "Connecting to {$connect_to} on port {$this->port}");
     $this->conn = jabber_connect($this->resource);
     if (!$this->conn) {
         return false;
     }
     $this->conn->setReconnectTimeout(600);
     jabber_send_presence("Send me a message to post a notice", 'available', null, 'available', 100);
     return !$this->conn->isDisconnected();
 }
Example #2
0
 function start()
 {
     # Low priority; we don't want to receive messages
     $this->log(LOG_INFO, "INITIALIZE");
     $this->conn = jabber_connect($this->_id);
     if ($this->conn) {
         $this->conn->addEventHandler('message', 'forward_message', $this);
         $this->conn->addEventHandler('reconnect', 'handle_reconnect', $this);
         $this->conn->setReconnectTimeout(600);
         jabber_send_presence("Send me a message to post a notice", 'available', null, 'available', -1);
     }
     return !is_null($this->conn);
 }
Example #3
0
 /**
  * Initialize connection to server.
  * @return boolean true on success
  */
 public function start($master)
 {
     parent::start($master);
     $this->switchSite();
     require_once INSTALLDIR . "/lib/jabber.php";
     # Low priority; we don't want to receive messages
     common_log(LOG_INFO, "INITIALIZE");
     $this->conn = jabber_connect($this->resource);
     if (empty($this->conn)) {
         common_log(LOG_ERR, "Couldn't connect to server.");
         return false;
     }
     $this->log(LOG_DEBUG, "Initializing stanza handlers.");
     $this->conn->addEventHandler('message', 'handle_message', $this);
     $this->conn->addEventHandler('presence', 'handle_presence', $this);
     $this->conn->addEventHandler('reconnect', 'handle_reconnect', $this);
     $this->conn->setReconnectTimeout(600);
     jabber_send_presence("Send me a message to post a notice", 'available', null, 'available', 100);
     return !is_null($this->conn);
 }