Commit faa97526 authored by putro's avatar putro
Browse files

aggiunto il menu per delete e ripulito checks, eliminando InitialCheck e la...

aggiunto il menu per delete e ripulito checks, eliminando InitialCheck e la parte di command line parsing, per ora non usata
parent bd1b617a
......@@ -8,30 +8,6 @@ import subprocess
class MixError(Exception):
pass
def process_args():
""" Process command line arguments """
from optparse import OptionParser
use = "nymhelper.py [options] \nexcept for -C, all other options are ju" \
"st used to send a message from command line\nfor normal use do " \
"not use any options"
parser = OptionParser(usage=use)
parser.add_option("-C", "--config", action="store", dest="config",
default="config.ini",
help="config file to use nym to send the message from.")
parser.add_option("-n", "--nym", action="store", dest="nym", type="int",
help="nym to send the message from.")
parser.add_option("-s", "--subject", action="store", dest="subject",
help="subject for the message to be sent.")
parser.add_option("-r", "--recipient", action="store", dest="recipient",
help="recipient of the message to be sent.")
parser.add_option("-t", "--text", action="store", dest="text",
help="text of the message to be sent.")
parser.add_option("-c", "--chain", action="store", dest="chain",
help="remailer chain to send the message through \
(example: -c \"remailer1,remailer2\").")
return parser.parse_args()
def checkAscii(file):
""" Check if the a file is pure ascii """
import codecs
......@@ -51,15 +27,6 @@ def checkAscii(file):
f.close()
return bad
def InitialCheck():
global configfile
global opts, args
(opts, args) = process_args()
if opts.config:
configfile = os.path.dirname(sys.argv[0]) + "/" + opts.config
else:
configfile = os.path.dirname(sys.argv[0]) + "/config.ini"
def OptionsCheck(config):
......
......@@ -37,7 +37,7 @@ class bcolors:
def menu():
""" Print menu and wait for user choice """
os.system(['clear', 'cls'][os.name == 'nt'])
print bcolors.GREEN + "----- NYM HELPER -----" + bcolors.ENDC
print bcolors.GREEN + "----- AUTONYM - for zax type nyms -----" + bcolors.ENDC
if anym is False:
print bcolors.RED + "active nym: NONE"
else:
......@@ -50,7 +50,7 @@ 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 send the message created via local mixmaster\n\
3 to delete a nym\n\
4 to download fresh remailer stats and keys\n\
5 to choose remailers chain\n\
6 to create or update a nym\n\
......@@ -67,7 +67,8 @@ def menu():
writeMessage()
menu()
elif selection == "3":
sendMixMsg()
#sendMixMsg()
deleteNym()
menu()
elif selection == "4":
download(options.stats_rlist)
......@@ -149,6 +150,11 @@ def createNym():
sendMixMsg(dest, emsg)
#return
def deleteNym():
config['last_message'] = "Function not yet implemented"
#print "Choose nym to delete"
#askNym()
menu()
......@@ -249,9 +255,6 @@ def modifyConfig():
pass
checks.InitialCheck()
if checks.OptionsCheck(config) == True:
config['last_message'] = "OK, initial check passed"
......@@ -351,16 +354,8 @@ def checkBrokenChains(remailer_chain):
return False
try:
if checks.opts.nym:
writeSendMessage()
else:
parse_stats()
#for remailer in uptime_sort_m():
# print format_stats(remailer)
#for property, value in vars(stats_m['austria']).iteritems():
# print property, ": ", value
#pressKey()
menu()
parse_stats()
menu()
except KeyboardInterrupt:
......
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