diff frontends/src/jp/cmd_pipe.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
line wrap: on
line diff
--- a/frontends/src/jp/cmd_pipe.py	Mon Feb 29 16:52:51 2016 +0100
+++ b/frontends/src/jp/cmd_pipe.py	Mon Feb 29 16:52:51 2016 +0100
@@ -36,12 +36,14 @@
 
     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 @@
         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 @@
             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]