Node:Mailbox,
Next:Mailer,
Previous:Folder,
Up:libmailbox
Mailbox
/* Prefix mailbox_ is reserved */
#include <mailutils/mailbox.h>
The mailbox_t object is used to hold information and it is an opaque
data structure to the user. Functions are provided to retrieve information
from the data structure.
|
mailbox_t url_t
-/var/mail- +---//---->/-----------------\ +-->/-----------\
( alain ) | | url_t *-|----+ | port |
----------- | |-----------------+ | hostname |
( jakob *-)----+ | observer_t *-| | file |
----------- |-----------------+ | ... |
( jeff ) | stream_t | \-----------/
----------- |-----------------|
( sean ) | locker_t |
---------- |-----------------|
| message_t(1) |
|-----------------|
| message_t(2) |
| ...... |
| message_t(n) |
\-----------------/
int mailbox_append_message (mailbox_t mbox, message_t message)
|
Function |
The message is appended to the mailbox mbox.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null or message is invalid.
|
int mailbox_close (mailbox_t mbox)
|
Function |
The stream attach to mbox is closed.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
|
int mailbox_create (mailbox_t *pmbox, const char *name)
|
Function |
The function mailbox_create allocates and initializes pmbox.
The concrete mailbox type instantiate is based on the scheme of the url name.
The return value is 0 on success and a code number on error conditions:
MU_ERR_OUT_PTR_NULL
- The pointer pmbox supplied is NULL.
MU_ERR_NO_HANDLER
- The url name supplied is invalid or not supported.
EINVAL
ENOMEM
- Not enough memory to allocate resources.
|
int mailbox_create_default (mailbox_t *pmbox, const char *name)
|
Function |
Create a mailbox with mailbox_create () based on the environment
variable $MAIL or the string formed by
_PATH_MAILDIR/user" or $LOGNAME if user is null,
|
void mailbox_destroy (mailbox_t *pmbox)
|
Function |
Destroys and releases resources held by pmbox.
|
int mailbox_expunge (mailbox_t mbox)
|
Function |
All messages marked for deletion are removed.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
|
int mailbox_get_folder (mailbox_t mbox, folder_t *folder)
|
Function |
Get the folder.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
|
int mailbox_get_debug (mailbox_t mbox, debug_t *debug)
|
Function |
Get a debug object.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
ENOMEM
|
int mailbox_get_locker (mailbox_t mbox, locker_t *plocker)
|
Function |
Return the locker object.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
|
int mailbox_get_message (mailbox_t mbox, size_t msgno, message_t *pmessage)
|
Function |
Retrieve message number msgno, pmessage is allocated and
initialized.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null or msgno is invalid.
ENOMEM
- Not enough memory.
|
int mailbox_get_observable (mailbox_t mbox mbox, observable_t*observable)
|
Function |
Get the observable object.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
ENOMEM
- Not enough memory.
|
int mailbox_get_property (mailbox_t mbox, property_t *property)
|
Function |
Get the property object.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
ENOMEM
|
int mailbox_get_size (mailbox_t mbox, off_t *psize)
|
Function |
Gives the mbox size.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
|
int mailbox_get_stream (mailbox_t mbox, stream_t *pstream)
|
Function |
The mailbox stream is put in pstream.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is invalid or pstream is NULL.
|
int mailbox_get_ticket (mailbox_t mbox, ticket_t ticket)
|
Function |
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
|
int mailbox_get_url (mailbox_t mbox, url_t *purl)
|
Function |
Gives the constructed url.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
|
int mailbox_is_modified (mailbox_t mbox)
|
Function |
Check if the mailbox been modified by an external source.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
|
int mailbox_message_unseen (mailbox_t mbox, size_t *pnumber);
|
Function |
Give the number of first unseen message in mbox.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
|
int mailbox_messages_count (mailbox_t mbox, size_t *pnumber);
|
Function |
Give the number of messages in mbox.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
|
int mailbox_messages_recent (mailbox_t mbox, size_t *pnumber);
|
Function |
Give the number of recent messages in mbox.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
|
int mailbox_open (mailbox_t mbox, int flag)
|
Function |
A connection is open, if no stream was provided, a stream
is created based on the mbox type. The flag can be OR'ed.
See stream_create for flag's description.
The return value is 0 on success and a code number on error conditions:
EAGAIN
EINPROGRESS
- Operation in progress.
EBUSY
- Resource busy.
MU_ERROR_INVALID_PARAMETER
- mbox is null or flag is invalid.
ENOMEM
- Not enough memory.
|
int mailbox_scan (mailbox_t mbox, size_t msgno, size_t *pcount);
|
Function |
Scan the mailbox for new messages starting at message msgno.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
ENOMEM
- Not enough memory.
|
int mailbox_set_locker (mailbox_t mbox, locker_t locker)
|
Function |
Set the type of locking done by the mbox.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
|
int mailbox_set_stream (mailbox_t mbox, stream_t stream)
|
Function |
Set the stream connection to use for the mailbox.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox or stream is NULL.
|
int mailbox_set_ticket (mailbox_t mbox, ticket_t ticket)
|
Function |
The ticket will be set on the auth_t object on creation.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
|
int mailbox_uidnext (mailbox_t mbox, size_t *pnumber);
|
Function |
Give the next predicted uid for mbox.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
|
int mailbox_uidvalidity (mailbox_t mbox, size_t *pnumber);
|
Function |
Give the uid validity of mbox.
The return value is 0 on success and a code number on error conditions:
MU_ERROR_INVALID_PARAMETER
- mbox is null.
|