diff 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
line wrap: on
line diff
--- a/frontends/src/quick_frontend/quick_app.py	Sun Dec 29 17:48:14 2013 +0100
+++ b/frontends/src/quick_frontend/quick_app.py	Fri Jan 03 21:25:07 2014 +0100
@@ -280,11 +280,15 @@
         timestamp = extra.get('archive')
         self.chat_wins[win.bare].printMessage(from_jid, msg, profile, float(timestamp) if timestamp else '')
 
-    def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, profile_key="@NONE@"):
+    def sendMessage(self, to_jid, message, subject='', mess_type="auto", extra={}, callback=None, errback=None, profile_key="@NONE@"):
         if to_jid.startswith(Const.PRIVATE_PREFIX):
             to_jid = unescapePrivate(to_jid)
             mess_type = "chat"
-        self.bridge.sendMessage(to_jid, message, subject, mess_type, extra, profile_key)
+        if callback is None:
+            callback = lambda: None
+        if errback is None:
+            errback = lambda failure: self.showDialog(unicode(failure), _(u"sendMessage Error"), "error")
+        self.bridge.sendMessage(to_jid, message, subject, mess_type, extra, profile_key, callback=callback, errback=errback)
 
     def newAlert(self, msg, title, alert_type, profile):
         if not self.check_profile(profile):