X-Git-Url: https://code.delx.au/pymsnt/blobdiff_plain/ae545380a189672a3e8ef1612f5650a01a750e8c..589315dd747b43621d6a67887e597c6d53f64e4c:/src/tlib/msn/msnw.py diff --git a/src/tlib/msn/msnw.py b/src/tlib/msn/msnw.py index 0b4f427..b0edb30 100644 --- a/src/tlib/msn/msnw.py +++ b/src/tlib/msn/msnw.py @@ -52,7 +52,7 @@ class MSNConnection: def timeout(): self.timeout = None if not d.called: - d.errback() + d.errback("Timeout") self.logOut() # Clean up everything self.timeout = reactor.callLater(30, timeout) dispatchFactory = msn.DispatchFactory() @@ -78,7 +78,6 @@ class MSNConnection: def _sendSavedEvents(self): self.savedEvents.send(self) - self.savedEvents = None def _notificationClientReady(self, notificationClient): self.notificationClient = notificationClient @@ -177,8 +176,8 @@ class MSNConnection: if self.notificationClient: LogEvent(INFO, self.ident) self.notificationClient.changeAvatar(imageData, push=True) - else: - self.savedEvents.avatarImageData = imageData + # Save the avatar for reuse on disconnection + self.savedEvents.avatarImageData = imageData def changeStatus(self, statusCode, screenName, personal): """ @@ -203,10 +202,10 @@ class MSNConnection: self.notificationClient.changeStatus(statusCode.encode("utf-8")).addCallback(cb) self.notificationClient.changeScreenName(screenName.encode("utf-8")).addCallback(cb) self.notificationClient.changePersonalMessage(personal.encode("utf-8")).addCallback(cb) - else: - self.savedEvents.statusCode = statusCode - self.savedEvents.screenName = screenName - self.savedEvents.personal = personal + # Remember the saved status + self.savedEvents.statusCode = statusCode + self.savedEvents.screenName = screenName + self.savedEvents.personal = personal def addContact(self, listType, userHandle): """ See msn.NotificationClient.addContact """ @@ -376,11 +375,13 @@ 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) msn.NotificationClient.connectionLost(self, reason) - self.factory.msncon.connectionLost(reason) + if self.factory.maxRetries >= self.factory.retries: + self.factory.msncon.connectionLost(reason) # Make sure this event is handled after any others reactor.callLater(0, wait)