Utility Functions
void mail_debug (MAILSTREAM *stream);
stream stream to debug
This function enables telemetry logging for this stream. All
telemetry is passed to the application via the mm_dlog() facility.
void mail_nodebug (MAILSTREAM *stream);
stream stream to disable debugging
This function disables telemetry logging for this stream.
long mail_sequence (MAILSTREAM *stream,char *sequence);
stream stream to set the sequence bits
sequence IMAP-format message set string
This function parses the given sequence string for message
numbers, sets the sequence bit in the stream's message cache element
of all messages in the sequence (and turns it off in all other message
cache elements). If the parse is successful, T is returned, else NIL.
long mail_uid_sequence (MAILSTREAM *stream,char *sequence);
stream stream to set the sequence bits
sequence IMAP-format message set string
This function parses the given sequence string for unique
identifiers, sets the sequence bit in the stream's message cache
element of all messages in the sequence (and turns it off in all other
message cache elements). If the parse is successful, T is returned,
else NIL.
long mail_parse_flags (MAILSTREAM *stream,char *flag,unsigned long *uf);
stream stream (used to get user flags)
flag IMAP-format flag string to parse
uf returned location of user flags
The function parses the given flag string, and returns the system
flags as its return value and the user flags in the location pointed
to by the uf argument. If there is an error in parse, a log message
is issued via mm_log() and this function returns NIL.
unsigned long mail_filter (char *text,unsigned long len,STRINGLIST *lines,
long flags);
text RFC 822 text to filter
len length in octets in the text argument
lines string list of header file names to filter
flags option flags
This function supports the header lines filtering function of
mail_fetchheader_full(). The lines argument contains a list of header
field names to use in subsetting the header text. Only those lines
which have that header field name are returned, unless FT_NOT is set
in which case only those lines which do not have that header field
name are returned.
The options for mail_filter() are a bit mask with one or more of
the following:
FT_NOT The returned header lines are those that are
not in the lines argument
long mail_search_msg (MAILSTREAM *stream,unsigned long msgno,char *charset,
SEARCHPGM *pgm);
stream stream to search
msgno message number of message to inspect
charset character set of search strings
pgm search program to test
This function implements mail_search_full() locally in cases when
it is not done by a server (e.g. local mail files, NNTP/POP). It
inspects the given message on that stream to see if it matches the
criteria or not. If it matches, T is returned, else NIL.
SEARCHPGM *mail_criteria (char *criteria);
criteria IMAP2-format search criteria string
This function accepts an IMAP2-format search criteria string and
parses it. If the parse is successful, it returns a search program
suitable for use in mail_search_full().
WARNING: This function does not accept IMAP4 search criteria.
The source string must be writeable (this restriction was also
in the old IMAP2 c-client).