File 'net/pop3/mbox.cls' (part of 'Pool_Net')


Home | Packages | Files | Procedures | Classes | Keywords | External packages


Written by
Andreas Kupries
Description
File- and directorybased mailbox management. Currently ussed by the small scale pop3 server application (apps/popsy).
Depends on
Memchan
Keywords
Mailbox management, pop3 server

Class 'mbox'

Description
A file and directory based implementation of the popServerStorageBase-interface. Each mailbox is implemented as a directory below dir, and every mail is stored in a single file.
Superclasses
popServerStorageBase
Options
dir
Membervariables
locked, state, transfer
Methods
Check, TransferDone, add, dele, exists, lock, locked, mbox, move, remove, size, stat, transfer, unlock

-dir
The path to the base directory containing mailboxes and mails.

locked
Every locked mailbox has entry in this array, its name is used as index.
state
Every locked mailbox has entry in this array, its name is used as index. The associated value is a list of the files in the mailbox (= list of stored mails).
transfer
This array contains the state for every running transfer. This state is currently only the callback script to execute after its completion.

Check (mbox)

Internal procedure. Used to map a mailbox handle to the directory containing the messages.
Argument: mboxReference to the mailbox to be operated on.
Returns: Path of directory holding the message files of the specified mailbox.

TransferDone (mbox outchan chan transId n)

Internal procedure. Called by 'fcopy' after completion of the transfer. Executes the '-done' script specified at the call to transfer.
Argument: mboxReference to the mailbox to be operated on. Ignored.
Argument: outchanThe channel contained the data written.
Argument: chanThe channel to write the data into.
Argument: transIdThe id of the transfer
Argument: nNumber of bytes sent, courtesy by 'fcopy'. Ignored here.

add (mbox)

Create a mailbox with handle mbox. The handle is used as the name of the directory to contain the mails too.
Argument: mboxReference to the mailbox to be operated on.

dele (mbox msgList)

Deletes the specified messages from the mailbox. This should be followed by a unlock as the state is not updated accordingly.
Dangers: The code assumes that the id's in the list were already checked against the maximal number of messages.
Argument: mboxReference to the mailbox to be operated on.
Argument: msgListList of message ids.

exists (mbox)

Determines existence of mailbox mbox.
Argument: mboxReference to the mailbox to check for.
Returns: 1 if the mailbox exists, 0 else.

lock (mbox)

Locks the given mailbox, additionally stores a list of the available files in the manager state. All files (= messages) added to the mailbox after this operation will be ignored during the session.
Argument: mboxReference to the mailbox to be locked.
Returns: 1 if mailbox was locked sucessfully, 0 else.

locked (mbox)

Checks wether the specified mailbox is locked or not.
Argument: mboxReference to the mailbox to check.
Returns: 1 if the mailbox is locked, 0 else.

mbox ()

Constructor. Does some more checks on the given base directory.

move (old new)

Change the handle of mailbox old to new.
Argument: oldReference to the mailbox to be operated on.
Argument: newNew reference to the mailbox

remove (mbox)

Remove mailbox with handle mbox. This will destroy all mails contained in it too.
Argument: mboxReference to the mailbox to be operated on.

size (mbox msgId)

Determines the size of the specified message, in bytes.
Argument: mboxReference to the mailbox to be operated on.
Argument: msgIdNumerical index of the message to look at.
Returns: size of the message in bytes.

stat (mbox)

Determines the number of messages picked up by lock. Will fail if the mailbox was not locked.
Argument: mboxReference to the mailbox queried.
Returns: The number of messages in the mailbox

transfer (args)

Starts a (partial) transfer of the given message. Configured via a list of option/value-pairs, followed by the mailbox to look at, the numerical id of the message to transfer and the channel to sent the mail to, in this order.
Argument: argsList of option/value-pairs, followed by 3 arguments (explained in the method description). Recognized options are '-done' and '-lines'.&p The value of -done is interpreted as a script to call after completion of the transfer. Its specification is required. &p On the other hand, specification of -lines is optional. It is interpreted as the number of lines to transfer, beyond the usual message header. The complete message is transfered if it is not specified.

unlock (mbox)

A locked mailbox is unlocked, thereby made available to other sessions.
Argument: mboxReference to the mailbox to be locked.


Generated by AutoDoc 2.1 at 02/20/1999, invoked by Andreas Kupries