patch b07534112c075b3b057cf9d514264cd5283cae33 Author: E. Bosch Date: Sun Dec 12 02:15:52 CET 2021 * Propagate 'settings' to IRCHandler() and TelegramHandler() diff -rN -u old-irgramd/irc.py new-irgramd/irc.py --- old-irgramd/irc.py 2024-11-22 21:37:34.218699936 +0100 +++ new-irgramd/irc.py 2024-11-22 21:37:34.222699929 +0100 @@ -46,11 +46,10 @@ # IRC Handler class IRCHandler(object): - def __init__(self, config_dir): + def __init__(self, settings): self.logger = logging.getLogger() self.ioloop = tornado.ioloop.IOLoop.current() self.hostname = socket.gethostname() - self.config_dir = config_dir self.users = {} # Initialize IRC diff -rN -u old-irgramd/irgramd new-irgramd/irgramd --- old-irgramd/irgramd 2024-11-22 21:37:34.222699929 +0100 +++ new-irgramd/irgramd 2024-11-22 21:37:34.222699929 +0100 @@ -16,7 +16,7 @@ # IRC Telegram Daemon class IRCTelegramd(tornado.tcpserver.TCPServer): - def __init__(self, logger, config_direc, settings): + def __init__(self, logger, settings): self.logger = logger effective_port = settings['port'] @@ -38,7 +38,6 @@ self.address = settings['address'] or '127.0.0.1' self.port = effective_port - self.config_dir = config_direc self.irc_handler = None self.tg_handler = None @@ -46,11 +45,11 @@ async def handle_stream(self, stream, address): await self.irc_handler.run(stream, address) - async def run(self): + async def run(self, settings): self.listen(self.port, self.address) self.logger.info('irgramd listening on %s:%s', self.address, self.port) - self.irc_handler = IRCHandler(self.config_dir) - self.tg_handler = TelegramHandler(self.irc_handler, self.config_dir) + self.irc_handler = IRCHandler(settings) + self.tg_handler = TelegramHandler(self.irc_handler, settings) self.irc_handler.set_telegram(self.tg_handler) await self.tg_handler.initialize_telegram() @@ -85,7 +84,8 @@ tornado.options.parse_command_line() options = tornado.options.options.as_dict() + options['config_dir'] = config_dir - irc_server = IRCTelegramd(logger, config_dir, options) - asyncio.get_event_loop().run_until_complete(irc_server.run()) + irc_server = IRCTelegramd(logger, options) + asyncio.get_event_loop().run_until_complete(irc_server.run(options)) asyncio.get_event_loop().run_forever() diff -rN -u old-irgramd/telegram.py new-irgramd/telegram.py --- old-irgramd/telegram.py 2024-11-22 21:37:34.222699929 +0100 +++ new-irgramd/telegram.py 2024-11-22 21:37:34.222699929 +0100 @@ -27,9 +27,9 @@ # Telegram class TelegramHandler(object): - def __init__(self, irc, config_dir): + def __init__(self, irc, settings): self.logger = logging.getLogger() - self.config_dir = config_dir + self.config_dir = settings['config_dir'] self.irc = irc self.authorized = False self.id = None