comparison frontends/src/quick_frontend/quick_app.py @ 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
278 self.current_action_ids_cb = {} 278 self.current_action_ids_cb = {}
279 279
280 timestamp = extra.get('archive') 280 timestamp = extra.get('archive')
281 self.chat_wins[win.bare].printMessage(from_jid, msg, profile, float(timestamp) if timestamp else '') 281 self.chat_wins[win.bare].printMessage(from_jid, msg, profile, float(timestamp) if timestamp else '')
282 282
283 def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, profile_key="@NONE@"): 283 def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, callback=None, errback=None, profile_key="@NONE@"):
284 if to_jid.startswith(Const.PRIVATE_PREFIX): 284 if to_jid.startswith(Const.PRIVATE_PREFIX):
285 to_jid = unescapePrivate(to_jid) 285 to_jid = unescapePrivate(to_jid)
286 mess_type = "chat" 286 mess_type = "chat"
287 self.bridge.sendMessage(to_jid, message, subject, mess_type, extra, profile_key) 287 if callback is None:
288 callback = lambda: None
289 if errback is None:
290 errback = lambda failure: self.showDialog(unicode(failure), _(u"sendMessage Error"), "error")
291 self.bridge.sendMessage(to_jid, message, subject, mess_type, extra, profile_key, callback=callback, errback=errback)
288 292
289 def newAlert(self, msg, title, alert_type, profile): 293 def newAlert(self, msg, title, alert_type, profile):
290 if not self.check_profile(profile): 294 if not self.check_profile(profile):
291 return 295 return
292 assert alert_type in ['INFO','ERROR'] 296 assert alert_type in ['INFO','ERROR']