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
|
|
@ -36,12 +36,14 @@ class PipeOut(base.CommandBase):
|
|||
|
||||
def __init__(self, host):
|
||||
super(PipeOut, self).__init__(host, 'out', help=_('send a pipe a stream'))
|
||||
self.need_loop = True
|
||||
|
||||
def add_parser_options(self):
|
||||
self.parser.add_argument("jid", type=base.unicode_decoder, help=_("the destination jid"))
|
||||
|
||||
def pipe_out(self):
|
||||
def start(self):
|
||||
""" Create named pipe, and send stdin to it """
|
||||
# TODO: check_jids
|
||||
tmp_dir = tempfile.mkdtemp()
|
||||
fifopath = os.path.join(tmp_dir,"pipe_out")
|
||||
os.mkfifo(fifopath)
|
||||
|
|
@ -51,12 +53,6 @@ class PipeOut(base.CommandBase):
|
|||
shutil.rmtree(tmp_dir)
|
||||
self.host.quit()
|
||||
|
||||
def connected(self):
|
||||
# TODO: check_jids
|
||||
self.need_loop = True
|
||||
super(PipeOut, self).connected()
|
||||
self.pipe_out()
|
||||
|
||||
|
||||
class PipeIn(base.CommandAnswering):
|
||||
|
||||
|
|
@ -104,8 +100,7 @@ class PipeIn(base.CommandAnswering):
|
|||
shutil.rmtree(tmp_dir)
|
||||
self.host.quit()
|
||||
|
||||
def run(self):
|
||||
super(PipeIn, self).run()
|
||||
def start(self):
|
||||
self.bare_jids = [jid.JID(jid_).bare for jid_ in self.args.jids]
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue