示例#1
0
 /**
  * Gets triggered on irc.connect event
  *
  * @param sfEvent $event 
  */
 public function connect(sfEvent $event)
 {
     $p = $this->getContainer()->getParameters();
     phillip::getInstance()->log('Connected');
     phillip::getInstance()->sendCommand(sprintf('USER %s %s %s :%s', $p['irc.username'], $p['irc.hostname'], $p['irc.hostname'], $p['irc.realname']));
     phillip::getInstance()->sendCommand(sprintf('NICK %s', $p['irc.username']));
 }
示例#2
0
 /**
  * Executed when a privmsg command comes in
  *
  * @param Event $event
  */
 public function privmsg(sfEvent $event)
 {
     /* @var $s pResponse */
     $s = $event->getSubject();
     $p = $this->getContainer()->getParameters();
     if (preg_match('/^!quit\\s/i', $s->getTrailing()) && in_array($s->getUsername(), $p['users.trusted'])) {
         $c = preg_replace('/^(!quit\\s)/i', '', $s->getTrailing());
         $this->sendCommand(sprintf('QUIT :%s', $c));
         phillip::getInstance()->closeConnection();
     }
 }
 /**
  *
  * @param sfEvent $event 
  */
 public function autojoin(sfEvent $event)
 {
     $p = $this->getContainer()->getParameters();
     $channels = $p['autojoin'];
     if (!is_array($channels)) {
         $channels = array($channels);
     }
     foreach ($channels as $i => $chan) {
         if (preg_match('/^#{1}/', $chan)) {
             continue;
         }
         $channels[$i] = '#' . $chan;
     }
     $c = implode(',', $channels);
     phillip::getInstance()->sendCommand(sprintf('JOIN %s', $c));
 }
 /**
  * @param string $message
  */
 protected function log($message)
 {
     phillip::getInstance()->log($message);
 }