--- pymsn-t/src/legacy/glue.py	2008-09-19 10:53:30.000000000 +0200
+++ pymsn-t/src/legacy/glue.py	2008-09-19 10:52:38.000000000 +0200
@@ -379,7 +379,13 @@
 		self.session.removeMe()
 	
 	def connectionLost(self, reason):
-		LogEvent(INFO, self.jabberID)
+ 		LogEvent(INFO, self.jabberID)
+		# If we got a second referral, don't really log out but let the next NS
+		# try to log us in
+		if reason.type == error.ConnectionDone and self.gotadditionalXFR != 0:
+			LogEvent(INFO, self.ident)
+			self.gotadditionalXFR = 0
+			return
 		if reason.type != error.ConnectionDone:
 			text = lang.get(self.session.lang).msnDisconnected % reason
 			self.session.sendMessage(to=self.jabberID, fro=config.jid, body=text)
--- pymsn-t/src/legacy/msn/msn.py	2008-09-19 10:53:30.000000000 +0200
+++ pymsn-t/src/legacy/msn/msn.py	2008-09-19 10:52:38.000000000 +0200
@@ -1347,7 +1347,9 @@
             port = MSN_PORT
 
         if not self._fireCallback(id, host, int(port), params[4]):
-            raise MSNProtocolError, "Got XFR (referral) that I didn't ask for .. should this happen?" # debug
+            #raise MSNProtocolError, "Got XFR (referral) that I didn't ask for .. should this happen?" # debug
+			self.factory.msncon.gotadditionalXFR = 1
+			self.factory.msncon.connectors.append(reactor.connectTCP(host, int(port), self.factory, bindAddress=(self.factory.msncon.BINDADDRESS, 0)))
 
     def handle_RNG(self, params):
         checkParamLen(len(params), 6, 'RNG')
--- pymsn-t/src/legacy/msn/msnw.py	2008-09-19 10:53:30.000000000 +0200
+++ pymsn-t/src/legacy/msn/msnw.py	2008-09-19 10:52:38.000000000 +0200
@@ -67,8 +67,9 @@
 		LogEvent(INFO, self.ident)
 	
 	def _gotNotificationReferral(self, (host, port)):
-		self.timeout.cancel()
-		self.timeout = None
+		if self.timeout != None:
+			self.timeout.cancel()
+			self.timeout = None
 		# Create the NotificationClient
 		self.notificationFactory = msn.NotificationFactory()
 		self.notificationFactory.userHandle = self.username