Package buildbot :: Package changes :: Module maildir :: Class MaildirService
[frames] | no frames]

Class MaildirService

source code

 twisted.application.service.Service --+    
                                       |    
twisted.application.service.MultiService --+
                                           |
                                          MaildirService
Known Subclasses:

I watch a maildir for new messages. I should be placed as the service child of some MultiService instance. When running, I use the linux dirwatcher API (if available) or poll for new files in the 'new' subdirectory of my maildir path. When I discover a new message, I invoke my .messageReceived() method with the short filename of the new message, so the full name of the new file can be obtained with os.path.join(maildir, 'new', filename). messageReceived() should be overridden by a subclass to do something useful. I will not move or delete the file on my own: the subclass's messageReceived() should probably do that.

Instance Methods
 
__init__(self, basedir=None)
Create the Maildir watcher.
source code
 
setBasedir(self, basedir) source code
 
startService(self) source code
 
dnotify_callback(self) source code
 
stopService(self) source code
 
poll(self) source code
 
messageReceived(self, filename)
Called when a new file is noticed.
source code

Inherited from twisted.application.service.MultiService: __iter__, addService, getServiceNamed, privilegedStartService, removeService

Inherited from twisted.application.service.Service: __getstate__, __providedBy__, disownServiceParent, setName, setServiceParent

Class Variables
  pollinterval = 10
  __implemented__ = <implementedBy buildbot.changes.maildir.Mail...
  __provides__ = <zope.interface.declarations.ClassProvides obje...

Inherited from twisted.application.service.Service: name, parent, running

Method Details

__init__(self, basedir=None)
(Constructor)

source code 

Create the Maildir watcher. BASEDIR is the maildir directory (the one which contains new/ and tmp/)

Overrides: twisted.application.service.MultiService.__init__

startService(self)

source code 
Overrides: twisted.application.service.Service.startService

stopService(self)

source code 
Overrides: twisted.application.service.Service.stopService

messageReceived(self, filename)

source code 

Called when a new file is noticed. Will call self.parent.messageReceived() with a path relative to maildir/new. Should probably be overridden in subclasses.


Class Variable Details

__implemented__

Value:
<implementedBy buildbot.changes.maildir.MaildirService>

__provides__

Value:
<zope.interface.declarations.ClassProvides object at 0x15593d0>