public function handleLeaving(
        \Erebot\Interfaces\EventHandler         $handler,
        \Erebot\Interfaces\Event\Base\Generic   $event
    ) {
        if ($event instanceof \Erebot\Interfaces\Event\Kick) {
            $nick = (string) $event->getTarget();
        } else {
            $nick = (string) $event->getSource();
        }

        $collator   = $this->connection->getCollator();
        $nick       = $collator->normalizeNick($nick);
        $key        = array_search($nick, $this->nicks);

        if ($event instanceof \Erebot\Interfaces\Event\Quit) {
            foreach ($this->chans as $chan => $data) {
                if (isset($data[$key])) {
                    unset($this->chans[$chan][$key]);
                }
            }
        } else {
            unset($this->chans[$event->getChan()][$key]);
        }

        if (!count($this->getCommonChans($nick))) {
            $this->ial[$key]['ison'] = false;
            $delay = $this->parseInt('expire_delay', 60);
            if ($delay < 0) {
                $delay = 0;
            }

            if (!$delay) {
                $this->realRemoveUser($nick);
            } else {
                $timerCls       = $this->getFactory('!Timer');
                $timer = new $timerCls(
                    array($this, 'removeUser'),
                    $delay,
                    false,
                    array($nick)
                );
                $this->addTimer($timer);
            }
        }
    }
public function handleLeaving(
        \Erebot\Interfaces\EventHandler         $handler,
        \Erebot\Interfaces\Event\Base\Generic   $event
    ) {
        if ($event instanceof \Erebot\Interfaces\Event\Kick) {
            $nick = (string) $event->getTarget();
        } else {
            $nick = (string) $event->getSource();
        }

        $collator   = $this->connection->getCollator();
        $nick       = $collator->normalizeNick($nick);
        $key        = array_search($nick, $this->nicks);

        if ($event instanceof \Erebot\Interfaces\Event\Quit) {
            foreach ($this->chans as $chan => $data) {
                if (isset($data[$key])) {
                    unset($this->chans[$chan][$key]);
                }
            }
        } else {
            unset($this->chans[$event->getChan()][$key]);
        }

        if (!count($this->getCommonChans($nick))) {
            $this->ial[$key]['ison'] = false;
            $delay = $this->parseInt('expire_delay', 60);
            if ($delay < 0) {
                $delay = 0;
            }

            if (!$delay) {
                $this->realRemoveUser($nick);
            } else {
                $timerCls       = $this->getFactory('!Timer');
                $timer = new $timerCls(
                    array($this, 'removeUser'),
                    $delay,
                    false,
                    array($nick)
                );
                $this->addTimer($timer);
            }
        }
    }
public function handleLeaving ( \ Erebot \ Interfaces \ EventHandler $ handler , \ Erebot \ Interfaces \ Event \ Base \ Generic $ event ) { if ( $ event instanceof \ Erebot \ Interfaces \ Event \ Kick ) { $ nick = ( string ) $ event -> getTarget ( ) ; } else { $ nick = ( string ) $ event -> getSource ( ) ; } $ collator = $ this -> connection -> getCollator ( ) ; $ nick = $ collator -> normalizeNick ( $ nick ) ; $ key = array_search ( $ nick , $ this -> nicks ) ; if ( $ event instanceof \ Erebot \ Interfaces \ Event \ Quit ) { foreach ( $ this -> chans as $ chan => $ data ) { if ( isset ( $ data [ $ key ] ) ) { unset ( $ this -> chans [ $ chan ] [ $ key ] ) ; } } } else { unset ( $ this -> chans [ $ event -> getChan ( ) ] [ $ key ] ) ; } if ( ! count ( $ this -> getCommonChans ( $ nick ) ) ) { $ this -> ial [ $ key ] [ 'ison' ] = false ; $ delay = $ this -> parseInt ( 'expire_delay' , 60 ) ; if ( $ delay < 0 ) { $ delay = 0 ; } if ( ! $ delay ) { $ this -> realRemoveUser ( $ nick ) ; } else { $ timerCls = $ this -> getFactory ( '!Timer' ) ; $ timer = new $ timerCls ( array ( $ this , 'removeUser' ) , $ delay , false , array ( $ nick ) ) ; $ this -> addTimer ( $ timer ) ; } } }
Handles some user leaving an IRC channel.
This may result from either a QUIT or KICK command.

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

\param Erebot::Interfaces::Event::Base::Generic $event
An event indicating that some user is leaving
an IRC channel the bot is on.

@SuppressWarnings(PHPMD.UnusedFormalParameter)
Handles some user leaving an IRC channel . This may result from either a QUIT or KICK command .