public function handleNames(
        \Erebot\Interfaces\NumericHandler   $handler,
        \Erebot\Interfaces\Event\Numeric    $numeric
    ) {
        $text   = $numeric->getText();
        $chan   = $text[1];
        $users  = new \Erebot\TextWrapper(
            ltrim($numeric->getText()->getTokens(2), ':')
        );

        try {
            $caps = $this->connection->getModule(
                '\\Erebot\\Module\\ServerCapabilities'
            );
        } catch (\Erebot\NotFoundException $e) {
            return;
        }

        if (!$this->hasUHNAMES) {
            $this->sendCommand('WHO '.$chan);
        }

        foreach ($users as $user) {
            $modes = array();
            for ($i = 0, $len = strlen($user); $i < $len; $i++) {
                try {
                    $modes[] = $caps->getChanModeForPrefix($user[$i]);
                } catch (\Erebot\NotFoundException $e) {
                    break;
                }
            }

            $user = substr($user, count($modes));
            if ($user === false) {
                continue;
            }

            $identityCls = $this->getFactory('!Identity');
            $identity   = new $identityCls($user);
            $nick       = $identity->getNick();
            $collator   = $this->connection->getCollator();
            $normNick   = $collator->normalizeNick($nick);

            $this->updateUser(
                $nick,
                $identity->getIdent(),
                $identity->getHost(\Erebot\Interfaces\Identity::CANON_IPV6)
            );
            $key = array_search($normNick, $this->nicks);
            $this->chans[$chan][$key] = $modes;
        }
    }
public function handleNames(
        \Erebot\Interfaces\NumericHandler   $handler,
        \Erebot\Interfaces\Event\Numeric    $numeric
    ) {
        $text   = $numeric->getText();
        $chan   = $text[1];
        $users  = new \Erebot\TextWrapper(
            ltrim($numeric->getText()->getTokens(2), ':')
        );

        try {
            $caps = $this->connection->getModule(
                '\\Erebot\\Module\\ServerCapabilities'
            );
        } catch (\Erebot\NotFoundException $e) {
            return;
        }

        if (!$this->hasUHNAMES) {
            $this->sendCommand('WHO '.$chan);
        }

        foreach ($users as $user) {
            $modes = array();
            for ($i = 0, $len = strlen($user); $i < $len; $i++) {
                try {
                    $modes[] = $caps->getChanModeForPrefix($user[$i]);
                } catch (\Erebot\NotFoundException $e) {
                    break;
                }
            }

            $user = substr($user, count($modes));
            if ($user === false) {
                continue;
            }

            $identityCls = $this->getFactory('!Identity');
            $identity   = new $identityCls($user);
            $nick       = $identity->getNick();
            $collator   = $this->connection->getCollator();
            $normNick   = $collator->normalizeNick($nick);

            $this->updateUser(
                $nick,
                $identity->getIdent(),
                $identity->getHost(\Erebot\Interfaces\Identity::CANON_IPV6)
            );
            $key = array_search($normNick, $this->nicks);
            $this->chans[$chan][$key] = $modes;
        }
    }
public function handleNames ( \ Erebot \ Interfaces \ NumericHandler $ handler , \ Erebot \ Interfaces \ Event \ Numeric $ numeric ) { $ text = $ numeric -> getText ( ) ; $ chan = $ text [ 1 ] ; $ users = new \ Erebot \ TextWrapper ( ltrim ( $ numeric -> getText ( ) -> getTokens ( 2 ) , ':' ) ) ; try { $ caps = $ this -> connection -> getModule ( '\\Erebot\\Module\\ServerCapabilities' ) ; } catch ( \ Erebot \ NotFoundException $ e ) { return ; } if ( ! $ this -> hasUHNAMES ) { $ this -> sendCommand ( 'WHO ' . $ chan ) ; } foreach ( $ users as $ user ) { $ modes = array ( ) ; for ( $ i = 0 , $ len = strlen ( $ user ) ; $ i < $ len ; $ i ++ ) { try { $ modes [ ] = $ caps -> getChanModeForPrefix ( $ user [ $ i ] ) ; } catch ( \ Erebot \ NotFoundException $ e ) { break ; } } $ user = substr ( $ user , count ( $ modes ) ) ; if ( $ user === false ) { continue ; } $ identityCls = $ this -> getFactory ( '!Identity' ) ; $ identity = new $ identityCls ( $ user ) ; $ nick = $ identity -> getNick ( ) ; $ collator = $ this -> connection -> getCollator ( ) ; $ normNick = $ collator -> normalizeNick ( $ nick ) ; $ this -> updateUser ( $ nick , $ identity -> getIdent ( ) , $ identity -> getHost ( \ Erebot \ Interfaces \ Identity :: CANON_IPV6 ) ) ; $ key = array_search ( $ normNick , $ this -> nicks ) ; $ this -> chans [ $ chan ] [ $ key ] = $ modes ; } }
Handles a list with the nicknames
of all users in a given IRC channel.

\param Erebot::Interfaces::NumericHandler $handler
Handler that triggered this event.

\param Erebot::Interfaces::Event::Numeric $numeric
A numeric event with the nicknames of users
in an IRC channel the bot just joined.
This is the same type of numeric event as
when the NAMES command is issued.

@SuppressWarnings(PHPMD.UnusedFormalParameter)
Handles a list with the nicknames of all users in a given IRC channel .