Ejemplo n.º 1
0
 public function __destruct()
 {
     if ($this->irc && !$this->irc->feof()) {
         if ($this->config->getJoin()) {
             $this->irc->part($this->config->getChannel());
         }
         $this->irc->quit('GitLab IRC Bot by Zoddo');
         $start = time();
         while (!$this->irc->feof() && time() - $start < 30) {
             $data = $this->irc->irc_read(3);
             if ($data === false) {
                 continue;
             }
             $this->irc->callListeners($data);
         }
     }
 }
Ejemplo n.º 2
0
 /**
  * @param array $data
  * @param IrcConnection $connection
  */
 public function onPing(array $data, IrcConnection $connection)
 {
     $connection->send(sprintf('PONG %s :%s', $data['source'], $data['params'][0]));
 }
Ejemplo n.º 3
0
 /**
  * @param array $data
  * @param IrcConnection $connection
  */
 public function NickAlreadyUse(array $data, IrcConnection $connection)
 {
     $connection->send(sprintf('NICK %s%d', $data['params'][0], mt_rand(100, 999)));
 }