comparison frontends/src/jp/cmd_info.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 d17772b0fe22
children 3e168cde7a7d
comparison
equal deleted inserted replaced
1863:b2ddd7f5dcdf 1864:96ba685162f6
15 # GNU Affero General Public License for more details. 15 # GNU Affero General Public License for more details.
16 16
17 # You should have received a copy of the GNU Affero General Public License 17 # You should have received a copy of the GNU Affero General Public License
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. 18 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 19
20 from logging import debug, info, warning
21
22 import base 20 import base
23 from sat.core.i18n import _ 21 from sat.core.i18n import _
24 22
25 __commands__ = ["Info"] 23 __commands__ = ["Info"]
26 24
27 25
28 class Disco(base.CommandBase): 26 class Disco(base.CommandBase):
29 27
30 def __init__(self, host): 28 def __init__(self, host):
31 super(Disco, self).__init__(host, 'disco', help=_('Service discovery')) 29 super(Disco, self).__init__(host, 'disco', help=_('Service discovery'))
30 self.need_loop=True
32 31
33 def add_parser_options(self): 32 def add_parser_options(self):
34 self.parser.add_argument("jid", type=str, help=_("Entity to discover")) 33 self.parser.add_argument("jid", type=str, help=_("Entity to discover"))
35 34
36 def connected(self): 35 def start(self):
37 self.need_loop=True
38 super(Disco, self).connected()
39 jids = self.host.check_jids([self.args.jid]) 36 jids = self.host.check_jids([self.args.jid])
40 jid = jids[0] 37 jid = jids[0]
41 self.host.bridge.discoInfos(jid, profile_key=self.host.profile, callback=lambda infos: self.gotInfos(infos, jid), errback=self.error) 38 self.host.bridge.discoInfos(jid, profile_key=self.host.profile, callback=lambda infos: self.gotInfos(infos, jid), errback=self.error)
42 39
43 def error(self, failure): 40 def error(self, failure):
106 103
107 class Version(base.CommandBase): 104 class Version(base.CommandBase):
108 105
109 def __init__(self, host): 106 def __init__(self, host):
110 super(Version, self).__init__(host, 'version', help=_('Client version')) 107 super(Version, self).__init__(host, 'version', help=_('Client version'))
108 self.need_loop=True
111 109
112 def add_parser_options(self): 110 def add_parser_options(self):
113 self.parser.add_argument("jid", type=str, help=_("Entity to request")) 111 self.parser.add_argument("jid", type=str, help=_("Entity to request"))
114 112
115 def connected(self): 113 def start(self):
116 self.need_loop=True
117 super(Version, self).connected()
118 jids = self.host.check_jids([self.args.jid]) 114 jids = self.host.check_jids([self.args.jid])
119 jid = jids[0] 115 jid = jids[0]
120 self.host.bridge.getSoftwareVersion(jid, self.host.profile, callback=self.gotVersion, errback=self.error) 116 self.host.bridge.getSoftwareVersion(jid, self.host.profile, callback=self.gotVersion, errback=self.error)
121 117
122 def error(self, failure): 118 def error(self, failure):