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