Beispiel #1
0
 function __construct($server, $pgPort = 6667, $user, $pass, $nick, $channel, $callback = null)
 {
     global $pgIRCTrigger, $pgHooks;
     if (func_num_args() > 6) {
         $this->server = $server;
         $this->port = $pgPort;
         $this->user = $user;
         $this->pass = $pass;
         $this->nick = $nick;
         $this->channel = $channel;
         $this->callback = $callback;
     } else {
         $this->server = $server;
         $this->port = 6667;
         $this->user = $pgPort;
         $this->pass = $user;
         $this->nick = $pass;
         $this->channel = $nick;
         $this->callback = $channel;
     }
     $pgHooks['SimpleIRCPrivMSG'][] = $callback;
     $irc = new IRC($this->user, $this->nick, $this->pass, $this->server, $this->port, "Peachy IRC Bot Version " . PEACHYVERSION, $this->channel);
     while (!feof($irc->f)) {
         $parsed = IRC::parseLine(fgets($irc->f, 1024), $pgIRCTrigger, true);
         if (@$parsed['n!u@h'] == 'PING') {
             $irc->sendPong($parsed['payload']);
         }
         if (@$parsed['type'] == '376' || @$parser['type'] == '422') {
             $feed->joinChan();
             sleep(5);
         }
         if (@$parsed['type'] == 'PRIVMSG') {
             Hooks::runHook('SimpleIRCPrivMSG', array(&$parsed, &$irc, &$this));
         }
     }
 }