diff options
| author | Guillaume Horel <guillaume.horel@gmail.com> | 2012-05-09 00:02:22 -0400 |
|---|---|---|
| committer | Guillaume Horel <guillaume.horel@gmail.com> | 2012-05-09 00:02:22 -0400 |
| commit | 651dc684c635ab83defca480ef1e8118d8609694 (patch) | |
| tree | 4e6236e447468d9266173ada4152ae72cf42ba3e /alias_server/component.py | |
| parent | 257fe300439083b10f89ce1b8f29504a776fc84f (diff) | |
| download | alias-651dc684c635ab83defca480ef1e8118d8609694.tar.gz | |
Some fixes to the alias component server
Diffstat (limited to 'alias_server/component.py')
| -rw-r--r-- | alias_server/component.py | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/alias_server/component.py b/alias_server/component.py index ae238ed..1770c20 100644 --- a/alias_server/component.py +++ b/alias_server/component.py @@ -33,22 +33,18 @@ class ObjectComponent(ComponentXMPP): msg.reply("Thanks for sending\n{[body]}".format(msg)).send() def presence_subscription(self, subscription): + userJID = subscription["from"].full + subscriber = User(subscription["from"].bare) if subscription["type"] == "subscribe": - userJID = subscription["from"].full - if not self.userHandler.registered(userJID): - self.userHandler.register(userJID) + if not subscriber.is_registered(): logger.info('registering user {}'.format(userJID)) subscription.reply().send() self.send_presence(pto = userJID) self.send_presence_subscription(pto = userJID, ptype = "subscribe") if subscription["type"] == "unsubscribe": - userJID = subscription["from"].full - if self.userHandler.registered(userJID): - self.userHandler.unregister(userJID) + if subscriber.is_registered: + subscriber.unregister() logger.info('unregistering user {}'.format(userJID)) #def presence_probe(self, event): # self.send_presence(pto = event["from"].full) - - - |
