public function handleDaddyMessage(Event $event, EventQueue $queue)
 {
     if ($event instanceof UserEvent) {
         $nick = $event->getNick();
         $channel = $event->getSource();
         $params = $event->getParams();
         $text = $params['text'];
         $matched = preg_match("/\\s*who'?s (?:your|ya) ([^?]+)[?]?/i", $text, $matches);
         if ($matched) {
             $msg = "You're my " . $matches[1] . ', ' . $nick . '!';
             $queue->ircPrivmsg($channel, $msg);
         }
     }
 }
Exemplo n.º 2
0
 /**
  * Tests setCommand().
  */
 public function testSetCommand()
 {
     $command = 'COMMAND';
     $this->event->setCommand($command);
     $this->assertSame($command, $this->event->getCommand());
 }
 /**
  * Primes an Event object with data.
  *
  * @param \Phergie\Irc\Event\Event $event
  */
 protected function initializeEvent(Event $event)
 {
     $connection = Phake::mock('\\Phergie\\Irc\\ConnectionInterface');
     Phake::when($connection)->getServerHostname()->thenReturn($this->connection['serverHostname']);
     Phake::when($connection)->getServerPort()->thenReturn($this->connection['serverPort']);
     Phake::when($connection)->getNickname()->thenReturn($this->connection['nickname']);
     Phake::when($connection)->getUsername()->thenReturn($this->connection['username']);
     Phake::when($connection)->getHostname()->thenReturn($this->connection['hostname']);
     Phake::when($connection)->getServername()->thenReturn($this->connection['servername']);
     Phake::when($connection)->getRealname()->thenReturn($this->connection['realname']);
     $event->setConnection($connection);
     $event->setCommand($this->event['command']);
     $event->setParams($this->event['params']);
     $event->setMessage($this->event['message']);
 }