patch 37280138e557593419086e9277a35fccc22785ad Author: E. Bosch Date: Thu Nov 19 20:48:09 CET 2020 * Rename irgramd.py to irgramd, to reflect it's the main file diff -rN -u old-irgramd/irgramd new-irgramd/irgramd --- old-irgramd/irgramd 1970-01-01 01:00:00.000000000 +0100 +++ new-irgramd/irgramd 2024-11-23 03:32:31.016922217 +0100 @@ -0,0 +1,53 @@ +#!/usr/bin/env python3 + +import logging +import os + +import tornado.ioloop +import tornado.options +import tornado.tcpserver + +import telethon + +# Local modules + +from irc import * + + +# IRC Telegram Daemon + +class IRCTelegramd(tornado.tcpserver.TCPServer): + def __init__(self, address=None, port=6667, config_dir=None, **settings): + tornado.tcpserver.TCPServer.__init__(self) + + self.logger = logging.getLogger() + self.address = address or '127.0.0.1' + self.port = port + self.config_dir = config_dir or os.path.expanduser('~/.config/irtelegramd') + + if not os.path.exists(self.config_dir): + os.makedirs(self.config_dir) + + async def handle_stream(self, stream, address): + handler = IRCHandler(stream, address, self.config_dir) + await handler.run() + + def run(self): + self.listen(self.port, self.address) + self.logger.info('IRTelegramd listening on %s:%s', self.address, self.port) + self.logger.info('Configuration Directory: %s', self.config_dir) + + tornado.ioloop.IOLoop.current().start() + + +# Main Execution + +if __name__ == '__main__': + tornado.options.define('address', default=None, help='Address to listen on.') + tornado.options.define('port', default=6667, help='Port to listen on.') + tornado.options.define('config_dir', default=None, help='Configuration directory') + tornado.options.parse_command_line() + + options = tornado.options.options.as_dict() + irc_server = IRCTelegramd(**options) + irc_server.run() diff -rN -u old-irgramd/irgramd.py new-irgramd/irgramd.py --- old-irgramd/irgramd.py 2024-11-23 03:32:31.016922217 +0100 +++ new-irgramd/irgramd.py 1970-01-01 01:00:00.000000000 +0100 @@ -1,53 +0,0 @@ -#!/usr/bin/env python3 - -import logging -import os - -import tornado.ioloop -import tornado.options -import tornado.tcpserver - -import telethon - -# Local modules - -from irc import * - - -# IRC Telegram Daemon - -class IRCTelegramd(tornado.tcpserver.TCPServer): - def __init__(self, address=None, port=6667, config_dir=None, **settings): - tornado.tcpserver.TCPServer.__init__(self) - - self.logger = logging.getLogger() - self.address = address or '127.0.0.1' - self.port = port - self.config_dir = config_dir or os.path.expanduser('~/.config/irtelegramd') - - if not os.path.exists(self.config_dir): - os.makedirs(self.config_dir) - - async def handle_stream(self, stream, address): - handler = IRCHandler(stream, address, self.config_dir) - await handler.run() - - def run(self): - self.listen(self.port, self.address) - self.logger.info('IRTelegramd listening on %s:%s', self.address, self.port) - self.logger.info('Configuration Directory: %s', self.config_dir) - - tornado.ioloop.IOLoop.current().start() - - -# Main Execution - -if __name__ == '__main__': - tornado.options.define('address', default=None, help='Address to listen on.') - tornado.options.define('port', default=6667, help='Port to listen on.') - tornado.options.define('config_dir', default=None, help='Configuration directory') - tornado.options.parse_command_line() - - options = tornado.options.options.as_dict() - irc_server = IRCTelegramd(**options) - irc_server.run()