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 |
/* Size of buffer that holds the results of the searching and matching |
26 |
of filters. */ |
27 |
#define SEARCH_RESULTS_MAX 512 |
28 |
|
29 |
/* Every how many filter entries found in the configuration file will |
30 |
be space in memory will be allocated. */ |
31 |
#define FILTER_ENTRIES_MAX 8 |
32 |
|
33 |
#define min(A, B) ((A) < (B) ? (A) : (B)) |
34 |
|
35 |
|
36 |
/* Account settings. */ |
37 |
typedef struct { |
38 |
char server[SERVER_MAX]; /* Hostname of mail server. */ |
39 |
unsigned short int port; /* Port to connect. */ |
40 |
char username[USERNAME_MAX]; |
41 |
char password[PASSWORD_MAX]; |
42 |
char logfile[PATH_MAX]; |
43 |
} account_data; |
44 |
|
45 |
/* A header filter entry. */ |
46 |
typedef struct { |
47 |
char name[FIELD_NAME_MAX]; /* Header field name. */ |
48 |
int explicit; /* If field name one of FROM, TO, CC, BCC, |
49 |
SUBJECT then zero. */ |
50 |
char body[FIELD_BODY_MAX]; /* Header field body. */ |
51 |
} filter_entry; |
52 |
|
53 |
|
54 |
void apply_filters(void); |