aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/server.py b/server.py
index c561193..ee7d7c2 100644
--- a/server.py
+++ b/server.py
@@ -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() :