]> code.delx.au - pymsnt/commitdiff
Fixed reconnecting problem (finally)
authorjamesbunton <jamesbunton@55fbd22a-6204-0410-b2f0-b6c764c7e90a>
Tue, 30 May 2006 14:58:22 +0000 (14:58 +0000)
committerjamesbunton <jamesbunton@55fbd22a-6204-0410-b2f0-b6c764c7e90a>
Tue, 30 May 2006 14:58:22 +0000 (14:58 +0000)
Don't report connectionLost(ConnectionDone)

git-svn-id: http://delx.cjb.net/svn/pymsnt/trunk@166 55fbd22a-6204-0410-b2f0-b6c764c7e90a

committer: jamesbunton <jamesbunton@55fbd22a-6204-0410-b2f0-b6c764c7e90a>

src/legacy/glue.py
src/tlib/msn/msnw.py

index c72cb7417bf87d85250293a4d023a0b42702cabc..19ab707471efa3202d0b1db4ab3abeae9d58ab5a 100644 (file)
@@ -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):
index 6bce798c301925e2cf45abb7da0f941e2497accd..214ecaec987b360966dc63c8b1b0b31e7bdc93f9 100644 (file)
@@ -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)