rationnalize includes a lot:
[apps/madmutt.git] / pop / mx_pop.c
1 /*
2  * This file is part of mutt-ng, see http://www.muttng.org/.
3  * It's licensed under the GNU General Public License,
4  * please see the file GPL in the top level source directory.
5  */
6
7 #include <lib-lib/lib-lib.h>
8
9 #include "mutt.h"
10 #include "pop.h"
11 #include "mx.h"
12 #include "mx_pop.h"
13
14 static int pop_is_magic (const char* path, struct stat* st __attribute__ ((unused))) {
15   url_scheme_t s = url_check_scheme (NONULL (path));
16   return ((s == U_POP || s == U_POPS) ? M_POP : -1);
17 }
18
19 static int acl_check_pop (CONTEXT* ctx __attribute__ ((unused)), int bit) {
20   switch (bit) {
21     case ACL_INSERT:    /* editing messages */
22     case ACL_WRITE:     /* change importance */
23       return (0);
24     case ACL_DELETE:    /* (un)deletion */
25     case ACL_SEEN:      /* mark as read */
26       return (1);
27     default:
28       return (0);
29   }
30 }
31
32 mx_t* pop_reg_mx (void) {
33   mx_t* fmt = p_new(mx_t, 1);
34
35   /* make up mx_t record... */
36   fmt->type = M_POP;
37   fmt->mx_is_magic = pop_is_magic;
38   fmt->mx_open_mailbox = pop_open_mailbox;
39   fmt->mx_acl_check = acl_check_pop;
40   fmt->mx_fastclose_mailbox = pop_close_mailbox;
41   fmt->mx_sync_mailbox = pop_sync_mailbox;
42   fmt->mx_check_mailbox = pop_check_mailbox;
43   return (fmt);
44 }