From: jamesbunton Date: Tue, 30 May 2006 14:58:22 +0000 (+0000) Subject: Fixed reconnecting problem (finally) X-Git-Url: https://code.delx.au/pymsnt/commitdiff_plain/ff477e0e892fab8043bda4d96a5498d09136f3ac Fixed reconnecting problem (finally) Don't report connectionLost(ConnectionDone) git-svn-id: http://delx.cjb.net/svn/pymsnt/trunk@166 55fbd22a-6204-0410-b2f0-b6c764c7e90a committer: jamesbunton --- diff --git a/src/legacy/glue.py b/src/legacy/glue.py index c72cb74..19ab707 100644 --- a/src/legacy/glue.py +++ b/src/legacy/glue.py @@ -3,7 +3,7 @@ import os.path import utils -from twisted.internet import task +from twisted.internet import task, error from tlib.xmlw import Element from tlib import msn from debug import LogEvent, INFO, WARN, ERROR @@ -378,8 +378,9 @@ class LegacyConnection(msn.MSNConnection): def connectionLost(self, reason): LogEvent(INFO, self.jabberID) - text = lang.get(self.session.lang).msnDisconnected % reason - self.session.sendMessage(to=self.jabberID, fro=config.jid, body=text) + if reason.type != error.ConnectionDone: + text = lang.get(self.session.lang).msnDisconnected % reason + self.session.sendMessage(to=self.jabberID, fro=config.jid, body=text) self.session.removeMe() # Tear down the session def multipleLogin(self): diff --git a/src/tlib/msn/msnw.py b/src/tlib/msn/msnw.py index 6bce798..214ecae 100644 --- a/src/tlib/msn/msnw.py +++ b/src/tlib/msn/msnw.py @@ -229,6 +229,7 @@ class MSNConnection: for c in self.connectors: c.disconnect() if self.notificationFactory: + self.notificationFactory.stopTrying() self.notificationFactory.msncon = None self.connectors = [] for sbs in self.switchboardSessions.values(): @@ -384,6 +385,10 @@ class NotificationClient(msn.NotificationClient): self.connectionLost = self.doDisconnect def connectionLost(self, reason): + if not self.factory.msncon: + # If MSNConnection.logOut is called before _notificationClientReady + return + def wait(): LogEvent(INFO, self.factory.msncon.ident) msn.NotificationClient.connectionLost(self, reason)