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

jr at conuropsis.org jr at conuropsis.org
Tue Jun 14 21:53:33 CEST 2005


Author: jr
Date: 2005-06-14 21:53:31 +0200 (Tue, 14 Jun 2005)
New Revision: 300

Modified:
   trunk/nym3/Client/Account.py
   trunk/nym3/Client/Main.py
Log:
add "delete synopsesn the local synbox" command


Modified: trunk/nym3/Client/Account.py
===================================================================
--- trunk/nym3/Client/Account.py	2005-06-14 18:25:58 UTC (rev 299)
+++ trunk/nym3/Client/Account.py	2005-06-14 19:53:31 UTC (rev 300)
@@ -463,6 +463,17 @@
 	self.synbox[str(xnymseq)] = (mid, flag, syn)
 	self.synbox_status = "dirty"
 
+    def delete_syn(self, secring, mid):
+	self._decrypt_synbox(secring)
+	l = []
+	for i, (m, flag, syn) in self.synbox.iteritems():
+	    if m == mid:
+		l.append(i)
+	if len(l) > 0:
+	    self.synbox_status = "dirty"
+	for i in l:
+	    del(self.synbox[i])
+		
     def add_msg(self, mid, msg):
 	self._load_mbox()
 	#this ensures there is no more than one occurence of a mid in

Modified: trunk/nym3/Client/Main.py
===================================================================
--- trunk/nym3/Client/Main.py	2005-06-14 18:25:58 UTC (rev 299)
+++ trunk/nym3/Client/Main.py	2005-06-14 19:53:31 UTC (rev 300)
@@ -61,8 +61,9 @@
     \texport\t\tExport already fetched emails to a file
     \tresend-command\tResend a command that has been sent but not acknowledged
     \t\t\tyet
-    \tldelete\tDelete a message from the local mbox"""
-    
+    \tldelete\tDelete messages from the local mbox
+    \tldelete-syn\tDelete synopses from the local synbox"""
+
 class CLI:
     def __init__(self):
 	pass
@@ -613,11 +614,20 @@
 def ldelete(ui, config, nickname, args = []):
     account = get_account_from_nickname(ui, config, nickname,
 	    "No nickname given, abort\nUse -n <nickname>")
-    args = decode_message_references(args, ['mbox'],
+    mids = decode_message_references(args, ['mbox'],
 	        {'mbox': (build_mbox_index, (account,))})
-    for mid in args:
+    for mid in mids:
 	account.delete_msg(mid)
 
+def ldelete_syn(ui, config, nickname, args = []):
+    account = get_account_from_nickname(ui, config, nickname,
+	    "No nickname given, abort\nUse -n <nickname>")
+    mids = decode_message_references(args, ['syn'],
+	        {'syn': (build_syn_index, (ui, config, account))})
+    secring = decode_secring(config, ui)
+    for mid in mids:
+	account.delete_syn(secring, mid)
+
 def main(args):
     if len(args) < 2:
 	print usage_string
@@ -829,6 +839,16 @@
 	ldelete(ui, config, options.nickname, args)
 	sys.exit(0)
 
+    if args[1] == "ldelete-syn":
+	parser = OptionParser()
+	parser.add_option("-n", "--nickname", action = "store",
+			  dest = "nickname", help = "The nickname "
+			  "of the account whose emails to request")
+	(options, args) = parser.parse_args(args[2:])
+	ui = CLI()
+	config = Config.Config()
+	ldelete_syn(ui, config, options.nickname, args)
+	sys.exit(0)
 
 
 if __name__ == '__main__':



More information about the Nym3-commit mailing list