Ticket #4623: iqueue.patch

File iqueue.patch, 1.7 KB (added by Pepijn de Vos, 9 years ago)

First attempt at a patch. The whole Queue thing seems like a piece of crap to me.

  • mail/

    old new  
    3939from twisted.mail import smtp
    4040from twisted.application import internet
    4141
     42from zope.interface import Interface, implements
     43
    4244class ManagedRelayerMixin:
    4345    """SMTP Relayer which notifies a manager
    4446
     
    131133        protocol.factory = self
    132134        return protocol
    133135
     136class IQueue(Interface):
     137    """A queue of ougoing emails."""
     138
     139    def createNewMessage():
     140        """Create a new message in the queue.
     141
     142        Return a tuple - file-like object for headers, and ISMTPMessage.
     143        """
     144
     145    def hasWaiting():
     146        """Returns a boolean"""
     147
     148    def getWaiting():
     149        """Get a list of message IDs waiting to be relayed"""
     150
     151    def setWaiting(message):
     152        """Change the status of the message to waiting"""
     153
     154    def setRelaying(message):
     155        """Change the status of the message to relayed"""
     156
     157    def getRelayed():
     158        """Get a list of message IDs that are relayed"""
     159
     160    def done(message):
     161        """Remove message to from queue."""
     162
     163    def getEnvelope(message):
     164        """Get a message object for the givven ID"""
     165
     166    #XXX this thing is sooo file-oriented
     167    def readDirectory():
     168        """Read the messages directory.
     169
     170        look for new messages.
     171        """
     172
     173    def getEnvelopeFile(message):
     174        """Get the message file object"""
     175
     176    def getPath(msg):
     177        """Get the path in the filesystem of a message."""
     178
    134179class Queue:
    135180    """A queue of ougoing emails."""
    136181
     182    implements(IQueue)
     183
    137184    noisy = True
    138185
    139186    def __init__(self, directory):