]> code.delx.au - pymsnt/commitdiff
Fixed bug with 64bit archictectures.
authorJames Bunton <jamesbunton@fastmail.fm>
Tue, 3 Jul 2007 03:55:23 +0000 (13:55 +1000)
committerJames Bunton <jamesbunton@fastmail.fm>
Tue, 3 Jul 2007 03:55:23 +0000 (13:55 +1000)
src/legacy/msn/msn.py
src/legacy/msn/test_msn.py

index 835106cebd0caaa409c07e126c6fbcc5559ba581..41b007176050bc98ae972f1189d9c58975466319 100644 (file)
@@ -113,6 +113,7 @@ MSN_MAX_MESSAGE      = 1664               # max message length
 MSN_CVR_STR          = "0x040c winnt 5.1 i386 MSNMSGR 7.0.0777 msmsgs"
 MSN_AVATAR_GUID      = "{A4268EEC-FEC5-49E5-95C3-F126696BDBF6}"
 MSN_MSNFTP_GUID      = "{5D3E02AB-6190-11D3-BBBB-00C04F795683}"
+MSN_MAXINT           = 2**31 - 1
 
 # auth constants
 LOGIN_SUCCESS  = 1
@@ -2686,7 +2687,7 @@ class SeqID:
         if baseID:
             self.baseID = baseID
         else:
-            self.baseID = random.randint(1000, sys.maxint)
+            self.baseID = random.randint(1000, MSN_MAXINT)
         self.pos = -1
 
     def get(self):
@@ -2713,7 +2714,7 @@ class SLPLink:
     def __init__(self, remoteUser, switchboard, sessionID, sessionGuid):
         self.dataFlag = 0
         if not sessionID:
-            sessionID = random.randint(1000, sys.maxint)
+            sessionID = random.randint(1000, MSN_MAXINT)
         if not sessionGuid:
             sessionGuid = random_guid()
         self.remoteUser = remoteUser
@@ -2759,7 +2760,7 @@ class SLPLink:
         binaryFields[1] = self.seqID.next()
         binaryFields[3] = len(msgStr)
         binaryFields[4] = binaryFields[3]
-        binaryFields[6] = random.randint(1000, sys.maxint)
+        binaryFields[6] = random.randint(1000, MSN_MAXINT)
         self.sendP2PMessage(binaryFields, msgStr)
 
     def sendP2PMessage(self, binaryFields, msgStr):
@@ -2793,7 +2794,7 @@ class SLPLink_Send(SLPLink):
         binaryFields[1] = self.seqID.next()
         binaryFields[3] = 4
         binaryFields[4] = 4
-        binaryFields[6] = random.randint(1000, sys.maxint)
+        binaryFields[6] = random.randint(1000, MSN_MAXINT)
         binaryFields[9] = 1
         self.sendP2PMessage(binaryFields, chr(0) * 4)
 
@@ -2823,7 +2824,7 @@ class SLPLink_Send(SLPLink):
         binaryFields[3] = self.filesize
         binaryFields[4] = len(chunk)
         binaryFields[5] = self.dataFlag
-        binaryFields[6] = random.randint(1000, sys.maxint)
+        binaryFields[6] = random.randint(1000, MSN_MAXINT)
         binaryFields[9] = 1
         self.offset += len(chunk)
         self.sendP2PMessage(binaryFields, chunk)
index ace4464ebdefee30fbd6c5e938b03db990c0f2e5..b1548be1110ebd401c667e461f94b967c16a2585 100644 (file)
@@ -1009,7 +1009,7 @@ class SwitchboardP2PTests(unittest.TestCase):
     def _generateData(self):
         data = ''
         for i in xrange(3000):
-            data += struct.pack("<L", random.randint(0, sys.maxint))
+            data += struct.pack("<L", random.randint(0, msn.MSN_MAXINT))
         return data
     
     def testAvatars(self):