[Nym3-commit] r213 - trunk/nym3/Client
laurent at conuropsis.org
laurent at conuropsis.org
Sun May 1 17:19:36 CEST 2005
Author: laurent
Date: 2005-05-01 17:19:34 +0200 (Sun, 01 May 2005)
New Revision: 213
Modified:
trunk/nym3/Client/Main.py
Log:
Added DELETE client command.
Modified: trunk/nym3/Client/Main.py
===================================================================
--- trunk/nym3/Client/Main.py 2005-05-01 15:19:15 UTC (rev 212)
+++ trunk/nym3/Client/Main.py 2005-05-01 15:19:34 UTC (rev 213)
@@ -278,6 +278,33 @@
idKey = _cr.pk_decode_private_key(secring.get_key(account['idKey']))
account.sendControl([summ], idKey)
+def Delete(ui, config, nickname = None, midlist = None):
+ if not nickname:
+ ui.display("No nickname given, abort")
+ ui.display("Use -n <nickname>")
+ sys.exit(1)
+ account = None
+ try:
+ account = Account.Account(config, nickname)
+ except Account.NoSuchAccount:
+ ui.display("No account relative to the provided nickname, abort")
+ sys.exit(1)
+ delmsg = Message.Delete()
+ midlist = map(binascii.unhexlify, midlist)
+ delmsg.fromData(midlist)
+ try:
+ secring = Keyring.Keyring(config.secring_path)
+ ui.display("You need to provide your passphrase to unlock your keyring")
+ while True:
+ passphrase1 = ui.prompthidden("Passphrase")
+ if secring.decrypt(passphrase1): break
+ ui.display("wrong passphrase")
+ 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']))
+ account.sendControl([delmsg], idKey)
+
def main(args):
if len(args) < 2:
print "Usage: WRITEME"
@@ -340,6 +367,17 @@
Summarize(ui, config, options.nickname, options.max, options.older)
sys.exit(0)
+ if args[1] == "delete":
+ parser = OptionParser()
+ parser.add_option("-n", "--nickname", action = "store",
+ dest = "nickname", help = "The nickname "
+ "of the account whose emails to request deletion")
+ (options, args) = parser.parse_args(args[2:])
+ ui = CLI()
+ config = Config.Config()
+ Delete(ui, config, options.nickname, args)
+ sys.exit(0)
+
if args[1] == "process":
parser = OptionParser()
parser.add_option("-i", "--idtag", action = "store",
More information about the Nym3-commit
mailing list