Package twisted :: Package protocols :: Module imap4 :: Class IAccount

[frames | no frames]

## Class IAccount

    Interface --+
                |
               IAccount

Interface for Account classes

Implementors of this interface must also subclass `twisted.cred.perspective.Perspective` and should consider implementing `INamespacePresenter`.

Method Summary
`Deferred` or `bool` | ``addMailbox`(self, name, mbox)` Add a new mailbox to this account
`Deferred` or `bool` | ``create`(self, pathspec)` Create a new mailbox from the given hierarchical name.
`Deferred` or `bool` | ``delete`(self, name)` Delete the mailbox with the specified name.
`Deferred` or `bool` | ``isSubscribed`(self, name)` Check the subscription status of a mailbox
`list` of `tuple` | ``listMailboxes`(self, ref, wildcard)` List all the mailboxes that meet a certain criteria
`Deferred` or `bool` | ``rename`(self, oldname, newname)` Rename a mailbox
Any object implementing `IMailbox` or `Deferred` | ``select`(self, name, rw)` Acquire a mailbox, given its name.
`Deferred` or `bool` | ``subscribe`(self, name)` Subscribe to a mailbox
`Deferred` or `bool` | ``unsubscribe`(self, name)` Unsubscribe from a mailbox

Method Details

### addMailbox(self, name, mbox=None)

Add a new mailbox to this account

  Parameters:
    `name` - The name associated with this mailbox. It may not contain multiple hierarchical parts.
    (type=`str`)
    `mbox` - The mailbox to associate with this name. If `None`, a suitable default is created and used.
    (type=An object implementing `IMailbox`)
  Returns:
    A true value if the creation succeeds, or a deferred whose callback will be invoked when the creation succeeds.
    (type=`Deferred` or `bool`)
  Raises:
    `MailboxException` - Raised if this mailbox cannot be added for some reason. This may also be raised asynchronously, if a `Deferred` is returned.

### create(self, pathspec)

Create a new mailbox from the given hierarchical name.

  Parameters:
    `pathspec` - The full hierarchical name of a new mailbox to create. If any of the inferior hierarchical names to this one do not exist, they are created as well.
    (type=`str`)
  Returns:
    A true value if the creation succeeds, or a deferred whose callback will be invoked when the creation succeeds.
    (type=`Deferred` or `bool`)
  Raises:
    `MailboxException` - Raised if this mailbox cannot be added. This may also be raised asynchronously, if a `Deferred` is returned.

### delete(self, name)

Delete the mailbox with the specified name.

  Parameters:
    `name` - The mailbox to delete.
    (type=`str`)
  Returns:
    A true value if the mailbox is successfully deleted, or a `Deferred` whose callback will be invoked when the deletion completes.
    (type=`Deferred` or `bool`)
  Raises:
    `MailboxException` - Raised if this mailbox cannot be deleted. This may also be raised asynchronously, if a `Deferred` is returned.

### isSubscribed(self, name)

Check the subscription status of a mailbox

  Parameters:
    `name` - The name of the mailbox to check
    (type=`str`)
  Returns:
    A true value if the given mailbox is currently subscribed to, a false value otherwise. A `Deferred` may also be returned whose callback will be invoked with one of these values.
    (type=`Deferred` or `bool`)

### listMailboxes(self, ref, wildcard)

List all the mailboxes that meet a certain criteria

  Parameters:
    `ref` - The context in which to apply the wildcard
    (type=`str`)
    `wildcard` - An expression against which to match mailbox names. '*' matches any number of characters in a mailbox name, and '%' matches similarly, but will not match across hierarchical boundaries.
    (type=`str`)
  Returns:
    A list of `(mailboxName, mailboxObject)` which meet the given criteria. A Deferred may also be returned.
    (type=`list` of `tuple`)

### rename(self, oldname, newname)

Rename a mailbox

  Parameters:
    `oldname` - The current name of the mailbox to rename.
    (type=`str`)
    `newname` - The new name to associate with the mailbox.
    (type=`str`)
  Returns:
    A true value if the mailbox is successfully renamed, or a `Deferred` whose callback will be invoked when the rename operation is completed.
    (type=`Deferred` or `bool`)
  Raises:
    `MailboxException` - Raised if this mailbox cannot be renamed. This may also be raised asynchronously, if a `Deferred` is returned.

### select(self, name, rw=1)

Acquire a mailbox, given its name.

  Parameters:
    `name` - The mailbox to acquire
    (type=`str`)
    `rw` - If a true value, request a read-write version of this mailbox. If a false value, request a read-only version.
    (type=`bool`)
  Returns:
    The mailbox object, or a `Deferred` whose callback will be invoked with the mailbox object. None may be returned if the specified mailbox may not be selected for any reason.
    (type=Any object implementing `IMailbox` or `Deferred`)

### subscribe(self, name)

Subscribe to a mailbox

  Parameters:
    `name` - The name of the mailbox to subscribe to
    (type=`str`)
  Returns:
    A true value if the mailbox is subscribed to successfully, or a Deferred whose callback will be invoked with this value when the subscription is successful.
    (type=`Deferred` or `bool`)
  Raises:
    `MailboxException` - Raised if this mailbox cannot be subscribed to. This may also be raised asynchronously, if a `Deferred` is returned.

### unsubscribe(self, name)

Unsubscribe from a mailbox

  Parameters:
    `name` - The name of the mailbox to unsubscribe from
    (type=`str`)
  Returns:
    A true value if the mailbox is unsubscribed from successfully, or a Deferred whose callback will be invoked with this value when the unsubscription is successful.
    (type=`Deferred` or `bool`)
  Raises:
    `MailboxException` - Raised if this mailbox cannot be unsubscribed from. This may also be raised asynchronously, if a `Deferred` is returned.

Generated by Epydoc 2.0 on Sat May 15 20:08:52 2004 | http://epydoc.sf.net