Esempio n. 1
0
 /**
  * @param MessageInterface $message
  * @param string           $type
  * @param string           $nick
  */
 protected function handleCTCP($message, $type, $nick)
 {
     $params = array($nick);
     switch ($type) {
         case 'VERSION':
             $params[] = "VERSION {$this->version}";
             break;
         case 'PING':
             $params[] = $message->getMessage();
             break;
         case 'TIME':
             $time = date(DATE_RFC1123);
             $params[] = "TIME {$time}";
             break;
     }
     if (count($params) > 1) {
         $response = new GenericMessage('notice', '', $params);
         $message->getConnection()->sendMessage($response);
     }
 }
Esempio n. 2
0
 public function handleMessage(MessageInterface $message)
 {
     if ($message instanceof PingMessage) {
         $message->getConnection()->sendMessage(new PongMessage($message));
     }
 }
Esempio n. 3
0
 /**
  * We need to disconnect, we encountered an error
  *
  * @param MessageInterface $message
  */
 public function handleMessage(MessageInterface $message)
 {
     $message->getConnection()->log(sprintf('Error: %s', implode(' ', $message->getParams())), array(), LogLevel::DEBUG);
     $message->getConnection()->disconnect();
 }
Esempio n. 4
0
 /**
  * @param MessageInterface $message
  * @return boolean|null
  */
 public function sendMessage(MessageInterface $message)
 {
     $this->sendRaw($message->getRaw());
 }