[Nym3-commit] r288 - trunk/nym3/Client

jr at conuropsis.org jr at conuropsis.org
Fri Jun 10 15:08:46 CEST 2005


Author: jr
Date: 2005-06-10 15:08:45 +0200 (Fri, 10 Jun 2005)
New Revision: 288

Modified:
   trunk/nym3/Client/Account.py
   trunk/nym3/Client/Main.py
Log:
the mbox is now a couple (hash, list): we had an order to the elements of the
mbox to index them more easily


Modified: trunk/nym3/Client/Account.py
===================================================================
--- trunk/nym3/Client/Account.py	2005-06-10 10:18:28 UTC (rev 287)
+++ trunk/nym3/Client/Account.py	2005-06-10 13:08:45 UTC (rev 288)
@@ -141,7 +141,8 @@
 	- data is the hash that contains all of this
 	- datafile() is the file where we pickle from and to the data hash
 	- synbox is the synopsis box, stored in synboxfile()
-	- mbox is self explanatory, stored in mboxfile()
+	- mbox is the couple of a hash mid to message and a list of the keys of
+	  the hash to order these keys, stored in mboxfile()
 	- a journal which is hash of seqno -> (message, time sent) and is
 	  pickled from/to journalfile()
 	- the keys used by the account. The actual keys are stored in the
@@ -178,7 +179,7 @@
 	    self.data_status = 'dirty'
 	    self.journal = {}
 	    self.journal_status = 'dirty'
-	    self.mbox = {}
+	    self.mbox = {}, []
 	    self.mbox_status = 'dirty'
 	    self.synbox = []
 	    self.synbox_status = 'dirty'
@@ -427,7 +428,8 @@
 
     def add_msg(self, mid, msg):
 	self._load_mbox()
-	self.mbox[mid] = msg
+	self.mbox[0][mid] = msg
+	self.mbox[1].append(mid)
 	self.mbox_status = "dirty"
 
     def add_enckey(self, key):

Modified: trunk/nym3/Client/Main.py
===================================================================
--- trunk/nym3/Client/Main.py	2005-06-10 10:18:28 UTC (rev 287)
+++ trunk/nym3/Client/Main.py	2005-06-10 13:08:45 UTC (rev 288)
@@ -494,7 +494,7 @@
     account = get_account_from_nickname(ui, config, nickname,
 	    "No nickname given, abort\nUse -n <nickname>")
     synbox = account.get_synbox()
-    mbox = account.get_mbox()
+    mbox = account.get_mbox()[0]
     secring = decode_secring(config, ui)
     for (midlist, bf, enc_synset) in synbox:
 	bflist = Mail.bf2list(bf)
@@ -522,7 +522,7 @@
     account = get_account_from_nickname(ui, config, nickname,
 	    "No nickname given, abort\nUse -n <nickname>")
     synbox = account.get_synbox()
-    mbox = account.get_mbox()
+    mbox = account.get_mbox()[0]
     secring = decode_secring(config, ui)
     for (midlist, bf, enc_synset) in synbox:
 	bflist = Mail.bf2list(bf)
@@ -549,11 +549,11 @@
 def list_mbox(ui, config, nickname = None):
     account = get_account_from_nickname(ui, config, nickname,
 	    "No nickname given, abort\nUse -n <nickname>")
-    mbox = account.get_mbox()
+    mbox, mids = account.get_mbox()
     secring = decode_secring(config, ui)
-    for mid in mbox.keys():
+    for i, mid in enumerate(mids):
 	clear = decipher_string(mbox[mid], secring, account['encKeys'])
-	ui.display("%s" % binascii.hexlify(mid))
+	ui.display("%d %s" % (i, binascii.hexlify(mid)))
 	ui.display(Mail.syn_summary(clear))
 
 def journal_time_cmp(a, b):
@@ -585,7 +585,7 @@
 	    "No nickname given, abort\nUse -n <nickname>")
     output_f = sys.stdout
     secring = decode_secring(config, ui)
-    mbox = account.get_mbox()
+    mbox = account.get_mbox()[0]
     if output != None:
 	try:
 	    output_f = open(output, "w")



More information about the Nym3-commit mailing list