jp (info/disco): added --node argument

This commit is contained in:
Goffi 2017-02-12 21:17:56 +01:00
commit 3e795fde5c

View file

@ -31,19 +31,20 @@ class Disco(base.CommandBase):
self.need_loop=True
def add_parser_options(self):
self.parser.add_argument("jid", type=str, help=_("entity to discover"))
self.parser.add_argument(u"jid", type=base.unicode_decoder, help=_(u"entity to discover"))
self.parser.add_argument(u"-n", u"--node", type=base.unicode_decoder, default=u'', help=_(u"node to use"))
def start(self):
jids = self.host.check_jids([self.args.jid])
jid = jids[0]
self.host.bridge.discoInfos(jid, profile_key=self.host.profile, callback=lambda infos: self.gotInfos(infos, jid), errback=self.error)
self.host.bridge.discoInfos(jid, node=self.args.node, profile_key=self.host.profile, callback=lambda infos: self.gotInfos(infos, jid), errback=self.error)
def error(self, failure):
print (_("Error while doing discovery [%s]") % failure)
self.host.quit(1)
def gotInfos(self, infos, jid):
self.host.bridge.discoItems(jid, profile_key=self.host.profile, callback=lambda items: self.gotItems(infos, items), errback=self.error)
self.host.bridge.discoItems(jid, node=self.args.node, profile_key=self.host.profile, callback=lambda items: self.gotItems(infos, items), errback=self.error)
def gotItems(self, infos, items):
features, identities, extensions = infos