]> code.delx.au - pymsnt/blobdiff - src/tlib/msn/msn.py
Fixed MSN protocol dump option.
[pymsnt] / src / tlib / msn / msn.py
index 199308621419af977b479860fbbc7990e1976328..13ec0916461127779ecc0b2c0642603dcc77797e 100644 (file)
@@ -154,16 +154,10 @@ STATUS_LUNCH   = 'LUN'
 
 PINGSPEED = 50.0
 
-DEBUGALL = True
 LINEDEBUG = False
 MESSAGEDEBUG = False
 MSNP2PDEBUG = False
 
-if DEBUGALL:
-    LINEDEBUG = True
-    MESSAGEDEBUG = True
-    MSNP2PDEBUG = True
-
 
 P2PSEQ = [-3, -2, 0, -1, 1, 2, 3, 4, 5, 6, 7, 8]
 def p2pseq(n):
@@ -346,7 +340,7 @@ class PassportLogin(HTTPClient):
     def connectionMade(self):
         self.sendCommand('GET', self.path)
         self.sendHeader('Authorization', 'Passport1.4 OrgVerb=GET,OrgURL=http://messenger.msn.com,' +
-                                         'sign-in=%s,pwd=%s,%s' % (quote(self.userHandle), self.passwd,self.authData))
+                                         'sign-in=%s,pwd=%s,%s' % (quote(self.userHandle), quote(self.passwd), self.authData))
         self.sendHeader('Host', self.host)
         self.endHeaders()
         self.headers = {}
@@ -487,10 +481,9 @@ class MSNObject:
     """
     def __init__(self, s=""):
         """ Pass a XML MSNObject string to parse it, or pass no arguments for a null MSNObject to be created. """
+        self.setNull()
         if s:
             self.parse(s)
-        else:
-            self.setNull()
     
     def setData(self, creator, imageData):
         """ Set the creator and imageData for this object """
@@ -2033,7 +2026,7 @@ class NotificationFactory(ReconnectingClientFactory):
     screenName = ''
     password = ''
     passportServer = 'https://nexus.passport.com/rdr/pprdr.asp'
-    status = 'FLN'
+    status = 'NLN'
     protocol = NotificationClient
     maxRetries = 5
 
@@ -2877,6 +2870,7 @@ class SLPLink_FileSend(SLPLink_Send):
             if slpMessage.status == "603":
                 self.acceptDeferred.callback((False,))
             if MSNP2PDEBUG: log.msg("SLPLink is over due to decline, error or BYE")
+            self.data = ""
             self.killLink()
 
     def wait_data_ack(self, packet):
@@ -3027,7 +3021,12 @@ class SLPLink_AvatarReceive(SLPLink_Receive):
         self.handlePacket = self.wait_dataprep
 
     def handleSLPMessage(self, slpMessage):
-        if slpMessage.status == "200":
+        if slpMessage.method == "INVITE": # The second invite
+            data = {"Bridge"      : "TCPv1",\
+                    "Listening"   : "false",\
+                    "Hashed-Nonce": "{00000000-0000-0000-0000-000000000000}"}
+            self.sendSLPMessage("200", "application/x-msnmsgr-transrespbody", data, branch=slpMessage.branch)
+        elif slpMessage.status == "200":
             pass
             #self.handlePacket = self.wait_dataprep # Moved upwards
         else:
@@ -3066,6 +3065,7 @@ errorCodes = {
     301 : "Too many FND responses",
     302 : "Not logged in",
 
+    400 : "Message not allowed",
     402 : "Error accessing contact list",
     403 : "Error accessing contact list",