X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=mx.h;h=a53763659c0abdfdeecdd06bb93d0a8b5012da5d;hp=828c4b8de44888b735564253bd39569360f7df86;hb=96d53ff49c308769efbf708e1e65819077cb7af6;hpb=8e6b42b9b28f646a6764936d80bda04647d5b45f diff --git a/mx.h b/mx.h index 828c4b8..a537636 100644 --- a/mx.h +++ b/mx.h @@ -17,6 +17,9 @@ #ifndef _MX_H #define _MX_H +#include +#include + /* * supported mailbox formats * in mx_init() the registration order must be exactly as given here!!!1! @@ -62,62 +65,63 @@ enum { break; \ } +typedef struct { + FILE *fp; /* pointer to the message data */ + char *path; /* path to temp file */ + short magic; /* type of mailbox this message belongs to */ + short write; /* nonzero if message is open for writing */ + struct { + unsigned read:1; + unsigned flagged:1; + unsigned replied:1; + } flags; + time_t received; /* the time at which this message was received */ +} MESSAGE; + typedef struct { /* folder magic */ int type; /* may we stat() it? */ unsigned int local : 1; /* tests if given path is of its magic */ - int (*mx_is_magic) (const char*); + int (*mx_is_magic) (const char*, struct stat*); /* tests if folder is empty */ int (*mx_check_empty) (const char*); /* test for access */ int (*mx_access) (const char*, int); /* read mailbox into ctx structure */ int (*mx_open_mailbox) (CONTEXT*); + /* open new message */ + int (*mx_open_new_message) (MESSAGE*, CONTEXT*, HEADER*); /* check ACL flags; if not implemented, always assume granted * permissions */ int (*mx_acl_check) (CONTEXT*, int); + /* check for new mail; see mx_check_mailbox() below for return vals */ + int (*mx_check_mailbox) (CONTEXT*, int*, int); + /* fast closing */ + void (*mx_fastclose_mailbox) (CONTEXT*); + /* write out changes */ + int (*mx_sync_mailbox) (CONTEXT*, int, int*); } mx_t; /* called from main: init all folder types */ void mx_init (void); /* flags for mx_open_mailbox() */ -#define M_NOSORT (1<<0) /* do not sort the mailbox after opening it */ -#define M_APPEND (1<<1) /* open mailbox for appending messages */ -#define M_READONLY (1<<2) /* open in read-only mode */ -#define M_QUIET (1<<3) /* do not print any messages */ -#define M_NEWFOLDER (1<<4) /* create a new folder - same as M_APPEND, but uses - * safe_fopen() for mbox-style folders. - */ +#define M_NOSORT (1<<0) /* do not sort the mailbox after opening it */ +#define M_APPEND (1<<1) /* open mailbox for appending messages */ +#define M_READONLY (1<<2) /* open in read-only mode */ +#define M_QUIET (1<<3) /* do not print any messages */ +#define M_NEWFOLDER (1<<4) /* create a new folder - same as M_APPEND, but uses + * safe_fopen() for mbox-style folders. */ +#define M_COUNT (1<<5) /* just do counting? needed to do speed optimizations + for sidebar */ /* mx_open_new_message() */ -#define M_ADD_FROM 1 /* add a From_ line */ +#define M_ADD_FROM 1 /* add a From_ line */ #define MAXLOCKATTEMPT 5 -/* return values from mx_check_mailbox() */ -enum { - M_NEW_MAIL = 1, /* new mail received in mailbox */ - M_LOCKED, /* couldn't lock the mailbox */ - M_REOPENED, /* mailbox was reopened */ - M_FLAGS /* nondestructive flags change (IMAP) */ -}; - -typedef struct { - FILE *fp; /* pointer to the message data */ - char *path; /* path to temp file */ - short magic; /* type of mailbox this message belongs to */ - short write; /* nonzero if message is open for writing */ - struct { - unsigned read:1; - unsigned flagged:1; - unsigned replied:1; - } flags; - time_t received; /* the time at which this message was received */ -} MESSAGE; - WHERE short DefaultMagic INITVAL (M_MBOX); /* @@ -136,8 +140,21 @@ int mx_close_mailbox (CONTEXT *, int *); int mx_sync_mailbox (CONTEXT *, int *); int mx_commit_message (MESSAGE *, CONTEXT *); int mx_close_message (MESSAGE **); -int mx_get_magic (const char *); + +/* determines magic for given folder */ +int mx_get_magic (const char*); +/* sets/parses DefaultMagic */ int mx_set_magic (const char *); +/* tests whether given folder magic is (valid and) local */ +int mx_is_local (int); + +/* return values from mx_check_mailbox() */ +enum { + M_NEW_MAIL = 1, /* new mail received in mailbox */ + M_LOCKED, /* couldn't lock the mailbox */ + M_REOPENED, /* mailbox was reopened */ + M_FLAGS /* nondestructive flags change (IMAP) */ +}; int mx_check_mailbox (CONTEXT *, int *, int); int mx_access (const char *, int);