X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=mx.h;h=828c4b8de44888b735564253bd39569360f7df86;hp=049434e1a0a71ccf9944842fdfc0715b6ceb4d2b;hb=8e6b42b9b28f646a6764936d80bda04647d5b45f;hpb=ee1d4d931ca3ebec494694b74a1868a7a2e631e3 diff --git a/mx.h b/mx.h index 049434e..828c4b8 100644 --- a/mx.h +++ b/mx.h @@ -17,7 +17,10 @@ #ifndef _MX_H #define _MX_H -/* supported mailbox formats */ +/* + * supported mailbox formats + * in mx_init() the registration order must be exactly as given here!!!1! + */ enum { M_MBOX = 1, M_MMDF, @@ -37,6 +40,49 @@ enum { #endif }; +enum { + ACL_LOOKUP = 0, + ACL_READ, + ACL_SEEN, + ACL_WRITE, + ACL_INSERT, + ACL_POST, + ACL_CREATE, + ACL_DELETE, + ACL_ADMIN, + + RIGHTSMAX +}; + +/* ugly hack to define macro once (for pager+index) */ +#define CHECK_MX_ACL(c,f,s) if(!mx_acl_check(c,f)) \ + {\ + mutt_flushinp (); \ + mutt_error(_("%s not permitted by ACL."), s); \ + break; \ + } + +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*); + /* 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*); + /* check ACL flags; if not implemented, always assume granted + * permissions */ + int (*mx_acl_check) (CONTEXT*, 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 */ @@ -74,6 +120,11 @@ typedef struct { WHERE short DefaultMagic INITVAL (M_MBOX); +/* + * please use the following _ONLY_ when doing "something" + * with folders + */ + CONTEXT *mx_open_mailbox (const char *, int, CONTEXT *); MESSAGE *mx_open_message (CONTEXT *, int); @@ -89,19 +140,11 @@ int mx_get_magic (const char *); int mx_set_magic (const char *); int mx_check_mailbox (CONTEXT *, int *, int); -#ifdef USE_IMAP -int mx_is_imap (const char *); -#endif -#ifdef USE_POP -int mx_is_pop (const char *); -#endif -#ifdef USE_NNTP -int mx_is_nntp (const char *); -#endif - int mx_access (const char *, int); int mx_check_empty (const char *); +int mx_acl_check (CONTEXT*, int); + void mx_alloc_memory (CONTEXT *); void mx_update_context (CONTEXT *, int); void mx_update_tables (CONTEXT *, int);