comparison frontends/src/jp/jp @ 776:f89173f44850

frontends: fixed sendMessage calls, sendMessage is now async so callback and errback need to be specified + redraw in PrimivitusApp.notify
author Goffi <goffi@goffi.org>
date Fri, 03 Jan 2014 21:25:07 +0100
parents bfabeedbf32e
children 1fe00f0c9a91
comparison
equal deleted inserted replaced
775:ab66dac17d1f 776:f89173f44850
254 """Send incomming data on stdin to jabber contact""" 254 """Send incomming data on stdin to jabber contact"""
255 header = "\n" if self.options.new_line else "" 255 header = "\n" if self.options.new_line else ""
256 256
257 if self.options.separate: #we send stdin in several messages 257 if self.options.separate: #we send stdin in several messages
258 if header: 258 if header:
259 self.bridge.sendMessage(self.dest_jid, header, profile_key=self.profile) 259 self.bridge.sendMessage(self.dest_jid, header, profile_key=self.profile, callback=lambda: None, errback=lambda ignore: ignore)
260 while (True): 260 while (True):
261 line = clean_ustr(sys.stdin.readline().decode('utf-8','ignore')) 261 line = clean_ustr(sys.stdin.readline().decode('utf-8','ignore'))
262 if not line: 262 if not line:
263 break 263 break
264 self.bridge.sendMessage(self.dest_jid, line.replace("\n",""), profile_key=self.profile) 264 self.bridge.sendMessage(self.dest_jid, line.replace("\n",""), profile_key=self.profile, callback=lambda: None, errback=lambda ignore: ignore)
265 else: 265 else:
266 self.bridge.sendMessage(self.dest_jid, header + clean_ustr(u"".join([stream.decode('utf-8','ignore') for stream in sys.stdin.readlines()])), profile_key=self.profile) 266 self.bridge.sendMessage(self.dest_jid, header + clean_ustr(u"".join([stream.decode('utf-8','ignore') for stream in sys.stdin.readlines()])),
267 profile_key=self.profile, callback=lambda: None, errback=lambda ignore: ignore)
267 268
268 269
269 def pipe_out(self): 270 def pipe_out(self):
270 """Create named pipe, and send stdin to it""" 271 """Create named pipe, and send stdin to it"""
271 tmp_dir = tempfile.mkdtemp() 272 tmp_dir = tempfile.mkdtemp()