[Nym3-commit] r261 - trunk/nym3/Client
jr at conuropsis.org
jr at conuropsis.org
Thu May 19 21:13:29 CEST 2005
Author: jr
Date: 2005-05-19 21:13:27 +0200 (Thu, 19 May 2005)
New Revision: 261
Modified:
trunk/nym3/Client/Main.py
Log:
add a function that builds the correspondance X-Nym-Sequence -> mid
Modified: trunk/nym3/Client/Main.py
===================================================================
--- trunk/nym3/Client/Main.py 2005-05-19 15:46:52 UTC (rev 260)
+++ trunk/nym3/Client/Main.py 2005-05-19 19:13:27 UTC (rev 261)
@@ -133,6 +133,32 @@
ui.display("No account relative to the provided nickname, abort")
sys.exit(1)
+def build_index(ui, config, account):
+ """Builds the index of synopses of the given account, using ui to get
+ the password to decrypt the keyring. Returns a hash containing the
+ correspondance seqNo -> mid"""
+ synbox = account.get_synbox()
+ secring = decode_secring(config, ui)
+ index = {}
+ for (midlist, bf, enc_synset) in synbox:
+ bflist = Mail.bf2list(bf)
+ synset = decipher_string(enc_synset, secring, account['encKeys'])
+ if synset == None:
+ ui.display("unable to decipher a synopses blob, lost keys?")
+ #TODO remove the blob?
+ #TODO if yes remove the following line
+ else:
+ for mid in enumerate(midlist):
+ synlen = Message.strToIntBE(synset[20: 22])
+ syn = synset[22: 22 + synlen]
+ synset = synset[22 + synlen:]
+ try:
+ index[Mail.XNymSeq(syn)] = mid
+ except:
+ #there was a problem determining the XNymSeq: bug
+ raise Exception("unable to determine XNymSeq")
+ return index
+
def processMessage(msg, config, ui, nickname):
"""process incoming control message"""
More information about the Nym3-commit
mailing list