コード例 #1
0
ファイル: imapmanager.php プロジェクト: Br3nda/StatusNet
 /**
  * Initialize connection to server.
  * @return boolean true on success
  */
 public function start($master)
 {
     if (parent::start($master)) {
         $this->conn = $this->connect();
         return true;
     } else {
         return false;
     }
 }
コード例 #2
0
ファイル: xmppmanager.php プロジェクト: himmelex/NTW
 /**
  * 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);
 }