[Nym3-commit] r355 - in trunk/nymbaron: . Client

jr at conuropsis.org jr at conuropsis.org
Fri Oct 14 23:22:44 CEST 2005


Author: jr
Date: 2005-10-14 23:22:43 +0200 (Fri, 14 Oct 2005)
New Revision: 355

Modified:
   trunk/nymbaron/Client/Account.py
   trunk/nymbaron/Client/Main.py
   trunk/nymbaron/TODO
Log:
- add ldelete-journal command to the client
- remove useless calls to decode_secring
- print the receiver of a command processed from mprocess


Modified: trunk/nymbaron/Client/Account.py
===================================================================
--- trunk/nymbaron/Client/Account.py	2005-10-14 20:12:05 UTC (rev 354)
+++ trunk/nymbaron/Client/Account.py	2005-10-14 21:22:43 UTC (rev 355)
@@ -328,14 +328,15 @@
 	self.journal[seqno] = Crypto.nym_encrypt(clear, key)
 	self.journal_status = 'dirty'
 
-    def acknowledge(self, seqno_list):
+    def acknowledge(self, seqno_list, verbose = True):
 	if seqno_list == None or seqno_list == []: return
 	if self.journal_status == 'unloaded': self._load_journal()
 	for el in seqno_list:
 	    if self.journal.has_key(el):
 		del self.journal[el]
 		#TODO debugging cruft
-		print "acknowledged message : %s" % binascii.hexlify(el)
+		if verbose:
+		    print "acknowledged message : %s" % binascii.hexlify(el)
 		self.journal_status = 'dirty'
 
     def get_seqno(self):

Modified: trunk/nymbaron/Client/Main.py
===================================================================
--- trunk/nymbaron/Client/Main.py	2005-10-14 20:12:05 UTC (rev 354)
+++ trunk/nymbaron/Client/Main.py	2005-10-14 21:22:43 UTC (rev 355)
@@ -69,6 +69,7 @@
     \t\t\tyet
     \tldelete\t\tDelete messages from the local mbox
     \tldelete-syn\tDelete synopses from the local synbox
+    \tldelete-journal\tDelete journal items from the local journal
     \tlist-accounts\tList the accounts of the user
     \tpasswd\t\tChange the passphrase that protects the user keyring"""
 
@@ -665,10 +666,17 @@
 	        {'syn': (build_syn_index, (secring, account))})
     #if mids is empty, do nothing
     if not mids: return
-    secring = decode_secring(config, ui)
     for mid in mids:
 	account.delete_syn(secring, mid)
 
+def ldelete_journal(ui, config, nickname, args = []):
+    account = get_account_from_nickname(ui, config, nickname,
+	    "No nickname given, abort\nUse -n <nickname>")
+    secring = decode_secring(config, ui)
+    seqnos = decode_message_references(args, ['journal'],
+	        {'journal': (build_journal_index, (secring, account))})
+    account.acknowledge(seqnos, verbose = False)
+	
 def main(args):
     if len(args) < 2:
 	print usage_string
@@ -939,6 +947,21 @@
 	ldelete_syn(ui, config, options.nickname, args)
 	sys.exit(0)
 
+    if args[1] == "ldelete-journal":
+	parser = OptionParser(usage =
+	"""nymbaron ldelete-journal [options] [ref1 [ref2 [...]]]
+	Delete journal items present in the local journal. The references are
+	either sequence number or journal:N where N is the index provided by the
+	list-journal command.""")
+	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_journal(ui, config, options.nickname, args)
+	sys.exit(0)
+	
     if args[1] == "mprocess":
 	parser = OptionParser(usage =
 	"""nymbaron mprocess [options]
@@ -980,6 +1003,7 @@
 	#the message body
 	assert (not decmsg) or (decmsg[0] == '\n')
 	if decmsg: decmsg = decmsg[1:]
+	ui.display("Processing a packet addressed to " + nick)
 	processMessage(decmsg, config, ui, nick)
 	sys.exit(0)
 

Modified: trunk/nymbaron/TODO
===================================================================
--- trunk/nymbaron/TODO	2005-10-14 20:12:05 UTC (rev 354)
+++ trunk/nymbaron/TODO	2005-10-14 21:22:43 UTC (rev 355)
@@ -9,7 +9,7 @@
         X Abandoned
 
  o catch Ctrl-C interruption on passphrase input[client]
- - check every command that ask for user input can be interrupted cleanly
+ o check every command that ask for user input can be interrupted cleanly
    [client]
  - periodically scan for emails that need to be relayed [server]
  - periodically scan for synopses that have stayed that need to be encrypted



More information about the Nym3-commit mailing list