Package osaf :: Package mail :: Module mailservice :: Class MailService
[hide private]
[frames] | no frames]

Class MailService

source code

object --+
         |
        MailService

Central control point for all mail related code. For each IMAP, POP, and SMTP account it creates a client instance to handle requests and stores the client in its queue.

The MailService is started with Chandler in the application codes and shutdown with Chandler.

It employees the lazy loading model where no clients are created until one is requested.

Example:

A user wants to send an SMTP message via an SMTPAccount. When the user hits send the MailService receives a request: mailService.getSMTPInstance(smtpAccount)

The MailService looks in its cache to see if it has a SMTPClient instance for the given account. If none is found it creates the instance and passes back to the requestor.

If one exists in the cache it returns that instance.

Caching instances allows finite control of RepositoryView creation and client pipelining.

Instance Methods [hide private]
 
__init__(self, view)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
startup(self)
Initializes the MailService and creates the cache for suppported protocols POP, SMTP, IMAP
source code
 
shutdown(self)
Shutsdown the MailService and deletes any clients in the MailServices cache
source code
 
takeOnline(self) source code
 
takeOffline(self) source code
 
isOnline(self, view=<Locale: en_US>)
A view should be passed when the check for isOnline is not performed on the Main UI Thread.
source code
 
refreshMailServiceCache(self)
Refreshs the MailService Cache checking for any client instances that are associated with an inactive or deleted account.
source code
 
refreshIMAPClientCache(self)
Refreshes the IMAPClient cache removing any instances associated with inactive or deleted accounts
source code
 
refreshSMTPClientCache(self)
Refreshes the SMTPClient cache removing any instances associated with inactive or deleted accounts
source code
 
refreshPOPClientCache(self)
Refreshes the POPClient cache removing any instances associated with inactive or deleted accounts
source code
 
getSMTPInstance(self, account, fromCache=True)
Returns a SMTPClient instance for the given account
source code
 
getIMAPInstance(self, account, fromCache=True)
Returns a IMAPClient instance for the given account
source code
 
getPOPInstance(self, account, fromCache=True)
Returns a POPClient instance for the given account
source code
 
_refreshCache(self, protocol) source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, view)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Overrides: object.__init__
(inherited documentation)

getSMTPInstance(self, account, fromCache=True)

source code 
Returns a SMTPClient instance for the given account
Parameters:
  • account (SMTPAccount) - A SMTPAccount
  • fromCache (bool) - Boolean flag indicating whether the c{SMTPClient} instance should come from the cache.
Returns:
SMTPClient

getIMAPInstance(self, account, fromCache=True)

source code 
Returns a IMAPClient instance for the given account
Parameters:
  • account (IMAPAccount) - A IMAPAccount
  • fromCache (bool) - Boolean flag indicating whether the c{IMAPClient} instance should come from the cache.
Returns:
IMAPClient

getPOPInstance(self, account, fromCache=True)

source code 
Returns a POPClient instance for the given account
Parameters:
  • account (POPAccount) - A POPAccount
  • fromCache (bool) - Boolean flag indicating whether the c{POPClient} instance should come from the cache.
Returns:
POPClient