X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=mx.h;h=f2a4e59b1922785564be9cc9688b8fcac54876af;hp=9bd75e7be474e43f712127c2db25f88ea418725b;hb=34a88259726b0a7dacc3affe6f37214f893c9ce3;hpb=25bf57d598476b329536fa3f748cc0c529fef6bd diff --git a/mx.h b/mx.h index 9bd75e7..f2a4e59 100644 --- a/mx.h +++ b/mx.h @@ -17,6 +17,8 @@ #ifndef _MX_H #define _MX_H +#include + /* * supported mailbox formats * in mx_init() the registration order must be exactly as given here!!!1! @@ -40,19 +42,44 @@ 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*); + 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*); + /* 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 */ @@ -95,6 +122,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); @@ -106,13 +138,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); + int mx_check_mailbox (CONTEXT *, int *, int); 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);