This repository has been archived on 2025-03-02. You can view files and clone it, but cannot push or open issues or pull requests.
curunir/curunir.py

39 lines
813 B
Python
Raw Permalink Normal View History

import signal, sys, traceback
2010-05-02 06:20:00 +02:00
from config import config
from modules import ModuleManager
from connection.xmpp import XMPPConnection
2010-05-02 20:28:17 +02:00
2010-05-02 06:20:00 +02:00
run = True
def exithandler(signum, frame):
global run
run = False
2010-05-03 03:37:21 +02:00
print 'Starting Curunir 0.1'
2010-05-02 06:20:00 +02:00
signal.signal(signal.SIGINT, exithandler)
signal.signal(signal.SIGTERM, exithandler)
signal.signal(signal.SIGQUIT, exithandler)
2010-05-03 03:37:21 +02:00
print 'Loading modules...'
2010-05-02 20:28:17 +02:00
modman = ModuleManager(config)
2010-05-02 06:20:00 +02:00
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()