Go to the first, previous, next, last section, table of contents.
/* Prefix mbox_ is reserved */
#include <mailutils/mbox.h>
The most common mailbox format on UNIX platform is mbox. Mbox file is messages separated by the special format string.
From SP envelope-sender SP date [SP moreinfo]
"From "
envelope-sender
date
asctime ()
moreinfo
A mbox_t is created, initialized and destroyed by mbox_create ()
and mbox_destroy ()
. When opening, mbox_open ()
will do a quick
check to see if the format is a valid format or an empty file. The scanning
of the mailbox is done by mbox_scan ()
.
The function, mbox_scan ()
, takes callback functions called during the
scanning to provide information. The scanning will cache some of the headers
fields for speed. Closing the mailbox, mbox_close ()
will free
any resources like, headers cache, locks etc ... All the messages with
attributes marked deleted will only be removed on mbox_expunge ()
.
If only the attributes need to be save but the messages not removed, this
can be done by mbox_save_attributes ()
. New messages are added with
mbox_append ()
. Attributes are saved in the Status: header
field, Read is 'R', Seen is 'O', Deleted is 'd' and Reply is 'r'.
Allocate and initialize a mbox handle.
MU_ERROR_NO_MEMORY
MU_ERROR_INVALID_PARAMETER
When a POP3 session is finished, the structure must be free ()
'ed to
reclaim memory.
Another type of stream can be provided to work on, the carrier is set in the mbox_t handle. Any previous carrier stream in the handle, will be close and release. Since the parsing code maintain only the offsets off the message the carrier stream must be seekable.
MU_ERROR_INVALID_PARAMETER
Return the mbox_t carrier. If none was set, a new file stream will be created.
MU_ERROR_INVALID_PARAMETER
MU_ERROR_NO_MEMORY
Open carrier stream with filename and flags. The stream will be quickly examine to see if it is a mbox format.
MU_ERROR_INVALID_PARAMETER
MU_ERROR_NO_MEMORY
MU_ERROR_NO_ENTRY
MU_ERROR_NO_ACCESS
MU_ERROR_NOT_SUPPORTED
Close the carrier stream and resources particular to the mailbox.
MU_ERROR_INVALID_PARAMETER
MU_ERROR_NO_MEMORY
Return the uidnext, if the mbox_t was not scan mbox_scan ()
is called first.
MU_ERROR_INVALID_PARAMETER
same as mbox_scan ()
Return the uidvalidity, if the mbox_t was not scan mbox_scan ()
is called first.
MU_ERROR_INVALID_PARAMETER
same as mbox_scan ()
Return an attribute to indicate the status of message number msgno.
MU_ERROR_INVALID_PARAMETER
MU_ERROR_NO_MEMORY
Return an allocated string in sep containing the value "From " separating
each message in Unix mbox format. The string should be free ()
ed by
the caller.
MU_ERROR_INVALID_PARAMETER
MU_ERROR_NO_MEMORY
The variable sep should contain a valid "From " separator that will be use when the expunging.
MU_ERROR_INVALID_PARAMETER
MU_ERROR_NO_MEMORY
Return a stream to read the header of message msgno. The stream should be destroy after usage.
MU_ERROR_INVALID_PARAMETER
MU_ERROR_NO_MEMORY
Use stream when expunging for message msgno.
MU_ERROR_INVALID_PARAMETER
Return the size of message msgno.
MU_ERROR_INVALID_PARAMETER
Return the number of lines of message msgno.
MU_ERROR_INVALID_PARAMETER
Return a stream to read the body of message msgno. The stream should be destroy after usage.
MU_ERROR_INVALID_PARAMETER
MU_ERROR_NO_MEMORY
Use stream when expunging for message msgno.
MU_ERROR_INVALID_PARAMETER
Return the size of message msgno.
MU_ERROR_INVALID_PARAMETER
Return the number of lines of message msgno.
MU_ERROR_INVALID_PARAMETER
Return the size of mailbox.
MU_ERROR_INVALID_PARAMETER
Save the changes to the messages back to the mailbox, but do not remove messages mark for deletion in the process.
MU_ERROR_INVALID_PARAMETER
Mark msgno for deletion.
MU_ERROR_INVALID_PARAMETER
Unmark msgno if it was marked for deletion.
MU_ERROR_INVALID_PARAMETER
Save the changes to the mailbox and in the process remove all messages marked for deletion.
MU_ERROR_INVALID_PARAMETER
Append to the mailbox an rfc822 message represented by stream. The variable sep should contain a valid "From " separator or NULL to get the default.
MU_ERROR_INVALID_PARAMETER
Append to the mailbox an rfc822 message represented by a header, hstream, and a body, bstream. The variable sep should contain a valid "From " separator or NULL to get the default.
MU_ERROR_INVALID_PARAMETER
Start scanning the mailbox for new messages. The variable start can be
a message number starting point. The result of the scanning will be in
count. The scanning will trigger the mbox_newmsg_cb()
callback
for each new message and mbox_progress_cb ()
at different interval
to notify progression. The return values of the those callback should be
0 is different then 0 the scanning will be stop an the function returns
MU_ERROR_INTERRUPTED.
MU_ERROR_INVALID_PARAMETER
MU_ERROR_INTERRUPTED
MU_ERROR_NO_MEMORY
Set the callback function for progress. The variable arg will be pass back in the callback as the second argument.
MU_ERROR_INVALID_PARAMETER
Set the callback function for new messages. The variable arg will be pass back in the callback as the second argument.
MU_ERROR_INVALID_PARAMETER
Go to the first, previous, next, last section, table of contents.