core (xmpp): use asDeferred for profileConnecting and profileConnected

This commit is contained in:
Goffi 2020-03-30 19:59:12 +02:00
commit e8269d8f6a

View file

@ -44,6 +44,7 @@ from sat.core import exceptions
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 @@ class SatXMPPEntity:
# 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 @@ class SatXMPPEntity:
# 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):