jp: all commands now use the new start method and set need_loop in __init__ when needed

This commit is contained in:
Goffi 2016-02-29 16:52:51 +01:00
commit 169bc43793

View file

@ -33,14 +33,13 @@ class Purge(base.CommandBase):
def __init__(self, host):
super(Purge, self).__init__(host, 'purge', help=_('Purge the roster from its contacts with no subscription'))
self.need_loop = True
def add_parser_options(self):
self.parser.add_argument("--no_from", action="store_true", help=_("Also purge contacts with no 'from' subscription"))
self.parser.add_argument("--no_to", action="store_true", help=_("Also purge contacts with no 'to' subscription"))
def connected(self):
self.need_loop = True
super(Purge, self).connected()
def start(self):
self.host.bridge.getContacts(profile_key=self.host.profile, callback=self.gotContacts, errback=self.error)
def error(self, failure):
@ -99,13 +98,12 @@ class Stats(base.CommandBase):
def __init__(self, host):
super(Stats, self).__init__(host, 'stats', help=_('Show statistics about a roster'))
self.need_loop = True
def add_parser_options(self):
pass
def connected(self):
self.need_loop = True
super(Stats, self).connected()
def start(self):
self.host.bridge.getContacts(profile_key=self.host.profile, callback=self.gotContacts, errback=self.error)
def error(self, failure):
@ -161,15 +159,14 @@ class Get(base.CommandBase):
def __init__(self, host):
super(Get, self).__init__(host, 'get', help=_('Retrieve the roster contacts'))
self.need_loop = True
def add_parser_options(self):
self.parser.add_argument("--subscriptions", action="store_true", help=_("Show the contacts' subscriptions"))
self.parser.add_argument("--groups", action="store_true", help=_("Show the contacts' groups"))
self.parser.add_argument("--name", action="store_true", help=_("Show the contacts' names"))
def connected(self):
self.need_loop = True
super(Get, self).connected()
def start(self):
self.host.bridge.getContacts(profile_key=self.host.profile, callback=self.gotContacts, errback=self.error)
def error(self, failure):