import signal, sys, traceback from config import config from modules import ModuleManager from connection.xmpp import XMPPConnection run = True def exithandler(signum, frame): global run run = False print 'Starting Curunir 0.1' signal.signal(signal.SIGINT, exithandler) signal.signal(signal.SIGTERM, exithandler) signal.signal(signal.SIGQUIT, exithandler) print 'Loading modules...' modman = ModuleManager(config) while run: connection = XMPPConnection(config, modman) print 'Connecting...' connection.connect() try: while run: act = connection.stream.loop_iter(1) if not act: connection.idle() connection.disconnect() except: traceback.print_exc(file=sys.stdout) connection.disconnect()