comparison sat/plugins/plugin_xep_0033.py @ 3541:888109774673

core: various changes and fixes to work with new storage and D-Bus bridge: - fixes coroutines handling in various places - fixes types which are not serialised by Tx DBus - XEP-0384: call storage methods in main thread in XEP: Python OMEMO's Promise use thread which prevent the use of AsyncIO loop. To work around that, callLater is used to launch storage method in main thread. This is a temporary workaround, as Python OMEMO should get rid of Promise implementation and threads soon.
author Goffi <goffi@goffi.org>
date Thu, 03 Jun 2021 15:21:43 +0200
parents dcebc585c29f
children 944f51f9c2b4
comparison
equal deleted inserted replaced
3540:aa58451b77ba 3541:888109774673
154 154
155 def send(mess_data, skip_send=False): 155 def send(mess_data, skip_send=False):
156 d = defer.Deferred() 156 d = defer.Deferred()
157 if not skip_send: 157 if not skip_send:
158 d.addCallback(client.sendMessageData) 158 d.addCallback(client.sendMessageData)
159 d.addCallback(client.messageAddToHistory) 159 d.addCallback(
160 lambda ret: defer.ensureDeferred(client.messageAddToHistory(ret))
161 )
160 d.addCallback(client.messageSendToBridge) 162 d.addCallback(client.messageSendToBridge)
161 d.addErrback(lambda failure: failure.trap(exceptions.CancelError)) 163 d.addErrback(lambda failure: failure.trap(exceptions.CancelError))
162 return d.callback(mess_data) 164 return d.callback(mess_data)
163 165
164 def discoCallback(entities, to_jid_s): 166 def discoCallback(entities, to_jid_s):