Esempio n. 1
0
def start(listen_address=None):
    """Starts a chat session and enables logging to output to the console
    
    listen_address must be tuple of the form ('127.0.0.1', 9091). If the specified
    address isn't available the chat session will not be started.
    """
    global chat
    atexit.register(quiet_stop)
    if not chat:
        if listen_address:
            chat = Chat(listen_address)
        else:
            chat = Chat()
    elif listen_address:
        print "Warning: chat already started"
        return
    chat.enableConsoleLogging()
    try:
        chat.start()
    except:
        chat = None
        raise