[Nym3-commit] r424 - trunk/nymbaron/Client

jr at conuropsis.org jr at conuropsis.org
Tue Nov 22 20:21:55 CET 2005


Author: jr
Date: 2005-11-22 20:21:54 +0100 (Tue, 22 Nov 2005)
New Revision: 424

Modified:
   trunk/nymbaron/Client/Account.py
   trunk/nymbaron/Client/Main.py
Log:
- process the case N=0 accordingly to the specs in send-surb [client]


Modified: trunk/nymbaron/Client/Account.py
===================================================================
--- trunk/nymbaron/Client/Account.py	2005-11-20 22:32:54 UTC (rev 423)
+++ trunk/nymbaron/Client/Account.py	2005-11-22 19:21:54 UTC (rev 424)
@@ -248,6 +248,8 @@
     def generateSurbs(self, n):
         """Generate surbs"""
 	# TODO : this should be done via ClientAPI.
+	if n == 0:
+	    return ""
 	surbdir = tempfile.mkdtemp()
 	surbspath = surbdir + os.sep + "surbs"
 	mixcall = "mixminion generate-surb -t %s -b -n %d -o %s --identity='%s'"

Modified: trunk/nymbaron/Client/Main.py
===================================================================
--- trunk/nymbaron/Client/Main.py	2005-11-20 22:32:54 UTC (rev 423)
+++ trunk/nymbaron/Client/Main.py	2005-11-22 19:21:54 UTC (rev 424)
@@ -90,7 +90,7 @@
 	    if modified_tty:
 		raise KeyboardInterrupt()
 	    else:
-		print "Interrupted the User"
+		print "Interrupted by the User"
 		sys.exit(2)
 
     def promptmultiline(self, s):
@@ -557,7 +557,19 @@
 		(binascii.hexlify(seqno), d))
     
 def SendSurb(ui, config, nickname = None, number = None):
-    if not number: number = config.nb_surb
+    if number == 0:
+	answer = ui.prompt("Sending 0 surb to the server is interpreted as a" +
+		" request to erase the surb store the server uses to send you" +
+		" messages.\nDo you want to proceed (y/n)")
+	while True:
+	    if answer == "y":
+		break
+	    if answer == "n":
+		ui.display("Sending surb deletion command cancelled")
+		return
+	    answer = ui.prompt("You must answer 'y' or 'n'")
+    if number == None:
+	number = config.nb_surb
     account = get_account_from_nickname(ui, config, nickname,
 	    "No nickname given, abort\nUse -n <nickname>")
     secring = decode_secring(config, ui)
@@ -565,7 +577,12 @@
     surbc = Message.Surb()
     surbc.fromData(account.generateSurbs(number))
     account.sendControl([surbc], idKey, "send surbs")
-    ui.display("%d surbs sent" % number)
+    if number != 0:
+	ui.display("%d surbs sent" % number)
+    else:
+	ui.display("Surbs deletion request sent. Once it is processed you " +
+		"will have to send new surbs in order to be reachable by the " +
+		"server.")
 
 def list_syn(ui, config, nickname = None, summarize = True):
     account = get_account_from_nickname(ui, config, nickname,



More information about the Nym3-commit mailing list