]> code.delx.au - pymsnt/commitdiff
Data received after the connection has been cleaned up is now ignored (instead of...
authorjamesbunton <jamesbunton@55fbd22a-6204-0410-b2f0-b6c764c7e90a>
Tue, 2 May 2006 14:19:35 +0000 (14:19 +0000)
committerjamesbunton <jamesbunton@55fbd22a-6204-0410-b2f0-b6c764c7e90a>
Tue, 2 May 2006 14:19:35 +0000 (14:19 +0000)
Clean up properly when a switchboard dies (fixes exception if somebody logs on, an avatar retrieval starts, and then they log off before it finishes.)

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

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

src/tlib/msn/msn.py
src/tlib/msn/msnw.py

index 1ad7cfd9cd04ae06eff61f61a0be7817a3fe9792..373c5511e6021c359c675e0f992dccb1e7be3c16 100644 (file)
@@ -786,11 +786,12 @@ class MSNEventBase(LineReceiver):
         raise NotImplementedError
 
     def sendLine(self, line):
-        if LINEDEBUG: log.msg(">> " + line)
+        if LINEDEBUG: log.msg("<< " + line)
         LineReceiver.sendLine(self, line)
 
     def lineReceived(self, line):
-        if LINEDEBUG: log.msg("<< " + line)
+        if LINEDEBUG: log.msg(">> " + line)
+        if not self.connected: return
         if self.currentMessage:
             self.currentMessage.readPos += len(line+"\r\n")
             try:
@@ -827,6 +828,7 @@ class MSNEventBase(LineReceiver):
             self.handle_UNKNOWN(cmd, params.split(' '))
 
     def rawDataReceived(self, data):
+        if not self.connected: return
         extra = ""
         self.currentMessage.readPos += len(data)
         diff = self.currentMessage.readPos - self.currentMessage.length
index b9e3028115a25c4ca21afa6bfd2bc5d1d03b71ff..2241c22aab20b3c885233d305f26a95e7d0e04e0 100644 (file)
@@ -375,7 +375,6 @@ class NotificationClient(msn.NotificationClient):
                msn.NotificationClient.logOut(self)
        
        def connectionLost(self, reason):
-               print "NotificationClient.connectionLost!!!"
                if not self.factory.msncon: return # If we called logOut
                def wait():
                        LogEvent(INFO, self.factory.msncon.ident)
@@ -465,6 +464,11 @@ class SwitchboardSessionBase(msn.SwitchboardClient):
                LogEvent(INFO, self.ident)
                del self.msncon
                self.transport.disconnect()
+       
+       def connectionLost(self, reason):
+               self.msncon = None
+               self.msnobj = None
+               self.ident = (self.ident[0], self.ident[1] + " Disconnected!")
 
        def loggedIn(self):
                LogEvent(INFO, self.ident)