示例#1
0
文件: Room.php 项目: oqq/minc-hipchat
 /**
  * @param string $message
  * @param string $from
  * @param string $color
  *
  * @throws \RuntimeException
  */
 public function send($message, $from, $color = null)
 {
     $data = ['room_id' => $this->name, 'message' => $message, 'from' => $from];
     if ($color) {
         $data['color'] = $color;
     }
     $this->connection->write('/v1/rooms/message', $data);
 }
示例#2
0
 public function quitCommand($command, $params, IrcDataObject $data)
 {
     $auth = $this->parent->getModule('Auth');
     if (!$auth->nicknameIsTrusted($data->getMessage()['nick'])) {
         return;
     }
     $message = empty($params) ? 'WildPHP shutting down...' : $params;
     $this->parent->write($this->parent->getGenerator()->ircQuit($message));
 }
 /**
  * @param IrcDataObject $data
  */
 public function pingPong(IrcDataObject $data)
 {
     $this->parent->write($this->parent->getGenerator()->ircPong($data->getParams()['server1']));
 }
示例#4
0
 public function send()
 {
     if ($this->conn->write() === false) {
         $this->finish('BROKEN');
     }
 }
 function write()
 {
     if ($this->current_client == null) {
         if (empty($this->client_queue)) {
             return;
         }
         $this->current_client = $this->client_queue[0];
     }
     while ($packet = array_shift($this->current_client->packets_read)) {
         $this->write_buffer->append($packet->binary);
     }
     parent::write();
 }
 function write()
 {
     //    $this->log("Writing to client.\n");
     while ($packet = array_shift($this->write_packets)) {
         $this->write_buffer->append($packet->binary);
     }
     parent::write();
 }