diff sat/plugins/plugin_xep_0045.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 be6d91572633
children 813595f88612
line wrap: on
line diff
--- a/sat/plugins/plugin_xep_0045.py	Thu Jun 03 15:21:43 2021 +0200
+++ b/sat/plugins/plugin_xep_0045.py	Thu Jun 03 15:21:43 2021 +0200
@@ -837,7 +837,8 @@
             elif client.muc_service is not None:
                 service = client.muc_service
             else:
-                msg = D_("No known default MUC service".format(unparsed))
+                msg = D_("No known default MUC service {unparsed}").format(
+                    unparsed=unparsed)
                 self.text_cmds.feedBack(client, msg, mess_data)
                 return False
         except jid.InvalidFormat:
@@ -1298,7 +1299,9 @@
         except AttributeError:
             mess_data = self.client.messageProt.parseMessage(message.element)
         if mess_data['message'] or mess_data['subject']:
-            return self.host.memory.addToHistory(self.client, mess_data)
+            return defer.ensureDeferred(
+                self.host.memory.addToHistory(self.client, mess_data)
+            )
         else:
             return defer.succeed(None)