2 |
#define FILTER_H |
#define FILTER_H |
3 |
|
|
4 |
|
|
5 |
#include <sys/types.h> /* IEEE Std 1003.1-2001 non-conformance. */ |
#include <sys/types.h> /* IEEE Std 1003.1-2001 transitional. */ |
6 |
#include <regex.h> |
#include <regex.h> |
7 |
|
|
8 |
#include "account.h" |
#include "account.h" |
12 |
* Mode for masks that comprise a filter. So if a filter is of AND type then |
* Mode for masks that comprise a filter. So if a filter is of AND type then |
13 |
* as default masks are ANDed. |
* as default masks are ANDed. |
14 |
*/ |
*/ |
15 |
#define FILTER_MODE_OR 1 |
#define FILTER_MODE_OR 1 |
16 |
#define FILTER_MODE_AND 2 |
#define FILTER_MODE_AND 2 |
17 |
|
|
18 |
/* Action to do in case of filter matching. */ |
/* Action to do in case of filter matching. */ |
19 |
#define FILTER_ACTION_DELETE 1 |
#define ACTION_DELETE 1 |
20 |
#define FILTER_ACTION_COPY 2 |
#define ACTION_COPY 2 |
21 |
#define FILTER_ACTION_MOVE 3 |
#define ACTION_MOVE 3 |
22 |
#define FILTER_ACTION_RCOPY 4 |
#define ACTION_RCOPY 4 |
23 |
#define FILTER_ACTION_RMOVE 5 |
#define ACTION_RMOVE 5 |
24 |
#define FILTER_ACTION_FLAG_REPLACE 6 |
#define ACTION_FLAG_REPLACE 6 |
25 |
#define FILTER_ACTION_FLAG_ADD 7 |
#define ACTION_FLAG_ADD 7 |
26 |
#define FILTER_ACTION_FLAG_REMOVE 8 |
#define ACTION_FLAG_REMOVE 8 |
27 |
#define FILTER_ACTION_LIST 9 |
#define ACTION_LIST 9 |
28 |
|
|
29 |
/* Message flags to replace/add/remove. */ |
/* Message flags to replace/add/remove. */ |
30 |
#define MESSAGE_FLAG_NONE 0x00 |
#define MSG_FLAG_NONE 0x00 |
31 |
#define MESSAGE_FLAG_SEEN 0x01 |
#define MSG_FLAG_SEEN 0x01 |
32 |
#define MESSAGE_FLAG_ANSWERED 0x02 |
#define MSG_FLAG_ANSWERED 0x02 |
33 |
#define MESSAGE_FLAG_FLAGGED 0x04 |
#define MSG_FLAG_FLAGGED 0x04 |
34 |
#define MESSAGE_FLAG_DELETED 0x08 |
#define MSG_FLAG_DELETED 0x08 |
35 |
#define MESSAGE_FLAG_DRAFT 0x10 |
#define MSG_FLAG_DRAFT 0x10 |
36 |
|
|
37 |
/* Type of mask. This overrides the default filter mode (AND/OR). */ |
/* Type of mask. This overrides the default filter mode (AND/OR). */ |
38 |
#define MASK_TYPE_OR 1 |
#define MASK_TYPE_OR 1 |
39 |
#define MASK_TYPE_AND 2 |
#define MASK_TYPE_AND 2 |
40 |
|
|
41 |
/* Type of mask match according to the four different regular expressions. */ |
/* Type of mask match according to the four different regular expressions. */ |
42 |
#define MASK_MATCH_1 1 |
#define MASK_MATCH_1 1 |
43 |
#define MASK_MATCH_2 2 |
#define MASK_MATCH_2 2 |
44 |
#define MASK_MATCH_3 3 |
#define MASK_MATCH_3 3 |
45 |
#define MASK_MATCH_4 4 |
#define MASK_MATCH_4 4 |
46 |
|
|
47 |
/* String length of action's arguments. */ |
/* String length of action's arguments. */ |
48 |
#define ARGS_LEN 256 |
#define ARGS_LEN 256 |
49 |
|
|
50 |
/* String length of mask's body. */ |
/* String length of mask's body. */ |
51 |
#define MASK_BODY_LEN 256 |
#define MASK_BODY_LEN 256 |
52 |
|
|
53 |
/* Maximum filters assigned to a mailbox. */ |
/* Maximum filters assigned to a mailbox. */ |
54 |
#define MBOX_FILTERS_MAX 64 |
#define MBOX_FILTERS_MAX 64 |
55 |
|
|
56 |
|
|
57 |
/* Filter. */ |
/* Filter. */ |
63 |
unsigned int type; /* Action. */ |
unsigned int type; /* Action. */ |
64 |
account_t *raccount; /* Remote account to rcopy/rmove |
account_t *raccount; /* Remote account to rcopy/rmove |
65 |
* message. */ |
* message. */ |
66 |
char destmbox[MBOX_NAME_LEN]; /* Destination mailbox. */ |
char destmbox[MBOX_LEN]; /* Destination mailbox. */ |
67 |
unsigned int msgflags; /* Message flags to |
unsigned int msgflags; /* Message flags to replace/add/remove. */ |
|
* replace/add/remove. */ |
|
68 |
char args[ARGS_LEN]; /* Action's arguments. */ |
char args[ARGS_LEN]; /* Action's arguments. */ |
69 |
} action; |
} action; |
70 |
|
|