From 20bbfc267efba9417782d1c38f8db012b6c490f6 Mon Sep 17 00:00:00 2001 From: c0d3d3v Date: Wed, 26 Apr 2023 13:53:36 +0200 Subject: [PATCH] Fix Xmpp login check --- moodle_dl/notifications/xmpp/xmpp_shooter.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/moodle_dl/notifications/xmpp/xmpp_shooter.py b/moodle_dl/notifications/xmpp/xmpp_shooter.py index ff2bc2c6..e0334d0d 100644 --- a/moodle_dl/notifications/xmpp/xmpp_shooter.py +++ b/moodle_dl/notifications/xmpp/xmpp_shooter.py @@ -15,6 +15,8 @@ def send(self, message): if not self.is_connected: self.connection.connect() self.connection.auth(user=self.jid.getNode(), password=self.password, resource=self.jid.getResource()) + if not hasattr(self.connection, 'Bind') or getattr(self.connection, 'Bind').session != 1: + raise ConnectionError('XMPP Session could not be opend') self.is_connected = True self.connection.send(xmpp.protocol.Message(to=self.recipient, body=message))