Exemplo n.º 1
0
    def _handle_433(self, message):
        prefix, command, parameters = Irc.split_message(message)

        if re.search("Nickname is already in use", parameters):
            self.config['nick'] = "_{}".format(self.config['nick'])
            self._send_message(Irc.nick(self.config['nick']))
            self._send_message(
                Irc.user(self.config['user'], self.config['unused'],
                         self.config['owner']))
            self._send_message(
                Irc.mode(self.config['nick'], self.config['mode']))
Exemplo n.º 2
0
    def init_loop(self):
        logger.info("Client started.")

        if self._init_socket() is not None:
            if self.config['ssl']:
                ssl_info = self.sock.cipher()
                if ssl_info:
                    logger.info(
                        "SSL Cipher (%s), SSL Version (%s), SSL Bits (%s)",
                        *ssl_info)

            # IRC RFC2812:3.1 states that a client needs to send a nick and
            # user message in order to register a connection.
            # Most servers mandate that the user's real name be the owner.
            self._send_message(Irc.nick(self.config['nick']))
            self._send_message(
                Irc.user(self.config['user'], self.config['unused'],
                         self.config['owner']))

        else:
            self.stop()