[Nym3-commit] r81 - trunk

nym3-devel@lists.noreply.org nym3-devel@lists.noreply.org
Wed, 04 Aug 2004 20:25:45 +0200


Author: laurent
Date: 2004-08-04 20:25:42 +0200 (Wed, 04 Aug 2004)
New Revision: 81

Modified:
   trunk/User.py
Log:
If you commit, it *should* at least remotely compile.


Modified: trunk/User.py
===================================================================
--- trunk/User.py	2004-08-04 17:27:57 UTC (rev 80)
+++ trunk/User.py	2004-08-04 18:25:42 UTC (rev 81)
@@ -286,31 +286,32 @@
         self.load_synbox()
         self.syn[i:j]=[self.blobify(syn[i:j])]
 
-    def sendList(self,num,after):
+    def sendList(self, num, after):
         """returns a list of (bf, synblob)
         in the process of creating it ca modify the synbox,
         doing some encryption"""
         def hasMail(midIdx, l):
             return self.mbox.has_key(l[midIdx])
-        def addBlob(slist,mlist, ilist, blob):
+        def addBlob(slist, mlist, ilist, blob):
             """append to slist (BF,blob)
             BF is the bitfield obtained from the elements e of ilist
             which verifies : the mid mlist[e] has a mail"""
             def test(midx):
-                hasMail(midx,mlist)
-            slist.append(Mail.bf(filter(test,ilist)),sy)
+                hasMail(midx, mlist)
+            slist.append(Mail.bf(filter(test, ilist)), sy)
+	    # WTF IS sy ?? TODO.
         #the list of the mid after "after"
-        midList=nymUser.midAfter(after)
+        midList = nymUser.midAfter(after)
         #load the structures
-        nymUser.load_index()
-        nymUser.load_synbox()
-        nymUser.load_mbox()
+        self._load_index()
+        self._load_synbox()
+        self._load_mbox()
         #we just need the num first
-        midList=midList[:num]
+        midList = midList[:num]
                     
         #create a list of blobs containing the mid in midlist
-        clearListEmpty=True #is there any non encrypted synopses between bInf and the current i, or bSup that need to be sent?  
-        sendList=[] #result list
+        clearListEmpty = True #is there any non encrypted synopses between bInf and the current i, or bSup that need to be sent?  
+        sendList = [] #result list
         
         try:
             i, _ = self.getSyn(midList[0])
@@ -321,29 +322,29 @@
         while(midList):
             #look for the synblob containing midList[0]
             (ml, status, synblob) = self.syn[i]
-            if(status == 'clear'):
-                if(clearListEmpty):
-                    bInf=i
+            if (status == 'clear'):
+                if (clearListEmpty):
+                    bInf = i
                     clearListEmpty = False
-                if( i + 1 - bInf == 16):
-                    self.encryptSyn(bInf,i+1)
+                if (i + 1 - bInf == 16):
+                    self.encryptSyn(bInf, i + 1)
                     clearListEmpty = True
-                    (m,_,sy) = self.[bInf]
-                    addBlob(sendList,m,range(len(m)),sy)
+                    (m, _, sy) = self.syn[bInf]
+                    addBlob(sendList, m, range(len(m)), sy)
                 else:
-                    bSup=i+1
-                del(midList[0])
-            elif(status == 'encrypted'):
-                if(not clearListEmpty):
-                    self.encryptSyn(bInf,bSup)
+                    bSup = i+1
+                del midList[0]
+            elif (status == 'encrypted'):
+                if (not clearListEmpty):
+                    self.encryptSyn(bInf, bSup)
                     clearListEmpty = True
                     (m,_,sy) = self.syn[bInf]
-                    addBlob(sendList,m,range(len(m)),sy)
+                    addBlob(sendList, m, range(len(m)), sy)
                 #idxList=[ml.index(midList[0])]
                 def test(midx):
-                    return (self.timecmp(num,midx)<0)
+                    return (self.timecmp(num, midx) < 0)
                 #idxList contains the mid in ml older than num
-                idxList=filter(test,ml)
+                idxList = filter(test, ml)
                 #remove from the midList the mid from idxList
                 for j in idxList:
                     try:
@@ -353,20 +354,18 @@
                 tlist = []
                 for j in idxList:
                     tlist.append(ml.index(j))
-                addBlob(sendList,ml,tList,synblob)
+                addBlob(sendList, ml, tList, synblob)
             else:
                 #this should not happen
                 raise 'Bug'
-            i=i+1
+            i = i + 1
         #if clearList isn't empty
-        if(not clearListEmpty):
-            self.encryptSyn(bInf,bSup) 
-            (m,_,sy) = nymUser.syn[bInf]
-            addBlob(sendList,m,range(len(m)),sy)
+        if (not clearListEmpty):
+            self.encryptSyn(bInf, bSup) 
+            (m, _, sy) = nymUser.syn[bInf]
+            addBlob(sendList, m, range(len(m)), sy)
         return sendList
-    
 
-
 if __name__ == '__main__':
     a = User('laurent')
     ec = a.relay("NYM3 TEST : " + repr(time.time()))