1 |
#include <limits.h> |
2 |
|
3 |
|
4 |
/* Return values of functions. */ |
5 |
#define FAILURE 1 |
6 |
#define SUCCESS 0 |
7 |
|
8 |
/* Flags that control the program options that have been selected. */ |
9 |
#define OPTION_TEST_MODE 0x00000001 |
10 |
#define OPTION_DETAILS_QUITE 0x00000002 |
11 |
#define OPTION_DETAILS_NORMAL 0x00000004 |
12 |
#define OPTION_DETAILS_VERBOSE 0x00000008 |
13 |
#define OPTION_LOGGING_DISABLED 0x00000010 |
14 |
#define OPTION_DETAILS_CLEAR 0xFFFFFFF1 |
15 |
|
16 |
/* Lengths of strings to save account settings. */ |
17 |
#define SERVER_MAX 128 |
18 |
#define USERNAME_MAX 64 |
19 |
#define PASSWORD_MAX 32 |
20 |
|
21 |
/* Lengths of strings that comprise the HEADER of a filter. */ |
22 |
#define FIELD_NAME_MAX 64 |
23 |
#define FIELD_BODY_MAX 512 |
24 |
|
25 |
/* |
26 |
* Size of buffer that holds the results of the searching and matching |
27 |
* of filters. |
28 |
*/ |
29 |
#define SEARCH_RESULTS_MAX 512 |
30 |
|
31 |
/* |
32 |
* Every how many filter entries found in the configuration file will |
33 |
* be space in memory will be allocated. |
34 |
*/ |
35 |
#define FILTER_ENTRIES_MAX 8 |
36 |
|
37 |
#define min(A, B) ((A) < (B) ? (A) : (B)) |
38 |
|
39 |
|
40 |
/* Account settings. */ |
41 |
typedef struct { |
42 |
char server[SERVER_MAX]; /* Hostname of mail server. */ |
43 |
unsigned short int port; /* Port to connect. */ |
44 |
char username[USERNAME_MAX]; |
45 |
char password[PASSWORD_MAX]; |
46 |
char logfile[PATH_MAX]; |
47 |
} account_data; |
48 |
|
49 |
/* A header filter entry. */ |
50 |
typedef struct { |
51 |
char name[FIELD_NAME_MAX]; /* Header field name. */ |
52 |
int custom; /* If field name one of FROM, TO, |
53 |
CC, BCC, SUBJECT then zero. */ |
54 |
char body[FIELD_BODY_MAX]; /* Header field body. */ |
55 |
} filter_entry; |
56 |
|
57 |
|
58 |
void apply_filters(void); |
59 |
void usage(void); |