diff frontends/src/jp/cmd_roster.py @ 1864:96ba685162f6

jp: all commands now use the new start method and set need_loop in __init__ when needed
author Goffi <goffi@goffi.org>
date Mon, 29 Feb 2016 16:52:51 +0100
parents 5f4d688d8b6e
children 44342730df66
line wrap: on
line diff
--- a/frontends/src/jp/cmd_roster.py	Mon Feb 29 16:52:51 2016 +0100
+++ b/frontends/src/jp/cmd_roster.py	Mon Feb 29 16:52:51 2016 +0100
@@ -33,14 +33,13 @@
 
     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 @@
 
     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 @@
 
     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):