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

Description (short)
Mailbox management based on files and directories
Written by
Andreas Kupries
Description
File- and directorybased mailbox management. Currently ussed by the small scale pop3 server application (apps/popsy).
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.
Depends on
Memchan
Superclasses
popServerStorageBase
Options
dir
Methods
public
Check (mbox)
TransferDone (mbox outchan chan transId n)
add (mbox)
dele (mbox msgList)
exists (mbox)
lock (mbox)
locked (mbox)
mbox ()
move (old new)
remove (mbox)
size (mbox msgId)
stat (mbox)
transfer (args)
unlock (mbox)
Membervariables
public
locked
state
transfer

Options

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

Methods

Check (mbox)

Internal procedure. Used to map a mailbox handle to the directory containing the messages.
Argument: mbox Reference 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: mbox Reference to the mailbox to be operated on. Ignored.
Argument: outchan The channel contained the data written.
Argument: chan The channel to write the data into.
Argument: transId The id of the transfer
Argument: n Number 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: mbox Reference to the mailbox to be operated on.

dele (mbox msgList)

Overrides popServerStorageBase:dele
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: mbox Reference to the mailbox to be operated on.
Argument: msgList List of message ids.

exists (mbox)

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

lock (mbox)

Overrides popServerStorageBase:lock
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: mbox Reference 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: mbox Reference 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: old Reference to the mailbox to be operated on.
Argument: new New reference to the mailbox

remove (mbox)

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

size (mbox msgId)

Overrides popServerStorageBase:size
Determines the size of the specified message, in bytes.
Argument: mbox Reference to the mailbox to be operated on.
Argument: msgId Numerical index of the message to look at.
Returns: size of the message in bytes.

stat (mbox)

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

transfer (args)

Overrides popServerStorageBase:transfer
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: args List of option/value-pairs, followed by 3 arguments (explained in the method description). Recognized options are '-done' and '-lines'.
The value of -done is interpreted as a script to call after completion of the transfer. Its specification is required.
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)

Overrides popServerStorageBase:unlock
A locked mailbox is unlocked, thereby made available to other sessions.
Argument: mbox Reference to the mailbox to be locked.


Membervariables

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.

Generated by AutoDoc 2.4 at 09/14/2000, invoked by Andreas Kupries