#ifndef _SEQ_H_1532b749_ #define _SEQ_H_1532b749_ struct mm_seq; typedef struct mm_seq SEQ; struct mm_seqs; typedef struct mm_seqs SEQS; #include "folder.h" #include "message.h" /* Get the sequences for a folder. The folder must be locked and it must remain locked until the matching seqs_close/seqs_abort is done. This locks the sequences file; it remains locked until the matching seqs_close or seqs_abort call is done, so that should be done soon. */ extern SEQS *seqs_open(FOLDER *); /* Close a list of sequences. If any changes have been made, flushes them to disk. */ extern void seqs_close(SEQS *); /* Close a list of sequences. Ignore any possible changes. */ extern void seqs_abort(SEQS *); /* Look up a sequence by name. */ extern SEQ *seq_lookup(SEQS *, const char *); /* Remove a message number from a sequence. Nop if it's not there. */ extern void seq_remove(SEQ *, int); /* Remove a message number from all of a set of sequences. */ extern void seq_remove_all(SEQS *, int); /* Add a message number to a sequence. Nop if already there. */ extern void seq_add(SEQ *, int); /* Remove a range from a sequence. */ extern void seq_remove_range(SEQ *, int, int); /* Add a range to a sequence. */ extern void seq_add_range(SEQ *, int, int); /* Remove all messages from a sequence. */ extern void seq_clear(SEQ *); /* seq_get(s,count,off,vec) fetches up to count message numbers from SEQ pointed to by s, starting with the offth message number, into vec. Return value is the total number of messages in the sequence. */ extern int seq_get(SEQ *, int, int, int *); /* Returns true of the message number belongs to the sequence. */ extern int seq_test(SEQ *, int); /* Call the function with the cookie for each sequence in the SEQS. If any call returns nonzero, seqs_forall returns that nonzero value and does not make any more calls; if all calls return zero, seqs_forall returns zero after the last call. It is legitimate to call other seq functions, even on the same SEQS list or its SEQs, but if new SEQs are created with seq_lookup during the traversal, whether or not they are seen is unspecified. The order in which sequences are accessed is also unspecified. */ extern int seqs_forall(SEQS *, void *, int (*)(SEQ *, void *)); #endif