From: jamesbunton Date: Thu, 8 Jun 2006 13:40:50 +0000 (+0000) Subject: Handle MSN error conditions X-Git-Url: https://code.delx.au/pymsnt/commitdiff_plain/6faa958d34a40175b4f831e53ed96a01df35d8da Handle MSN error conditions git-svn-id: http://delx.cjb.net/svn/pymsnt/trunk@173 55fbd22a-6204-0410-b2f0-b6c764c7e90a committer: jamesbunton --- diff --git a/src/tlib/msn/msn.py b/src/tlib/msn/msn.py index e1c1311..fcab164 100644 --- a/src/tlib/msn/msn.py +++ b/src/tlib/msn/msn.py @@ -2033,7 +2033,7 @@ class NotificationFactory(ReconnectingClientFactory): screenName = '' password = '' passportServer = 'https://nexus.passport.com/rdr/pprdr.asp' - status = 'FLN' + status = 'NLN' protocol = NotificationClient maxRetries = 5 diff --git a/src/tlib/msn/msnw.py b/src/tlib/msn/msnw.py index 214ecae..b5d47ca 100644 --- a/src/tlib/msn/msnw.py +++ b/src/tlib/msn/msnw.py @@ -193,15 +193,17 @@ class MSNConnection: if not statusCode: statusCode = msn.STATUS_ONLINE if not personal: personal = "" if self.notificationClient: - changeCount = [0] # Hack + changeCount = [0] # Hack for Python's limited scope :( def cb(ignored=None): changeCount[0] += 1 if changeCount[0] == 3: self.ourStatusChanged(statusCode, screenName, personal) + def errcb(ignored=None): + pass # FIXME, should we do something here? LogEvent(INFO, self.ident) - 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) + self.notificationClient.changeStatus(statusCode.encode("utf-8")).addCallbacks(cb, errcb) + self.notificationClient.changeScreenName(screenName.encode("utf-8")).addCallbacks(cb, errcb) + self.notificationClient.changePersonalMessage(personal.encode("utf-8")).addCallbacks(cb, errcb) # Remember the saved status self.savedEvents.statusCode = statusCode self.savedEvents.screenName = screenName @@ -560,7 +562,7 @@ class SwitchboardSessionBase(msn.SwitchboardClient): d = msn.SwitchboardClient.sendMessage(self, message) if not noerror: - d.addCallback(failedMessage) + d.addCallbacks(failedMessage, failedMessage) else: chunks = int(math.ceil(len(text) / float(MSNConnection.MAXMESSAGESIZE)))