diff options
| author | Thibaut Horel <thibaut.horel@gmail.com> | 2010-11-12 21:59:20 +0100 |
|---|---|---|
| committer | Thibaut Horel <thibaut.horel@gmail.com> | 2010-11-12 21:59:20 +0100 |
| commit | 52f39a51946a1beca293dccefb859cf35bb49d63 (patch) | |
| tree | a48448c78ea682293f2255cb9281bd81e0e18091 | |
| parent | ebd981516534e191bcae756c93dac90dcae60f08 (diff) | |
| download | alias-52f39a51946a1beca293dccefb859cf35bb49d63.tar.gz | |
Add debug option to server component (-d switch) to log all debug messages.
| -rw-r--r-- | server.py | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -2,6 +2,7 @@ from sleekxmpp.componentxmpp import ComponentXMPP from argparse import ArgumentParser from user import UserHandler from sleekxmpp.xmlstream.xmlstream import XMLStream +import logging class ObjectComponent(ComponentXMPP): @@ -29,7 +30,7 @@ class ObjectComponent(ComponentXMPP): if subscription["type"] == "subscribe" : userJID = subscription["from"].full self.userHandler.register(userJID) - self.sendPresenceSubscription(pto=userJID, ptype="subscribed") + subscription.reply() self.sendPresence(pto = userJID) self.sendPresenceSubscription(pto=userJID, ptype="subscribe") if subscription["type"] == "unsubscribe" : @@ -51,10 +52,15 @@ if __name__ == '__main__' : help='Name the component will have') commandline.add_argument('-r', '--root', help='Root directory of the user files') + commandline.add_argument('-d', '--debug', + help='Set log level to DEBUG', + action='store_const', + const=logging.DEBUG, + default=logging.INFO) commandline.add_argument('host', help='Host to connect to') args = commandline.parse_args() - + logging.basicConfig(level=args.debug) component = ObjectComponent(args.name, args.secret, args.host, args.port, args.root) if component.connect() : |
