From 7738a01311bdac1575dea89bda9eb9dac55debc0 Mon Sep 17 00:00:00 2001 From: mathieui Date: Tue, 7 Aug 2018 23:20:38 +0200 Subject: Fix TLS with python 3.7 Use the "new" sslproto API instead of the deprecated TLS API. Also remove the unused "socket" parameter in XMLStream.__init__. --- slixmpp/features/feature_starttls/starttls.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'slixmpp/features/feature_starttls/starttls.py') diff --git a/slixmpp/features/feature_starttls/starttls.py b/slixmpp/features/feature_starttls/starttls.py index d472dad7..7e3af992 100644 --- a/slixmpp/features/feature_starttls/starttls.py +++ b/slixmpp/features/feature_starttls/starttls.py @@ -12,7 +12,7 @@ from slixmpp.stanza import StreamFeatures from slixmpp.xmlstream import register_stanza_plugin from slixmpp.plugins import BasePlugin from slixmpp.xmlstream.matcher import MatchXPath -from slixmpp.xmlstream.handler import Callback +from slixmpp.xmlstream.handler import CoroutineCallback from slixmpp.features.feature_starttls import stanza @@ -28,7 +28,7 @@ class FeatureSTARTTLS(BasePlugin): def plugin_init(self): self.xmpp.register_handler( - Callback('STARTTLS Proceed', + CoroutineCallback('STARTTLS Proceed', MatchXPath(stanza.Proceed.tag_name()), self._handle_starttls_proceed, instream=True)) @@ -58,8 +58,8 @@ class FeatureSTARTTLS(BasePlugin): self.xmpp.send(features['starttls']) return True - def _handle_starttls_proceed(self, proceed): + async def _handle_starttls_proceed(self, proceed): """Restart the XML stream when TLS is accepted.""" log.debug("Starting TLS") - if self.xmpp.start_tls(): + if await self.xmpp.start_tls(): self.xmpp.features.add('starttls') -- cgit v1.2.3