[Nym3-commit] r200 - trunk/nym3/Client

laurent at conuropsis.org laurent at conuropsis.org
Wed Apr 27 21:54:28 CEST 2005


Author: laurent
Date: 2005-04-27 21:54:27 +0200 (Wed, 27 Apr 2005)
New Revision: 200

Modified:
   trunk/nym3/Client/Main.py
Log:
Can feed a control message to the client by idtag or nickname now.


Modified: trunk/nym3/Client/Main.py
===================================================================
--- trunk/nym3/Client/Main.py	2005-04-27 16:26:05 UTC (rev 199)
+++ trunk/nym3/Client/Main.py	2005-04-27 19:54:27 UTC (rev 200)
@@ -77,7 +77,7 @@
     def display(self, s):
 	print s
 
-def processMessage(msg, config, ui, idtag):
+def processMessage(msg, config, ui, nickname):
     """process incoming control message"""
       
     sr = Message.StrReader(msg)
@@ -201,23 +201,29 @@
 	setupAccount(config, ui, serverName = options.server, 
 		     usernamelist = myusernamelist,
 		     emailAddress = options.email, nickname = options.nickname)
+	sys.exit(1)
 
     if args[1] == "process":
 	parser = OptionParser()
 	parser.add_option("-i", "--idtag", action = "store",
 			  dest = "idtag", help = "The idTag contained in the"
 			  "enclosing SURB")
+	parser.add_option("-n", "--nickname", action = "store",
+			  dest = "nickname", help = "The nickname of the"
+			  "account to use")
 	parser.add_option("-f", "--file", action = "store",
 			  dest = "file", help = "The file to read the message"
 			  " from, or stdin if omitted")
 	(options, args) = parser.parse_args(args[2:])
 	ui = CLI()
-	if not options.idtag:
-	    ui.display("Must provide an idTag")
+	if (not options.idtag) and (not options.nickname):
+	    ui.display("Must provide an idTag or a nickname")
 	    sys.exit(1)
 	config = Config.Config() # TODO load from file
-	tm = Account.TagMap(config.path + os.sep + 'tagmap')
-	nick = tm.nickFromId(options.idtag)
+	if options.nickname: nick= options.nickname
+	else:
+	    tm = Account.TagMap(config.path + os.sep + 'tagmap')
+	    nick = tm.nickFromId(options.idtag)
 	if options.file:
 	    try:
 		f = open(options.file, "r")



More information about the Nym3-commit mailing list