Beispiel #1
0
 def test_logger(self):
     test_log_dir = utils.get_home_directory() + "logs/"
     log.setup_logger(name="test")
     test_log = log.get_logger("TEST")
     self.assertEqual("TEST", test_log.name)
     self.assertEqual(test_log.level, 0)
     os.unlink(test_log_dir + "test.log")
Beispiel #2
0
def Main():
    """Main IRC loop."""
    networks = CONFIG.get("networks", type="list")
    log.setup_logger()
    LOG.info("Starting %s" % version.version_string())
    LOG.info("Connecting to networks: %s" % ", ".join(networks))

    procs = []
    for network in networks:
        proc = process.Process(network)
        proc.start()
        procs.append(proc)

    try:
        while True:
            time.sleep(1)
            for proc in procs:
                if not proc.is_alive():
                    procs.remove(proc)

            if not procs:
                LOG.info("No longer connected to any networks, shutting down")
                sys.exit(0)
    except KeyboardInterrupt:
        LOG.info("Caught KeyboardInterrupt, shutting down")
Beispiel #3
0
    def __init__(self, network):
        log.setup_logger(str(network))
        self.network_config = utils.get_config(network)

        self.addressed = False
        self.client = None
        self.log = log.get_logger(str(network))
        self.version = version.version_string()

        self.admins = CONFIG.get("admins", type="list")
        self.command_prefix = CONFIG.get("command_prefix")

        self.api_token = self.network_config.get("api_token")
        self.nick = self.network_config.get("nick")

        self.load_plugins()
Beispiel #4
0
    def __init__(self, network):
        irclib.SimpleIRCClient.__init__(self)
        log.setup_logger(str(network))
        self.network_config = utils.get_config(network)
        self.log = log.get_logger(str(network))
        self.version = version.version_string()
        self.source = None
        self.target = None
        self.addressed = False

        self.admins = CONFIG.get("admins", type="list")
        self.command_prefix = CONFIG.get("command_prefix")
        self.reconnect_delay = CONFIG.get("reconnect_delay", type="int")
        self.rejoin_delay = CONFIG.get("rejoin_delay", type="int")

        self.server = self.network_config.get("server")
        self.password = self.network_config.get("password", default=None)
        self.port = self.network_config.get("port", type="int", default=6667)
        self.ssl = self.network_config.get("ssl", type="bool", default=False)
        self.ipv6 = self.network_config.get("ipv6", type="bool", default=False)
        self.bind_to = self.network_config.get("bind_to", default=None)
        self.nick = self.network_config.get("nick")
        self.username = self.network_config.get("username", default=None)
        self.identify_password = self.network_config.get("identify_password",
                                                         default=None)
        self.channels = self.network_config.get("channels", type="list")

        self.load_plugins()

        self.log.info("Connecting to %s:%d as %s" %
                      (self.server, self.port, self.nick))
        self.connect(self.server,
                     self.port,
                     self.nick,
                     self.password,
                     username=self.username,
                     connect_factory=connection.Factory(
                         wrapper=ssl.wrap_socket, ipv6=self.ipv6).connect
                     if self.ssl else connection.Factory())
Beispiel #5
0
    def __init__(self, network):
        irclib.SimpleIRCClient.__init__(self)
        log.setup_logger(str(network))
        self.network_config = utils.get_config(network)
        self.log = log.get_logger(str(network))
        self.version = version.version_string()
        self.source = None
        self.target = None
        self.addressed = False

        self.admins = CONFIG.get("admins", type="list")
        self.command_prefix = CONFIG.get("command_prefix")
        self.reconnect_delay = CONFIG.get("reconnect_delay", type="int")
        self.rejoin_delay = CONFIG.get("rejoin_delay", type="int")

        self.server = self.network_config.get("server")
        self.password = self.network_config.get("password", default=None)
        self.port = self.network_config.get("port", type="int", default=6667)
        self.ssl = self.network_config.get("ssl", type="bool", default=False)
        self.ipv6 = self.network_config.get("ipv6", type="bool", default=False)
        self.bind_to = self.network_config.get("bind_to", default=None)
        self.nick = self.network_config.get("nick")
        self.username = self.network_config.get("username", default=None)
        self.identify_password = self.network_config.get("identify_password",
                                                         default=None)
        self.channels = self.network_config.get("channels", type="list")

        self.load_plugins()

        self.log.info("Connecting to %s:%d as %s" % (self.server, self.port,
                      self.nick))
        self.connect(self.server, self.port, self.nick, self.password,
                     username=self.username,
                     connect_factory=connection.Factory(
                         wrapper=ssl.wrap_socket,
                         ipv6=self.ipv6).connect
                     if self.ssl else connection.Factory())