|
#include <limits.h> |
|
|
|
|
|
|
|
|
/* Return values of functions. */ |
|
|
#define FAILURE 1 |
|
|
#define SUCCESS 0 |
|
|
|
|
1 |
/* Flags that control the program options that have been selected. */ |
/* Flags that control the program options that have been selected. */ |
2 |
#define OPTION_TEST_MODE 0x00000001 |
#define OPT_TEST_MODE 0x00000001 |
3 |
#define OPTION_DETAILS_QUITE 0x00000002 |
#define OPT_DETAILS_QUITE 0x00000002 |
4 |
#define OPTION_DETAILS_NORMAL 0x00000004 |
#define OPT_DETAILS_NORMAL 0x00000004 |
5 |
#define OPTION_DETAILS_VERBOSE 0x00000008 |
#define OPT_DETAILS_VERBOSE 0x00000008 |
6 |
#define OPTION_SHOW_HEADERS 0x00000010 |
#define OPT_SHOW_HEADERS 0x00000010 |
7 |
#define OPTION_DETAILS_CLEAR 0xFFFFFFF1 |
#define OPT_DETAILS_CLEAR 0xFFFFFFF1 |
8 |
|
|
9 |
/* Lengths of strings to save account settings. */ |
/* Lengths of strings to save account settings. */ |
10 |
#define SERVER_MAX 128 |
#define SERVER_MAX 128 |
11 |
#define USERNAME_MAX 64 |
#define USERID_MAX 64 |
12 |
#define PASSWORD_MAX 32 |
#define PASSWD_MAX 32 |
13 |
|
|
14 |
/* Lengths of strings that comprise the HEADER of a filter. */ |
/* Lengths of strings that comprise the HEADER of a filter. */ |
15 |
#define FIELD_NAME_MAX 64 |
#define FIELD_NAME_MAX 64 |
16 |
#define FIELD_BODY_MAX 512 |
#define FIELD_BODY_MAX 512 |
17 |
|
|
|
/* |
|
|
* Every how many filter entries found in the configuration file will |
|
|
* be space in memory will be allocated. |
|
|
*/ |
|
|
#define FILTER_ENTRIES_MAX 8 |
|
|
|
|
18 |
#define min(A, B) ((A) < (B) ? (A) : (B)) |
#define min(A, B) ((A) < (B) ? (A) : (B)) |
19 |
|
|
20 |
|
|
21 |
/* Account settings. */ |
/* Account settings. */ |
22 |
typedef struct { |
typedef struct account { |
23 |
char server[SERVER_MAX]; /* Hostname of mail server. */ |
char server[SERVER_MAX]; /* Hostname of mail server. */ |
24 |
unsigned short int port; /* Port to connect. */ |
unsigned short int port; /* Port to connect. */ |
25 |
char username[USERNAME_MAX]; |
char userid[USERID_MAX]; |
26 |
char password[PASSWORD_MAX]; |
char passwd[PASSWD_MAX]; |
27 |
} account_data; |
struct account *next; |
28 |
|
} account_t; |
29 |
|
|
30 |
/* A header filter entry. */ |
/* A header filter entry. */ |
31 |
typedef struct { |
typedef struct filter { |
32 |
char name[FIELD_NAME_MAX]; /* Header field name. */ |
char name[FIELD_NAME_MAX]; /* Header field name. */ |
33 |
int custom; /* If field name one of FROM, TO, |
int custom; /* If field name one of FROM, TO, |
34 |
CC, BCC, SUBJECT then zero. */ |
CC, BCC, SUBJECT then zero. */ |
35 |
char body[FIELD_BODY_MAX]; /* Header field body. */ |
char body[FIELD_BODY_MAX]; /* Header field body. */ |
36 |
} filter_entry; |
struct filter *next; |
37 |
|
} filter_t; |
38 |
|
|
39 |
|
|
40 |
void apply_filters(void); |
void apply_filters(void); |