#ifndef _M_LIST_HEADER
#define _M_LIST_HEADER
#include <time.h>
#include "array.h"

/* SAM to list email messages stored in files on disk */

struct message;
typedef struct message Message;

char *message_header(Message *m, char *header);
char *message_subject(Message *m);
char *message_from(Message *m);

time_t message_date(Message *m);

char *message_file(Message *m);
int message_size(Message *m);


enum {
	ML_SORT_DATE,
	ML_SORT_FROM,
	ML_SORT_SUBJECT,
	ML_SORT_FILENAME,	
	ML_SORT_SIZE
};

Array *mlist_list(char *path, 
				  char *mask, 
				  int(*match)(void *, Message *), 
				  void *mdata, 
				  int from, 
				  int size, 
				  int sort, 
				  int reverse, 
				  int *max);

#endif
