def main(): """ x84 main entry point. The system begins and ends here. Command line arguments to engine.py: - ``--config=`` location of alternate configuration file - ``--logger=`` location of alternate logging.ini file """ # load existing .ini files or create default ones. import x84.bbs.ini x84.bbs.ini.init(*cmdline.parse_args()) from x84.bbs import get_ini from x84.bbs.ini import CFG if sys.maxunicode == 65535: # apple is the only known bastardized variant that does this; # presumably for memory/speed savings (UCS-2 strings are faster # than UCS-4). Python 3 dynamically allocates string types by # their widest content, so such things aren't necessary, there. import warnings warnings.warn('This python is built without wide unicode support. ' 'some internationalized languages will not be possible.') # retrieve list of managed servers servers = get_servers(CFG) # begin unmanaged servers if (CFG.has_section('web') and (not CFG.has_option('web', 'enabled') or CFG.getboolean('web', 'enabled'))): # start https server for one or more web modules. from x84 import webserve webserve.main() if get_ini(section='msg', key='network_tags'): # start background timer to poll for new messages # of message networks we may be a member of. from x84 import msgpoll msgpoll.main() try: # begin main event loop _loop(servers) except KeyboardInterrupt: # exit on ^C, killing any client sessions. for server in servers: for thread in server.threads[:]: if not thread.stopped: thread.stopped = True server.threads.remove(thread) for key, client in server.clients.items()[:]: kill_session(client, 'server shutdown') del server.clients[key] return 0
import struct import glob import os # Reading Binary Packet Formats from ctypes import LittleEndianStructure, Union, c_uint8 # x84 specific from x84.bbs.ini import init, get_ini from x84.cmdline import parse_args # Database for holding FidoNet Specific Items and Kludges FIDO_DB = 'pymail' # Read in default .x84 INI File. init(*parse_args()) class FidonetConfiguration(): # Holds configuration values from x84 Default.ini # also builds up lists of areas per network and # their data -> tag translatons def __init__(self): self.__network_list = [] # List of Fido Networks self.__node_address = {} # Your Address self.__export_address = {} # Your Network Hub's Address self.__network_areas = {} # Message Areas by network self.__default_areas = {} # Default if no Valid Area Tag self.__inbound_folder = None self.__unpack_folder = None self.read_configuration() # Load All INI settings on startup.