[Nym3-commit] r522 - trunk/nymbaron/Server

jr at conuropsis.org jr at conuropsis.org
Thu Jun 22 22:30:12 CEST 2006


Author: jr
Date: 2006-06-22 22:30:12 +0200 (Thu, 22 Jun 2006)
New Revision: 522

Modified:
   trunk/nymbaron/Server/Main.py
   trunk/nymbaron/Server/User.py
Log:
- mark a TODO in User.midAfter
- add the ability to call advanced send without passing a message
- add two message status for describing their presence in the send queue


Modified: trunk/nymbaron/Server/Main.py
===================================================================
--- trunk/nymbaron/Server/Main.py	2006-06-22 20:27:19 UTC (rev 521)
+++ trunk/nymbaron/Server/Main.py	2006-06-22 20:30:12 UTC (rev 522)
@@ -360,6 +360,7 @@
                             msgCom.fromData(m, nymUser.getMail(m))
                             msgList.append(msgCom)
                             sendList.append(m)
+                    nymUser.markMid(sendList, lifeCycle['full-scheduled'])
                     nymUser.advanced_send(Message.buildMessage(msgList),
                             fun = nymUser.afterSend,
                             funargs = (sendList,))
@@ -380,7 +381,7 @@
                         sumCom = Message.Summary()
                         sumCom.fromData("\x00\x00","")
                         comList = [sumCom]
-                    #TODO add a lifeCycle syn-send-scheduled?
+                    nymUser.markMid(mList, lifeCycle['synopsis-scheduled'])
                     nymUser.advanced_send(Message.buildMessage(comList), \
                         fun = nymUser.markMid, \
                         funargs = (mList, lifeCycle['synopsis-sent']))

Modified: trunk/nymbaron/Server/User.py
===================================================================
--- trunk/nymbaron/Server/User.py	2006-06-22 20:27:19 UTC (rev 521)
+++ trunk/nymbaron/Server/User.py	2006-06-22 20:30:12 UTC (rev 522)
@@ -52,8 +52,8 @@
 maxSynPerBlob = 16
 # See nym-spec, § 4.4.3
 
-lifeCycle = { 'nothing-sent' : 0, 'synopsis-sent' : 1,
-              'sent-in-full' : 2, 'deleted' : 3 }
+lifeCycle = { 'nothing-sent' : 0, 'synopsis-scheduled' : 1, 'synopsis-sent' : 2,
+              'full-scheduled' : 3, 'sent-in-full' : 4, 'deleted' : 5 }
 """The life cycle of a mail received by a nym"""
 
 class NoSuchUser(Exception):
@@ -365,6 +365,7 @@
         the elements of the output are ordered by ascending
         order of arrival time. A list of num mids is returned unless num = -1,
         in which case all possible mids are returned"""
+        #TODO base "after" on the xnym-seq instead of the time.
         self.load_index()
 
         ret = []
@@ -443,15 +444,18 @@
         object which will be called with argument funargs upon successful
         sending of the message.
         If enqueue_only is True, don't try to send anything, just queue msg.
-        #TODO add_status will be removed in the near future. 
+        if msg is None, doesn't enqueue anything, but may try to send the queue
+        content or automatically generated control message.
+        #TODO add_status will be removed in the near future.
         Adds a status control message if the add_status argument is True. Also
         updates the number of surbs
-        fo the time being returns the result of send, or 2 if send was not
+        for the time being returns the result of send, or 2 if send was not
         called. Will be removed when Main uses the success function mechanism"""
         logger = logging.getLogger('nymbaron')
         self.load_queue()
         logger.debug('queue length (after loading): %d' % len(self.queue))
-        self.queue.append((msg, fun, funargs))
+        if msg:
+            self.queue.append((msg, fun, funargs))
         logger.debug('queue length (after appending): %d' % len(self.queue))
         if enqueue_only:
             return 2
@@ -494,8 +498,12 @@
         self.load_index()
         for _, v in self.index.iteritems():
             if v['status'] in \
-              [lifeCycle['nothing-sent'], lifeCycle['synopsis-sent']]:
+              [lifeCycle['nothing-sent'], lifeCycle['synopsis-scheduled'], \
+              lifeCycle['synopsis-sent'], lifeCycle['full-scheduled']]:
                 nMsg += 1
+        for j in range(i):
+            if self.queue[j][1] == self.afterSend:
+                nMsg -= len(self.queue[j][2][0])
         usage = self.usage()
         statusc.fromData(nMsg, 0, self.quota(), usage, self['received'])
         scMsg = str(statusc)



More information about the Nym3-commit mailing list