diff sat/core/xmpp.py @ 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 cc3fea71c365
children b10d207f95f9
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):