jp: all commands now use the new start method and set need_loop in __init__ when needed
This commit is contained in:
parent
89f6fe8605
commit
169bc43793
1 changed files with 46 additions and 84 deletions
|
|
@ -17,8 +17,6 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from logging import debug, info, warning
|
||||
|
||||
import base
|
||||
from sat.core.i18n import _
|
||||
|
||||
|
|
@ -29,13 +27,12 @@ class Disco(base.CommandBase):
|
|||
|
||||
def __init__(self, host):
|
||||
super(Disco, self).__init__(host, 'disco', help=_('Service discovery'))
|
||||
self.need_loop=True
|
||||
|
||||
def add_parser_options(self):
|
||||
self.parser.add_argument("jid", type=str, help=_("Entity to discover"))
|
||||
|
||||
def connected(self):
|
||||
self.need_loop=True
|
||||
super(Disco, self).connected()
|
||||
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)
|
||||
|
|
@ -108,13 +105,12 @@ class Version(base.CommandBase):
|
|||
|
||||
def __init__(self, host):
|
||||
super(Version, self).__init__(host, 'version', help=_('Client version'))
|
||||
self.need_loop=True
|
||||
|
||||
def add_parser_options(self):
|
||||
self.parser.add_argument("jid", type=str, help=_("Entity to request"))
|
||||
|
||||
def connected(self):
|
||||
self.need_loop=True
|
||||
super(Version, self).connected()
|
||||
def start(self):
|
||||
jids = self.host.check_jids([self.args.jid])
|
||||
jid = jids[0]
|
||||
self.host.bridge.getSoftwareVersion(jid, self.host.profile, callback=self.gotVersion, errback=self.error)
|
||||
|
|
|
|||
Loading…
Reference in a new issue