src/Plugin.php
public function handleNotice(UserEvent $event, Queue $queue)
    {
        // Ignore notices that aren't from the NickServ agent
        if (strcasecmp($event->getNick(), $this->botNick) !== 0) {
            return;
        }

        $connection = $event->getConnection();
        $params = $event->getParams();
        $message = $params['text'];

        // Authenticate the bot's identity for authentication requests
        if (preg_match($this->identifyPattern, $message)) {
            return $queue->ircPrivmsg($this->botNick, 'IDENTIFY ' . $this->password);
        }

        // Emit an event on successful authentication
        if (preg_match($this->loginPattern, $message)) {
            return $this->getEventEmitter()->emit('nickserv.identified', [$connection, $queue]);
        }

        // Reclaim primary nick on ghost confirmation
        if ($this->ghostNick !== null && preg_match($this->ghostPattern, $message)) {
            $queue->ircNick($this->ghostNick);
            $this->ghostNick = null;
            return;
        }
    }
public function handleNotice(UserEvent $event, Queue $queue)
    {
        // Ignore notices that aren't from the NickServ agent
        if (strcasecmp($event->getNick(), $this->botNick) !== 0) {
            return;
        }

        $connection = $event->getConnection();
        $params = $event->getParams();
        $message = $params['text'];

        // Authenticate the bot's identity for authentication requests
        if (preg_match($this->identifyPattern, $message)) {
            return $queue->ircPrivmsg($this->botNick, 'IDENTIFY ' . $this->password);
        }

        // Emit an event on successful authentication
        if (preg_match($this->loginPattern, $message)) {
            return $this->getEventEmitter()->emit('nickserv.identified', [$connection, $queue]);
        }

        // Reclaim primary nick on ghost confirmation
        if ($this->ghostNick !== null && preg_match($this->ghostPattern, $message)) {
            $queue->ircNick($this->ghostNick);
            $this->ghostNick = null;
            return;
        }
    }
public function handleNotice ( UserEvent $ event , Queue $ queue ) { // Ignore notices that aren't from the NickServ agent if ( strcasecmp ( $ event -> getNick ( ) , $ this -> botNick ) !== 0 ) { return ; } $ connection = $ event -> getConnection ( ) ; $ params = $ event -> getParams ( ) ; $ message = $ params [ 'text' ] ; // Authenticate the bot's identity for authentication requests if ( preg_match ( $ this -> identifyPattern , $ message ) ) { return $ queue -> ircPrivmsg ( $ this -> botNick , 'IDENTIFY ' . $ this -> password ) ; } // Emit an event on successful authentication if ( preg_match ( $ this -> loginPattern , $ message ) ) { return $ this -> getEventEmitter ( ) -> emit ( 'nickserv.identified' , [ $ connection , $ queue ] ) ; } // Reclaim primary nick on ghost confirmation if ( $ this -> ghostNick !== null && preg_match ( $ this -> ghostPattern , $ message ) ) { $ queue -> ircNick ( $ this -> ghostNick ) ; $ this -> ghostNick = null ; return ; } }
Responds to authentication requests and notifications of ghost
connections being killed from NickServ.

@param \Phergie\Irc\Event\UserEventInterface $event
@param \Phergie\Irc\Bot\React\EventQueueInterface $queue
Responds to authentication requests and notifications of ghost connections being killed from NickServ .