Listen for kick channel events.

@param \Phergie\Irc\Event\UserEventInterface $event
@param \Phergie\Irc\Bot\React\EventQueueInterface $queue
17777
public function onKickChannels(UserEventInterface $event, EventQueueInterface $queue)
    {
        $this->joinOnMatch($event->getParams()['user'], $event, $queue);
    }
1224623
public void queue(final AsyncEvent<K> _event) {
    final K key = _event.getKey();
    synchronized (getLockObject(key)) {
      Queue<AsyncEvent<K>> q = keyQueue.get(key);
      if (q != null) {
        q.add(_event);
        return;
      }
      q = new LinkedList<AsyncEvent<K>>();
      keyQueue.put(key, q);
    }
    Runnable r = new Runnable() {
      @Override
      public void run() {
        runMoreOrStop(_event);
      }
    };
    executor.execute(r);
  }
1096109
public function getEventQueue(ConnectionInterface $connection)
    {
        if (!isset($this->queues[$connection])) {
            $this->queues[$connection] = new EventQueue;
        }
        return $this->queues[$connection];
    }
1006167
public function subscribeQueueEvents(QueueManager $queue)
    {
        $queue->looping(function () {
            // Flush any and all events that were possibly generated by queue jobs
            Integration::flushEvents();

            // We have added a scope when a job starts processing
            Hub::getCurrent()->popScope();
        });

        foreach (static::$queueEventHandlerMap as $eventName => $handler) {
            $this->events->listen($eventName, [$this, $handler]);
        }
    }
783095
public function deliverMessage(UserEventInterface $event, EventQueueInterface $queue)
    {
        if ($event->getNick() != $event->getConnection()->getNickname()) {
            $messages = $this->database->retrieveMessages($event->getNick());
            foreach ($messages as $row) {
                $message = sprintf('(%s) %s: %s',
                    (new \DateTime($row['timestamp']))->format('m/d h:ia'),
                    $row['sender'],
                    $row['message']);
                $queue->ircNotice($event->getNick(), $message);
            }
        }
    }
625799
public function onPartChannels(UserEventInterface $event, EventQueueInterface $queue)
    {
        $this->joinOnMatch($event->getNick(), $event, $queue);
    }
350769
public function removeUser(UserEventInterface $event, EventQueueInterface $queue)
    {
        $logger = $this->getLogger();
        $logger->debug('Removing user from all channels');
        $connectionMask = $this->getConnectionMask($event->getConnection());
        if (isset($this->modes[$connectionMask])) {
            $this->removeUserData(
                $connectionMask,
                array_keys($this->modes[$connectionMask]),
                $event->getNick()
            );
        }
    }
703879
private void fireOnPurgeQueue(ChannelEvent e) {
        List<EventListener> listeners = changes.getListenerList(AMQP);
        for (EventListener listener : listeners) {
            ChannelListener amqpListener = (ChannelListener)listener;
            amqpListener.onPurgeQueue(e);
        }
    }
973639
public function handleCommand(Event $event, Queue $queue)
    {
        $queue->ircPrivmsg($event->getSource(), $this->getResponse($event));
    }
137622
public void setTargetQueue(String queue)
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "setTargetQueue", queue);

    targetQueue = queue;

    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "setTargetQueue");
  }
211664
private void handleQueueMemberEvent(QueueMemberEvent event)
    {
        final AsteriskQueueImpl queue = getInternalQueueByName(event.getQueue());
        if (queue == null)
        {
            logger.error("Ignored QueueEntryEvent for unknown queue " + event.getQueue());
            return;
        }

        AsteriskQueueMemberImpl member = queue.getMember(event.getLocation());
        if (member == null)
        {
            member = new AsteriskQueueMemberImpl(server, queue, event.getLocation(), QueueMemberState.valueOf(event
                    .getStatus()), event.getPaused(), event.getPenalty(), event.getMembership(), event.getCallsTaken(),
                    event.getLastCall());

            queue.addMember(member);
        }
        else
        {
            manageQueueMemberChange(queue, member, event);
        }

    }
1240119
public function onSetErrorListenerRun(
        QueueSetErrorEvent $event,
        $eventName,
        EventDispatcherInterface $dispatcher
    ) {
        $query = $event->getQuery();
        $this->database->execute($query);
    }
