|
|
This topic describes the functions supplied by the message store C client API for the creation of drivers.
void mail_searched(MAILSTREAM *stream, unsigned long msgno);
This function is called by the driver to notify the C client that this message number matches a search. It invokes the main program's mm_searched function.
void mail_exists(MAILSTREAM *stream, unsigned long nmsgs);
This function is called by the driver to notify the C client that this message number exists (that is, there are this many messages in the mailbox). It invokes the main program's mm_exists function.
void mail_recent(MAILSTREAM *stream, unsigned long recent);
This function is called by the driver to notify the C client that this many messages are ``recent'' (that is, arrived in the mailbox since the previous time the mailbox was opened).
void mail_expunged(MAILSTREAM *stream, unsigned long msgno);
This function is called by the driver to notify MAIL that this message number has been expunged from the mail file and that all subsequent messages are no references by a message number one less than before. It invokes the main program's mm_expunged function.
void mail_lock(MAILSTREAM *stream);
This function sets the stream lock. It is an error to set the stream lock if the stream is already locked.
This is mainly used to catch errors due to a callback function (for example, mm_exists) inadvertantly recursing back to the MAIL routines and establishing an infinite recursion. Normally, drivers will set the lock prior to calling one of the callback functions above or, more likely, in the beginning of the driver's non-reentrant do operation section. In the IMAP4 driver, the stream lock is set when entering imap_send and cleared on exit.
void mail_unlock(MAILSTREAM *stream);
This function releases the stream lock. It is an error to release the stream lock if the stream is not locked.