[Nym3-commit] r240 - trunk/nym3/Client
laurent at conuropsis.org
laurent at conuropsis.org
Fri May 6 16:07:06 CEST 2005
Author: laurent
Date: 2005-05-06 16:07:04 +0200 (Fri, 06 May 2005)
New Revision: 240
Modified:
trunk/nym3/Client/Main.py
Log:
Added `send-surb' command.
Modified: trunk/nym3/Client/Main.py
===================================================================
--- trunk/nym3/Client/Main.py 2005-05-05 18:35:58 UTC (rev 239)
+++ trunk/nym3/Client/Main.py 2005-05-06 14:07:04 UTC (rev 240)
@@ -51,6 +51,7 @@
\tprocess\t\tProcess returning server messages
\tlist-syn\tList already fetched summaries
\tlist-mbox\tList already fetched emails
+ \tsend-surb\tSend SURBs
\texport\t\tExport already fetched emails to a file"""
class CLI:
@@ -355,6 +356,19 @@
idKey = _cr.pk_decode_private_key(secring.get_key(account['idKey']))
account.sendControl([getmsg], idKey)
+def SendSurb(ui, config, nickname = None, number = 42):
+ account = get_account_from_nickname(ui, config, nickname,
+ "No nickname given, abort\nUse -n <nickname>")
+ try:
+ secring = decode_secring(config, ui)
+ except Keyring.NewKeyring:
+ # The Keyring is new. That shouldn't happen
+ raise Exception('Bug keyring?')
+ idKey = _cr.pk_decode_private_key(secring.get_key(account['idKey']))
+ surbc = Message.Surb()
+ surbc.fromData(account.generateSurbs(number))
+ account.sendControl([surbc], idKey)
+
def list_syn(ui, config, nickname = None):
account = get_account_from_nickname(ui, config, nickname,
"No nickname given, abort\nUse -n <nickname>")
@@ -506,6 +520,20 @@
Get(ui, config, options.nickname, args)
sys.exit(0)
+ if args[1] == "send-surb":
+ parser = OptionParser()
+ parser.add_option("-n", "--nickname", action = "store",
+ dest = "nickname", help = "The nickname "
+ "of the account whose surbs to replenish")
+ parser.add_option("-N", "--number", action = "store",
+ dest = "number", help = "The number "
+ "of SURBs to send", type = "int", default = 42)
+ (options, args) = parser.parse_args(args[2:])
+ ui = CLI()
+ config = Config.Config()
+ SendSurb(ui, config, options.nickname, options.number)
+ sys.exit(0)
+
if args[1] == "process":
parser = OptionParser()
parser.add_option("-i", "--idtag", action = "store",
More information about the Nym3-commit
mailing list