630362
public function handleCommand(CommandEvent $event, Queue $queue)
    {
        $logger = $this->getLogger();

        $server = strtolower($event->getConnection()->getServerHostname());
        $source = $event->getSource();
        $nick = $event->getNick();
        if ($source === null || $nick === null || $source == $nick) {
            $logger->debug('Command request not in channel, ignoring');
            return;
        }

        $params = $event->getCustomParams();
        if (empty($params)) {
            $this->handleCommandHelp($event, $queue);
            return;
        }

        $target = $params[0];
        try {
            $data = $this->db->fetchAssoc(
               'SELECT "time", "nick", "type", "text"
                FROM "seen"
                WHERE "server" = :server
                AND "channel" = :channel
                AND (
                    "nick" = :nick
                    OR (
                        "type" = ' . self::TYPE_NICK . '
                        AND "text" = :nick
                    )
                )
                ORDER BY "time" DESC
                LIMIT 1',
                array(
                    ':server' => $server,
                    ':channel' => $source,
                    ':nick' => $target,
                )
            );
        } catch (\Exception $e) {
            $logger->error($e->getMessage());
            $queue->ircPrivmsg($source, "\x02Error:\x02 Could not retrieve data.");
            return;
        }

        if ($data === false) {
            $queue->ircPrivmsg($source, "I haven't seen \x02$target\x02 in $source!");
            return;
        }

        switch ($data['type']) {
            case (self::TYPE_JOIN):
                $message = 'joining the channel.';
                break;

            case (self::TYPE_PART):
                if ($data['text']) {
                    $message = "leaving the channel ({$data['text']})";
                }
                else {
                    $message = 'leaving the channel.';
                }
                break;

            case (self::TYPE_KICK):
                if ($data['text']) {
                    $message = "being kicked from the channel ({$data['text']})";
                }
                else {
                    $message = 'being kicked from the channel.';
                }
                break;

            case (self::TYPE_QUIT):
                if ($data['text']) {
                    $message = "disconnecting from IRC ({$data['text']})";
                }
                else {
                    $message = 'disconnecting from IRC.';
                }
                break;

            case (self::TYPE_PRIVMSG):
                $message = "saying: {$data['text']}";
                break;

            case (self::TYPE_NOTICE):
                $message = "sending a notice: {$data['text']}";
                break;

            case (self::TYPE_ACTION):
                $message = "saying: * {$data['nick']} {$data['text']}";
                break;

            case (self::TYPE_NICK):
                if (!strcasecmp($target, $data['nick'])) {
                    $target = $data['nick'];
                    $message = "changing nick to {$data['text']}.";
                }
                else {
                    $target = $data['text'];
                    $message = "changing nick from {$data['nick']}.";
                }
                break;

            default:
                $logger->error('Unknown parameter type retrieved from database', $data);
                $queue->ircPrivmsg($source, "\x02Error:\x02 A database error occurred.");
                return;
        }

        // Canonicalise capitalisation
        if ($data['type'] != self::TYPE_NICK) {
            $target = $data['nick'];
        }

        if ($this->isInChannel($server, $source, $target))
        {
            $prefix = "\x02$target\x02 is currently in the channel! Last seen";
        } else {
            $prefix = "\x02$target\x02 was last seen";
        }

        $queue->ircPrivmsg($source, "$prefix " . $this->ago($data['time']) . " $message");
    }
1131037
public function onPreUpdate(UserEvent $event)
    {
        /** @var \Ekyna\Bundle\UserBundle\Model\UserInterface $user */
        $user = $event->getResource();

        $this->userManager->updatePassword($user);
        $this->userManager->updateCanonicalFields($user);
    }
898423
public function handleHelpCommand(CommandEvent $event, EventQueueInterface $queue)
    {
        $params = $event->getCustomParams();
        if ($params) {
            $command = strtolower(reset($params));
            $eventName = 'command.' . $command . '.help';
            $this->getEventEmitter()->emit($eventName, array($event, $queue));
        } else {
            $this->listCommands($event, $queue);
        }
    }
1139841
public function handleNick(UserEvent $event, Queue $queue)
    {
        $connection = $event->getConnection();
        if (strcasecmp($event->getNick(), $connection->getNickname()) === 0) {
            $params = $event->getParams();
            $connection->setNickname($params['nickname']);
        }
    }
376703
private void handleQueueEntryEvent(QueueEntryEvent event)
    {
        final AsteriskQueueImpl queue = getInternalQueueByName(event.getQueue());
        final AsteriskChannelImpl channel = channelManager.getChannelImplByName(event.getChannel());

        if (queue == null)
        {
            logger.error("Ignored QueueEntryEvent for unknown queue " + event.getQueue());
            return;
        }
        if (channel == null)
        {
            logger.error("Ignored QueueEntryEvent for unknown channel " + event.getChannel());
            return;
        }

        if (queue.getEntry(event.getChannel()) != null)
        {
            logger.debug("Ignored duplicate queue entry during population in queue " + event.getQueue() + " for channel "
                    + event.getChannel());
            return;
        }

        // Asterisk gives us an initial position but doesn't tell us when he
        // shifts the others
        // We won't use this data for ordering until there is a appropriate
        // event in AMI.
        // (and refreshing the whole queue is too intensive and suffers
        // incoherencies
        // due to asynchronous shift that leaves holes if requested too fast)
        int reportedPosition = event.getPosition();

        queue.createNewEntry(channel, reportedPosition, event.getDateReceived());
    }