Commit 2aeb05fd authored by putro's avatar putro

added separate updateNym function, and merged deleteNym function in it

parent f29f81a9
......@@ -49,10 +49,11 @@ def menu():
selection = raw_input("Enter\n\
1 to choose/select active nym\n\
2 to write a message (as active nym)\n\
3 to create or update a nym\n\
4 to delete a nym\n\
5 to create a new secret key\n\
6 to delete a secret key\n\
3 to create a nym\n\
4 to update a nym (i.e. set new subject...)\n\
5 to delete a nym\n\
6 to create a new secret key\n\
7 to delete a secret key\n\
q to quit\n\n\n")
# perform actions based on selection above
......@@ -66,9 +67,12 @@ def menu():
createNym()
menu()
elif selection == "4":
deleteNym()
updateNym()
menu()
elif selection == "5":
updateNym(delete=True)
menu()
elif selection == "6":
print "\nsecret keys in your keyring:"
gpgfuncts.listSecKeys()
print "\n"
......@@ -77,14 +81,14 @@ def menu():
gpgfuncts.listSecKeys()
pressKey()
menu()
elif selection == "6":
elif selection == "7":
sk = gpgfuncts.defineSecKey()
fp = sk["fingerprint"]
deleteKey(fp)
msg = "key of %s deleted" % sk["uids"][1]
config['last_message'] = msg
menu()
elif selection == "7":
elif selection == "8":
modifyConfig()
menu()
elif selection == "q":
......@@ -129,8 +133,8 @@ def createNym():
menu()
sendMixMsg(dest, emsg)
def deleteNym():
print "Choose nym to delete"
def updateNym(delete=False):
print "Choose nym to update/delete:"
askNym()
dest = "config@" + anym.domain
......@@ -139,15 +143,26 @@ def deleteNym():
menu()
if not gpgfuncts.selectKey(anym.name):
print "no key available, creating a new one for %s" % email
print "no key available for %s" % anym.name
menu()
if not anym['passphrase']:
pwd = askPassphrase()
else:
pwd = anym['passphrase']
if not delete:
subj_type = chooseSubjType(config)
subject = askSomething('Enter the subject you want to use with this nym: ')
configSection(anym.name, subject, subj_type)
writeConfig()
setActiveNym(anym.name)
else:
subj_type = "delete"
subject = "yes"
msg = prepareSetupMsg(gpgfuncts.selectSecKey(anym.name), "delete", "yes")
msg = prepareSetupMsg(gpgfuncts.selectSecKey(anym.name), subj_type, subject)
emsg = signCryptMsg(msg, dest, sign=anym.fp, passphrase=pwd)
if not emsg:
config['last_message'] = "Something went wrong while preparing the message, recipient key missing ???"
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment