Source

openju / main.py

Full commit
#!/usr/bin/python
# -*- coding: utf-8 -*-

from openju import OpenJu

# configuration
DEBUG = True
JID = 'openju@example.com'
PASSWORD = 'FasengEntoabApJo'

app = OpenJu(__name__)
app.config.from_object(__name__)

def run():
    app.run()

if __name__ == '__main__':
    run()

# from openju.messagecb import message_cb

# from openju.config import set_config_profile, get_conf_val
# from openju.util import *

# def StepOn(conn):
#     try:
#         conn.Process(1)
#     except KeyboardInterrupt: return 0
#     return 1

# def main():
#     set_config_profile('dev')
    
#     jid = xmpp.JID(get_conf_val('jid'))
#     user, server, password = jid.getNode(), jid.getDomain(), get_conf_val('pwd')
    
#     conn = xmpp.Client(server, debug=[])
#     conres = conn.connect()
#     if not conres:
#         print "> Unable to connect to server %s!" % server
#         sys.exit(1)
#     if conres != 'tls':
#         print "> Warning: unable to estabilish secure connection - TLS failed!"
#     authres = conn.auth(user,password)
#     if not authres:
#         print "> Unable to authorize on %s - check login/password." % server
#         sys.exit(1)
#     conn.RegisterHandler('message', message_cb)
#     conn.sendInitPresence()
#     print "> Bot started."
#     while StepOn(conn):
#         pass

# if __name__ == '__main__':
#     main()