def _event_loop(self):
        """
        The main event loop.
        Data from the server is parsed here using :func:`_parse_msg`.
        Parsed events are put in the object's event queue (`self.events`).
        """
        while True:
            orig_line = self.conn.iqueue.get()
            log.debug('<< ' + orig_line)
            line = u(orig_line, errors='replace').strip()
            err_msg = False
            try:
                message = Message(line)
            except ValueError:
                err_msg = True
            if err_msg or message.erroneous:
                log.error("Received a line that can't be parsed: \"%s\"" % orig_line)
                continue
            if message.command == ERR_NICKNAMEINUSE:
                self.set_nick(IRC.randomize_nick(self.nick))
            elif message.command == RPL_CONNECTED:
                for channel in self.channels:
                    self.join(channel)
            self._handle(message)
The main event loop.
        Data from the server is parsed here using :func:`_parse_msg`.
        Parsed events are put in the object's event queue (`self.events`).