1 |
lefcha |
1.1 |
#ifndef ACCOUNT_H |
2 |
|
|
#define ACCOUNT_H |
3 |
|
|
|
4 |
lefcha |
1.4 |
|
5 |
lefcha |
1.6 |
#include <sys/types.h> /* For POSIX.1-2001 non-conformant systems. */ |
6 |
lefcha |
1.1 |
#include <regex.h> |
7 |
|
|
|
8 |
|
|
#include "config.h" |
9 |
|
|
|
10 |
|
|
|
11 |
|
|
/* String lengths of account settings. */ |
12 |
lefcha |
1.5 |
#define SERVER_LEN (635 + 1) /* Section 2.5 RFC 1123. */ |
13 |
|
|
#define USER_LEN 128 |
14 |
|
|
#define PASS_LEN 128 |
15 |
lefcha |
1.1 |
|
16 |
|
|
/* Attributes of a password. */ |
17 |
lefcha |
1.5 |
#define PASS_ATTR_NONE 0 |
18 |
|
|
#define PASS_ATTR_PLAIN 1 |
19 |
|
|
#define PASS_ATTR_CRYPT 2 |
20 |
lefcha |
1.1 |
|
21 |
|
|
/* Secure Socket Layer protocols. */ |
22 |
lefcha |
1.5 |
#define SSL_DISABLED 0 |
23 |
|
|
#define SSL_SSL_V2 1 |
24 |
|
|
#define SSL_SSL_V3 2 |
25 |
|
|
#define SSL_TLS_V1 3 |
26 |
lefcha |
1.1 |
|
27 |
|
|
/* String length of keys (aliases). */ |
28 |
lefcha |
1.5 |
#define KEY_LEN 32 |
29 |
lefcha |
1.1 |
|
30 |
|
|
/* String length of mailbox's name. */ |
31 |
lefcha |
1.5 |
#define MBOX_LEN 128 |
32 |
lefcha |
1.1 |
|
33 |
|
|
/* Maximum filters assigned to a mailbox. */ |
34 |
lefcha |
1.5 |
#define MBOX_FILTERS_MAX 64 |
35 |
lefcha |
1.1 |
|
36 |
|
|
/* Maximum mailboxes contained in a mailbox-group. */ |
37 |
lefcha |
1.5 |
#define MBOXGRP_MBOXES_MAX 64 |
38 |
lefcha |
1.1 |
|
39 |
|
|
|
40 |
|
|
/* Account. */ |
41 |
|
|
typedef struct account { |
42 |
|
|
char key[KEY_LEN]; /* Alias of account. */ |
43 |
|
|
char server[SERVER_LEN];/* Hostname of mail server. */ |
44 |
|
|
unsigned short int port;/* Port to connect. */ |
45 |
lefcha |
1.5 |
char user[USER_LEN]; /* Username. */ |
46 |
|
|
char *pass; /* Password. */ |
47 |
|
|
int pass_attr; /* Password attributes. */ |
48 |
lefcha |
1.1 |
unsigned int ssl; /* Secure Socket Layer support. */ |
49 |
|
|
struct mbox *mboxes; /* Mailboxes. */ |
50 |
|
|
struct account *next; /* Next node of linked list. */ |
51 |
|
|
} account_t; |
52 |
|
|
|
53 |
|
|
/* Mailbox. */ |
54 |
|
|
typedef struct mbox { |
55 |
lefcha |
1.5 |
char name[MBOX_LEN]; /* Name of mailbox. */ |
56 |
lefcha |
1.1 |
struct filter *filters[MBOX_FILTERS_MAX]; /* Filters to be |
57 |
|
|
* applied. */ |
58 |
|
|
struct mbox *next; /* Next node of linked list. */ |
59 |
|
|
} mbox_t; |
60 |
|
|
|
61 |
|
|
/* Group of mailboxes. */ |
62 |
|
|
typedef struct mboxgrp { |
63 |
|
|
char key[KEY_LEN]; /* Alias of mailbox group. */ |
64 |
|
|
struct mbox *mboxes[MBOXGRP_MBOXES_MAX]; /* Mailboxes of group. */ |
65 |
|
|
struct mboxgrp *left, *right; /* Left/right nodes of tree. */ |
66 |
|
|
} mboxgrp_t; |
67 |
|
|
|
68 |
|
|
|
69 |
|
|
/* account.c */ |
70 |
|
|
int set_account(char *line, regmatch_t * match); |
71 |
|
|
int set_mboxgrp(char *line, regmatch_t * match); |
72 |
|
|
|
73 |
|
|
#ifdef ENCRYPTED_PASSWORDS |
74 |
|
|
char *find_password(char *user, char *serv); |
75 |
|
|
#endif |
76 |
|
|
|
77 |
|
|
char *apply_namespace(char *mbox, char *prefix, char delim); |
78 |
|
|
|
79 |
|
|
|
80 |
|
|
#endif /* ACCOUNT_H */ |