changeset 3238:199fc4c551e9

core (xmpp): use asDeferred for profileConnecting and profileConnected
author Goffi <goffi@goffi.org>
date Mon, 30 Mar 2020 19:59:12 +0200
parents b0c57c9a4bd8
children 4396bf14f5fc
files sat/core/xmpp.py
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sat/core/xmpp.py	Fri Mar 27 10:02:14 2020 +0100
+++ b/sat/core/xmpp.py	Mon Mar 30 19:59:12 2020 +0200
@@ -44,6 +44,7 @@
 from sat.memory import encryption
 from sat.memory import persistent
 from sat.tools import xml_tools
+from sat.tools import utils
 from sat.tools.common import data_format
 from zope.interface import implementer
 
@@ -121,7 +122,7 @@
             # profile connecting is called right now (before actually starting client)
             connecting_cb = getattr(plugin, "profileConnecting", None)
             if connecting_cb is not None:
-                yield connecting_cb(self)
+                yield utils.asDeferred(connecting_cb, self)
 
             # profile connected is called after client is ready and roster is got
             connected_cb = getattr(plugin, "profileConnected", None)
@@ -236,7 +237,7 @@
         # and print error message if any of them fails
         conn_cb_list = []
         for __, callback in plugin_conn_cb:
-            conn_cb_list.append(defer.maybeDeferred(callback, entity))
+            conn_cb_list.append(utils.asDeferred(callback, entity))
         list_d = defer.DeferredList(conn_cb_list)
 
         def logPluginResults(results):