root/pizzja

Revision 29, 0.7 kB (checked in by davux, 2 years ago)
  • Insert lots of debug instructions.
  • Correct some mistakes when calling attributes ('self.' was forgotten, etc.)
  • In ForeignClient?:
    • remove useless getRegisterer() and getResource() methods.
    • don't use an affectation to have disconnect() call cnx.disconnect(), since xmpp.client.Client instances don't have a disconnect() method (it's pushed by xmpp.dispatcher.Dispatcher()). Use normal method def instead.
    • raise ConnectionError? when connection or auth fails, and inform component.
  • In main component:
    • catch ConnectionError? when a client fails to connect/auth (instead of letting it make it to the top and crash), and send a not-authorized error to the wannabee-controller. (closes #5)
    • On KeyboardInterrupt? or disconnection, disconnect nicely from all clients and stop looping.
  • In RegistrationManager?, use the right parameter style when executing SQL requests with sqlite module (pyformat instead of qmark). This closes #9.
  • Property svn:executable set to *
Line 
1#! /usr/bin/python
2# -*- coding: utf-8 -*-
3# vi: sts=4 et sw=4
4
5from common import problem, debug
6try:
7    from conf import component as info
8except ImportError:
9    problem("Error: Please create a file named 'conf.py' (e.g. rename and edit conf.py.example).", True)
10try:
11    from xmpp import client, protocol
12except ImportError:
13    problem("Error: this program needs the Python XMPP library.", True)
14from pizzjacomponent import PizzjaComponent
15
16try:
17    pizzja = PizzjaComponent(info['jid'], info['password'],
18                             info['server'], info['port'])
19except Exception, message:
20    problem("Error while connecting to server: %s" % (message), True)
21try:
22    pizzja.loop(10)
23except KeyboardInterrupt:
24    pizzja.sayGoodbye()
25debug("Bye.")
Note: See TracBrowser for help on using the browser.