[Nym3-commit] r166 - trunk/nym3/Server

laurent at conuropsis.org laurent at conuropsis.org
Thu Mar 31 19:25:18 CEST 2005


Author: laurent
Date: 2005-03-31 19:25:17 +0200 (Thu, 31 Mar 2005)
New Revision: 166

Modified:
   trunk/nym3/Server/Main.py
Log:
Get rid of numeric literals even more.


Modified: trunk/nym3/Server/Main.py
===================================================================
--- trunk/nym3/Server/Main.py	2005-03-31 17:17:43 UTC (rev 165)
+++ trunk/nym3/Server/Main.py	2005-03-31 17:25:17 UTC (rev 166)
@@ -1,4 +1,5 @@
-#!/usr/bin/env python2.3
+#!/usr/bin/python
+# -*- coding: iso-8859-1 -*-
 # $Id$
 #
 # Copyright (c) 2004,2005 Jean-René Reinhard <jr at komite.net>
@@ -136,30 +137,30 @@
                return
             comList = sr.readCommandCToSList()
             for com in comList:
-                if (com.ct() == 0):
+                if (com.ct() == Message.CToSCODE['Create']):
 		    #we ignore the Create command if it comes from the nymholder of an account, should we rise an error?
                     pass
                 #if the account is not initialized, or if it is already up we ignore Create2 messages
-                elif (com.ct() == 1):
+                elif (com.ct() == Message.CToSCODE['Create2']):
                     if (nymUser.isInitialized() and (not nymUser.isUp())):
                         if(nymUser.checkChallenge(com.cr)):
                             nymUser.setUp()
 		#other commands are only taken into account if the account is up
                 elif (nymUser.isUp()):
-                    if (com.ct() == 2):
+                    if (com.ct() == Message.CToSCODE['Surb']):
                         if( len(com.surbs) == 0):
                             nymUser.delSurbs()
                         else:
                             nymUser.addSurbs(com.surbs)
-                    elif (com.ct() == 3):
+                    elif (com.ct() == Message.CToSCODE['Newpk']):
                         nymUser.setKeys(com.kid,com.kenc)
-                    elif (com.ct() == 4):
+                    elif (com.ct() == Message.CToSCODE['Relay']):
                         ec = Mail.relay(com.rt,com.ri,com.body)
                         if (ec != 0):
                             print "mixminion exited abnormally with error code %d" % ec
                             sys.exit(2)
                             
-                    elif (com.ct() == 5):
+                    elif (com.ct() == Message.CToSCODE['Get']):
                         msgList = []
                         sendList = []
                         for m in com.l:
@@ -180,7 +181,7 @@
                         
                                 
                                 
-                    elif (com.ct() == 6):
+                    elif (com.ct() == Message.CToSCODE['Summarize']):
                         comList = []
                         sendList = nymUser.sendList(com.num, com.after)
                         mList = []
@@ -196,10 +197,10 @@
                             print "mixminion exited abnormally with error code %d" % ec
                             sys.exit(2)
 
-                    elif (com.ct() == 7):
+                    elif (com.ct() == Message.CToSCODE['Delete']):
                         for mid in com.l:
                             nymUser.delete_msg(mid)
-                    elif (com.ct() == 8):
+                    elif (com.ct() == Message.CToSCODE['Policy']):
                         if(com.opt in Common.userPolicy):
                             nymUser[com.opt] = com.val
                     else:



More information about the Nym3-commit mailing list