[Nym3-commit] r92 - trunk
nym3-devel@lists.noreply.org
nym3-devel@lists.noreply.org
Thu, 05 Aug 2004 15:05:44 +0200
Author: jr
Date: 2004-08-05 15:05:42 +0200 (Thu, 05 Aug 2004)
New Revision: 92
Modified:
trunk/Config.py
trunk/Main.py
trunk/Message.py
Log:
- add buildMessage(Message.py)
- add some processing (Main.py)
Modified: trunk/Config.py
===================================================================
--- trunk/Config.py 2004-08-05 12:43:53 UTC (rev 91)
+++ trunk/Config.py 2004-08-05 13:05:42 UTC (rev 92)
@@ -7,7 +7,7 @@
'idKey' : None, 'encKey' : None, 'policy' : None,
'SendMsgAfter' : 24, 'SendSummaryAfter' : 12,
'MaxSURBsPerDay' : 10, 'EncryptSummaryAfter' : 24,
- 'HoldUntilAck' : 'Always', 'ShutdownPhrase' : None,
+ 'HoldUntilAck' : 'always', 'ShutdownPhrase' : None,
'HoldSURBs' : 5,
'nSurbs' : 0, 'up' : False, 'cr' : ""}
Modified: trunk/Main.py
===================================================================
--- trunk/Main.py 2004-08-05 12:43:53 UTC (rev 91)
+++ trunk/Main.py 2004-08-05 13:05:42 UTC (rev 92)
@@ -134,8 +134,9 @@
sendList.append(m)
ec = nymUser.sendMessage(Message.buildMessage(msgList))
if (ec == 0):
- #TODO acquitte le message
nymUser.markMid(sendList,'sent-in-full')
+ if(nymUser['HoldUntilAck'] == 'never'):
+ map(nymUser.delete_msg,sendList)
else:
print "mixminion exited abnormally with error code %d" % ec
Modified: trunk/Message.py
===================================================================
--- trunk/Message.py 2004-08-05 12:43:53 UTC (rev 91)
+++ trunk/Message.py 2004-08-05 13:05:42 UTC (rev 92)
@@ -642,6 +642,9 @@
def __init__(self):
"""Build a empty Created object"""
pass
+ def ct(self):
+ """return a int for the code of the command"""
+ return 0
def fromData(self,nym,ch):
"""Fill a Created Object from a nym(str) and a challenge(str) """
if(len(nym)>255):
@@ -676,6 +679,9 @@
def __init__(self):
"""Build a empty Status object"""
pass
+ def ct(self):
+ """return a int for the code of the command"""
+ return 1
def fromData(self,nM,nS,q,u,l):
"""Fill a Status Object from a number of message(int), a number of surbs(int), a quota(int), a used(int) and a sequence of seqno(list of (str of size seqNoLength)"""
#TODO replace the error by the taking of the maximal value?
@@ -725,6 +731,9 @@
def __init__(self):
"""Build a empty Summary object"""
pass
+ def ct(self):
+ """return a int for the code of the command"""
+ return 2
def fromData(self,bf,ess):
"""Fill a Object from bit field (str of len 2) and an encrypted set of synopses(str)"""
if(len(bf)!=2):
@@ -756,6 +765,9 @@
def __init__(self):
"""Build a empty Msg object"""
pass
+ def ct(self):
+ """return a int for the code of the command"""
+ return 3
def fromData(self,mid,msg):
"""Fill a Msg Object from a Mid (str of length midLength) and an encrypted msg (str)"""
if(len(mid) != midLength):
@@ -787,6 +799,9 @@
def __init__(self):
"""Build a empty Dropped object"""
pass
+ def ct(self):
+ """return a int for the code of the command"""
+ return 4
def fromData(self,l):
"""Fill a Dropped Object from a list of mid"""
if( not isMidList(l,midLength)):
@@ -819,6 +834,9 @@
def __init__(self):
"""Build a empty Error object"""
pass
+ def ct(self):
+ """return a int for the code of the command"""
+ return 5
def fromData(self,seqNo,error):
"""Fill a Object from a seqno (str of len seqNoLength) and an error message(str)"""
if(len(seqNo) != seqNoLength):
@@ -843,10 +861,16 @@
raise BadArgument("Error.__str__ : command body too long")
return chr(5)+intToStrBE(len(s),3)+s
+def buildMessage(comList):
+ """Turn a list of Command into a sendable message
+ """
+ s = ""
+ for c in comList:
+ s = s + c.__str__()
+
+ return s
+
-
-
-
if (__name__ == '__main__'):
import Mail
l=[]