Miscellaneous Mailbox and Message Functions
long mail_ping (MAILSTREAM *stream);
stream string to ping
The function pings the stream to see if it is still active. It may
discover new mail; this is the preferred method for a periodic "new mail
check" as well as a "keep alive" for servers which have an inactivity
timeout. It returns T if the stream is still alive, NIL otherwise.
If new mail is found, the application's mm_exists() function is
called with the newly-determined number of messages in the mailbox.
void mail_check (MAILSTREAM *stream);
stream stream to checkpoint
This function causes a mailstore-defined checkpoint of the
mailbox. This may include such things as a writeback to disk, a check
for flag changes in a shared mailbox, etc. It is not a "check for new
mail"; mail_ping() performs this function (as potentially does any other
function). The status of the check is passed to the application via the
mm_log() facility.
void mail_expunge (MAILSTREAM *stream);
stream string to expunge
This function causes an expunge (permanent removal of messages
which are marked as deleted) of the mailbox. The application's
mm_expunged() function is called for each message that has been
expunged. The application's mm_exists() function is called at the start
and end of the expunge to ensure synchronization. The status of the
expunge is passed to the application via the mm_log() facility.
Note that the decrementing of msgno's for subsequent messages
happens immediately; for example, if three consequtive messages starting
at msgno 5 are expunged, mm_expunged() will be called with a msgno of 5
three times.
long mail_copy (MAILSTREAM *stream,char *sequence,char *mailbox);
long mail_move (MAILSTREAM *stream,char *sequence,char *mailbox);
long mail_copy_full (MAILSTREAM *stream,char *sequence,char *mailbox,
long options);
stream stream to copy
sequence IMAP-format set of message numbers
mailbox destination mailbox name
options option flags
This function causes the messages in the specified sequence to be
copied to the specified mailbox. T is returned if the copy is
successful. mail_move() is equivalent to setting CP_MOVE in the options.
If there is any problem in copying, a message will be passed to
the application via the mm_log() facility and the function returns NIL.
No copying is actually done in this case.
Note that the mailbox must be on the same host as the stream and
is a mailbox of the type of the source mailbox only.
The flags for mail_search_full() are a bit mask with one or more
of the following:
CP_UID The sequence argument contains UIDs instead of
sequence numbers
CP_MOVE Delete the messages from the current mailbox
after copying to the destination.
long mail_append (MAILSTREAM *stream,char *mailbox,STRING *message);
long mail_append_full (MAILSTREAM *stream,char *mailbox,char *flags,char *date,
STRING *message);
stream stream to use if non-NIL (in the IMAP case)
mailbox destination mailbox name
flags flags to set on message if non-NIL
date internal date (received date) to set on message if non-NIL
message string structure of message to write
This function writes the message in the string structure to the
destination mailbox, along with the flags and date if specified. This
is useful in those cases where you can't use mail_copy(), e.g. when
copying from one server to another; you can always fetch the message
and then mail_append() it to the destination. It may also be useful
for maintaining an outbox of your outgoing mail.
void mail_gc (MAILSTREAM *stream,long gcflags);
stream stream to GC if non-NIL (else GC's all streams)
flags option flags
This function garbage collects (purges) the cache of entries of
a specific type. Some drivers do not allow purging of particular
cache types, and an attempt to do so is ignored.
The flags for mail_gc() are a bit mask with one or more of the
following:
GC_ELT message cache elements
GC_ENV ENVELOPEs and BODYs
GC_TEXTS cached texts