src/Plugin.php
public function processNick(UserEvent $event, Queue $queue)
    {
        $logger = $this->getLogger();

        $nick = $event->getNick();
        if ($nick == $event->getConnection()->getNickname()) {
            $logger->debug('Nickname of incoming NICK is ours, ignoring');
            return;
        }

        $server = strtolower($event->getConnection()->getServerHostname());
        $params = $event->getParams();
        $newnick = $params['nickname'];

        $logger->debug('Processing incoming NICK', array(
            'server' => $server,
            'nick' => $nick,
            'newnick' => $newnick,
        ));

        foreach ($this->channels[$server] as $channel => $users) {
            if (isset($users[$nick])) {
                $logger->debug('Processing channel nick change', array(
                    'server' => $server,
                    'channel' => $channel,
                    'nick' => $nick,
                    'newnick' => $newnick,
                ));

                unset($this->channels[$server][$channel][$nick]);
                $this->channels[$server][$channel][$newnick] = true;

                try {
                    $this->db->fetchAssoc(self::SQL_UPDATE, array(
                        ':time' => time(),
                        ':server' => $server,
                        ':channel' => $channel,
                        ':nick' => $nick,
                        ':type' => self::TYPE_NICK,
                        ':text' => $newnick,
                    ));
                } catch (\Exception $e) {
                    $logger->error($e->getMessage());
                }
            }
        }
    }
public function processNick(UserEvent $event, Queue $queue)
    {
        $logger = $this->getLogger();

        $nick = $event->getNick();
        if ($nick == $event->getConnection()->getNickname()) {
            $logger->debug('Nickname of incoming NICK is ours, ignoring');
            return;
        }

        $server = strtolower($event->getConnection()->getServerHostname());
        $params = $event->getParams();
        $newnick = $params['nickname'];

        $logger->debug('Processing incoming NICK', array(
            'server' => $server,
            'nick' => $nick,
            'newnick' => $newnick,
        ));

        foreach ($this->channels[$server] as $channel => $users) {
            if (isset($users[$nick])) {
                $logger->debug('Processing channel nick change', array(
                    'server' => $server,
                    'channel' => $channel,
                    'nick' => $nick,
                    'newnick' => $newnick,
                ));

                unset($this->channels[$server][$channel][$nick]);
                $this->channels[$server][$channel][$newnick] = true;

                try {
                    $this->db->fetchAssoc(self::SQL_UPDATE, array(
                        ':time' => time(),
                        ':server' => $server,
                        ':channel' => $channel,
                        ':nick' => $nick,
                        ':type' => self::TYPE_NICK,
                        ':text' => $newnick,
                    ));
                } catch (\Exception $e) {
                    $logger->error($e->getMessage());
                }
            }
        }
    }
public function processNick ( UserEvent $ event , Queue $ queue ) { $ logger = $ this -> getLogger ( ) ; $ nick = $ event -> getNick ( ) ; if ( $ nick == $ event -> getConnection ( ) -> getNickname ( ) ) { $ logger -> debug ( 'Nickname of incoming NICK is ours, ignoring' ) ; return ; } $ server = strtolower ( $ event -> getConnection ( ) -> getServerHostname ( ) ) ; $ params = $ event -> getParams ( ) ; $ newnick = $ params [ 'nickname' ] ; $ logger -> debug ( 'Processing incoming NICK' , array ( 'server' => $ server , 'nick' => $ nick , 'newnick' => $ newnick , ) ) ; foreach ( $ this -> channels [ $ server ] as $ channel => $ users ) { if ( isset ( $ users [ $ nick ] ) ) { $ logger -> debug ( 'Processing channel nick change' , array ( 'server' => $ server , 'channel' => $ channel , 'nick' => $ nick , 'newnick' => $ newnick , ) ) ; unset ( $ this -> channels [ $ server ] [ $ channel ] [ $ nick ] ) ; $ this -> channels [ $ server ] [ $ channel ] [ $ newnick ] = true ; try { $ this -> db -> fetchAssoc ( self :: SQL_UPDATE , array ( ':time' => time ( ) , ':server' => $ server , ':channel' => $ channel , ':nick' => $ nick , ':type' => self :: TYPE_NICK , ':text' => $ newnick , ) ) ; } catch ( \ Exception $ e ) { $ logger -> error ( $ e -> getMessage ( ) ) ; } } } }
Monitor nick changes.

@param \Phergie\Irc\Event\UserEventInterface $event
@param \Phergie\Irc\Bot\React\EventQueueInterface $queue
Monitor nick changes .