[Nym3-commit] r234 - in trunk/nym3: . Server

laurent at conuropsis.org laurent at conuropsis.org
Thu May 5 17:45:42 CEST 2005


Author: laurent
Date: 2005-05-05 17:45:40 +0200 (Thu, 05 May 2005)
New Revision: 234

Modified:
   trunk/nym3/Mail.py
   trunk/nym3/Server/Main.py
Log:
Server.Config has no business in Mail.py.


Modified: trunk/nym3/Mail.py
===================================================================
--- trunk/nym3/Mail.py	2005-05-05 15:15:32 UTC (rev 233)
+++ trunk/nym3/Mail.py	2005-05-05 15:45:40 UTC (rev 234)
@@ -32,7 +32,6 @@
 import string
 import email.Parser
 import nym3.Common as Common
-import nym3.Server.Config as Sconfig
 
 slen = 180
 """The length of a summary in bytes"""
@@ -89,14 +88,11 @@
     f.write(body)
     f.close()
     return fname
-	
     
 
 def bf(l):
-    """take a list of index and generate a bitfield
-    the k-bit is set to 1 if k is in l
-    the bitfield is a 2 octets big endian string
-    """
+    """take a list of index and generate a bitfield the k-bit is set to 1 if k
+       is in l the bitfield is a 2 octets big endian string"""
     t=[0,0]
     for k in [x for x in l if x<16 and x >=0]:
         (q,r)=divmod(k,8)
@@ -120,12 +116,12 @@
     (q, r) = divmod(i, 16)
     return hex(q)[2:] + hex(r)[2:]
 
-def relay(nym, rt, ri, body):
+def relay(nym, rt, ri, sname, body):
     """relay the e-mail in body according to the routing type rt
     and the routing info ri for the nymholder of nym"""
     # TODO : we must be *way* more careful with filtering headers and such
     # I think
-    b = 'From: ' + nym + '@' + Sconfig.serverName + "\n\n" + body
+    b = 'From: ' + nym + '@' + sname + "\n\n" + body
     fname = tmpFileMsg(b) #TODO we can avoid the tempfile with some fd manipultation : exec mixminion, write b in its stdin
     mixcmd = "mixminion send -t 0x" + b2s(rt[0]) + b2s(rt[1]) + ":" + ri + " -i " + fname
     print mixcmd
@@ -134,7 +130,7 @@
     #os.unlink(fname)
     print "Raw relayed message left in " + fname
     return ec
-                   
+
 def genMid(length = midLen):
     """Randomly generates a mid of given length different from oldestMid"""
     ret = oldestMid

Modified: trunk/nym3/Server/Main.py
===================================================================
--- trunk/nym3/Server/Main.py	2005-05-05 15:15:32 UTC (rev 233)
+++ trunk/nym3/Server/Main.py	2005-05-05 15:45:40 UTC (rev 234)
@@ -163,7 +163,8 @@
                     elif (com.ct() == Message.CToSCODE['Newpk']):
                         nymUser.setKeys(com.kid,com.kenc)
                     elif (com.ct() == Message.CToSCODE['Relay']):
-                        ec = Mail.relay(h.nym, com.rt, com.ri, com.body)
+                        ec = Mail.relay(h.nym, com.rt, com.ri,
+					Config.serverNamecom.body)
                         if (ec != 0):
                             print "mixminion exited abnormally with error code %d" % ec
                             sys.exit(2)



More information about the Nym3-commit mailing list