-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmbconfig.h
107 lines (94 loc) · 2.16 KB
/
mbconfig.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#ifndef MBIDLED_MBCONFIG_H
#define MBIDLED_MBCONFIG_H
#include <stdio.h>
#include <sys/queue.h>
struct mbconfig_imap_account {
SLIST_ENTRY(mbconfig_imap_account) link;
char *name;
char *host;
char *port;
char *user;
char *user_cmd;
char *pass;
char *pass_cmd;
char *tunnel_cmd;
int login_auth;
enum {
MBCONFIG_SSL_NONE,
MBCONFIG_SSL_STARTTLS,
MBCONFIG_SSL_IMAPS,
} ssl;
int ssl_versions;
int system_certs;
char *cert_file;
char *ciphers;
};
struct mbconfig_imap_store {
SLIST_ENTRY(mbconfig_imap_store) link;
char *name;
struct mbconfig_imap_account *account;
};
struct mbconfig_maildir_store {
SLIST_ENTRY(mbconfig_maildir_store) link;
char *name;
char *path;
char *inbox;
};
struct mbconfig_store {
enum mbconfig_store_type {
MBCONFIG_STORE_IMAP,
MBCONFIG_STORE_MAILDIR,
} type;
union {
void *store;
struct mbconfig_imap_store *imap_store;
struct mbconfig_maildir_store *maildir_store;
};
char *mailbox;
};
struct mbconfig_str {
SLIST_ENTRY(mbconfig_str) link;
char *str;
};
SLIST_HEAD(mbconfig_str_list, mbconfig_str);
struct mbconfig_mbidled_channel {
int start_timeout;
int start_interval;
enum {
MBCONFIG_PROPAGATE_FAR = 1 << 0,
MBCONFIG_PROPAGATE_NEAR = 1 << 1,
} strict_propagate;
};
struct mbconfig_channel {
SLIST_ENTRY(mbconfig_channel) link;
char *name;
struct mbconfig_store far;
struct mbconfig_store near;
enum {
MBCONFIG_SYNC_PULL = 1 << 0,
MBCONFIG_SYNC_PUSH = 1 << 1,
} sync;
struct mbconfig_str_list patterns;
struct mbconfig_mbidled_channel mbidled;
};
struct mbconfig {
char *filename;
SLIST_HEAD(, mbconfig_imap_account) imap_accounts;
SLIST_HEAD(, mbconfig_imap_store) imap_stores;
SLIST_HEAD(, mbconfig_maildir_store) maildir_stores;
SLIST_HEAD(, mbconfig_channel) channels;
};
struct mbconfig_parser {
FILE *stream;
int lnum;
char buf[1024];
int col;
char *arg;
char const *error_msg;
struct mbconfig *config;
struct mbconfig_mbidled_channel channel_config[2];
};
int mbconfig_parse(struct mbconfig_parser *ctx, char const *filename);
void mbconfig_eval_cmd_option(char **option, char const *option_cmd);
int mbconfig_patterns_test(struct mbconfig_str_list const *patterns, char const *s);
#endif