Mercurial > libervia-backend
diff src/core/sat_main.py @ 752:f49945d728de
core,bridge: sendMessage bridge method is now async
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 17 Dec 2013 01:46:45 +0100 |
parents | a0f4a80a6536 |
children | e3ad48a2aab2 |
line wrap: on
line diff
--- a/src/core/sat_main.py Tue Dec 17 00:56:39 2013 +0100 +++ b/src/core/sat_main.py Tue Dec 17 01:46:45 2013 +0100 @@ -509,7 +509,7 @@ def _sendMessage(self, to_s, msg, subject=None, mess_type='auto', extra={}, profile_key='@NONE@'): to_jid = jid.JID(to_s) #XXX: we need to use the dictionary comprehension because D-Bus return its own types, and pickle can't manage them. TODO: Need to find a better way - self.sendMessage(to_jid, msg, subject, mess_type, {unicode(key): unicode(value) for key, value in extra.items()}, profile_key=profile_key) + return self.sendMessage(to_jid, msg, subject, mess_type, {unicode(key): unicode(value) for key, value in extra.items()}, profile_key=profile_key) def sendMessage(self, to_jid, msg, subject=None, mess_type='auto', extra={}, no_trigger=False, profile_key='@NONE@'): #FIXME: check validity of recipient @@ -550,7 +550,7 @@ if not no_trigger: if not self.trigger.point("sendMessage", mess_data, treatments, profile): - return + return defer.succeed(None) debug(_("Sending jabber message of type [%(type)s] to %(to)s...") % {"type": mess_data["type"], "to": to_jid.full()}) mess_data['xml'] = domish.Element((None, 'message')) @@ -569,12 +569,14 @@ debug(text) elif e.check(AbortSendMessage): warning(text) + return e else: error("Unmanaged exception: %s" % text) return e treatments.addCallbacks(self.sendAndStoreMessage, sendErrback, [False, profile]) treatments.callback(mess_data) + return treatments def sendAndStoreMessage(self, mess_data, skip_send=False, profile=None): """Actually send and store the message to history, after all the treatments