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;
        }
    }