]> code.delx.au - pymsnt/commitdiff
Handle MSN error conditions
authorjamesbunton <jamesbunton@55fbd22a-6204-0410-b2f0-b6c764c7e90a>
Thu, 8 Jun 2006 13:40:50 +0000 (13:40 +0000)
committerjamesbunton <jamesbunton@55fbd22a-6204-0410-b2f0-b6c764c7e90a>
Thu, 8 Jun 2006 13:40:50 +0000 (13:40 +0000)
git-svn-id: http://delx.cjb.net/svn/pymsnt/trunk@173 55fbd22a-6204-0410-b2f0-b6c764c7e90a

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

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

index e1c13119b20d5234b5d56dda338460c98d665e21..fcab164707075d7226403463c5bf87c342695b07 100644 (file)
@@ -2033,7 +2033,7 @@ class NotificationFactory(ReconnectingClientFactory):
     screenName = ''
     password = ''
     passportServer = 'https://nexus.passport.com/rdr/pprdr.asp'
     screenName = ''
     password = ''
     passportServer = 'https://nexus.passport.com/rdr/pprdr.asp'
-    status = 'FLN'
+    status = 'NLN'
     protocol = NotificationClient
     maxRetries = 5
 
     protocol = NotificationClient
     maxRetries = 5
 
index 214ecaec987b360966dc63c8b1b0b31e7bdc93f9..b5d47caf93b9c188bc6183aabd0cf7a0242b16f9 100644 (file)
@@ -193,15 +193,17 @@ class MSNConnection:
                if not statusCode: statusCode = msn.STATUS_ONLINE
                if not personal: personal = ""
                if self.notificationClient:
                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 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)
                        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
                # 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 = 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)))
 
                        else:
                                chunks = int(math.ceil(len(text) / float(MSNConnection.MAXMESSAGESIZE)))