-
Notifications
You must be signed in to change notification settings - Fork 29
/
sieve-tool.h
103 lines (76 loc) · 2.24 KB
/
sieve-tool.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
/* Copyright (c) 2002-2018 Pigeonhole authors, see the included COPYING file
*/
#ifndef __SIEVE_TOOL_H
#define __SIEVE_TOOL_H
#include "sieve-common.h"
/*
* Types
*/
typedef const char *(*sieve_tool_setting_callback_t)
(void *context, const char *identifier);
/*
* Global variables
*/
extern struct sieve_tool *sieve_tool;
/*
* Initialization
*/
struct sieve_tool *sieve_tool_init
(const char *name, int *argc, char **argv[], const char *getopt_str,
bool no_config);
int sieve_tool_getopt(struct sieve_tool *tool);
struct sieve_instance *sieve_tool_init_finish
(struct sieve_tool *tool, bool init_mailstore, bool preserve_root);
void sieve_tool_deinit(struct sieve_tool **_tool);
/*
* Mail environment
*/
void sieve_tool_init_mail_user
(struct sieve_tool *tool, const char *mail_location);
struct mail *sieve_tool_open_file_as_mail
(struct sieve_tool *tool, const char *path);
struct mail *sieve_tool_open_data_as_mail
(struct sieve_tool *tool, string_t *mail_data);
/*
* Accessors
*/
const char *sieve_tool_get_username
(struct sieve_tool *tool);
const char *sieve_tool_get_homedir
(struct sieve_tool *tool);
struct mail_user *sieve_tool_get_mail_user
(struct sieve_tool *tool);
/*
* Configuration
*/
void sieve_tool_set_homedir(struct sieve_tool *tool, const char *homedir);
void sieve_tool_set_setting_callback
(struct sieve_tool *tool, sieve_tool_setting_callback_t callback,
void *context);
/*
* Commonly needed functionality
*/
void sieve_tool_get_envelope_data
(struct sieve_message_data *msgdata, struct mail *mail,
const struct smtp_address *sender,
const struct smtp_address *rcpt_orig,
const struct smtp_address *rcpt_final);
/*
* File I/O
*/
struct ostream *sieve_tool_open_output_stream(const char *filename);
/*
* Sieve script handling
*/
struct sieve_binary *sieve_tool_script_compile
(struct sieve_instance *svinst, const char *filename, const char *name);
struct sieve_binary *sieve_tool_script_open
(struct sieve_instance *svinst, const char *filename);
void sieve_tool_dump_binary_to
(struct sieve_binary *sbin, const char *filename, bool hexdump);
/*
* Command line option parsing
*/
void sieve_tool_parse_trace_option
(struct sieve_trace_config *tr_config, const char *tr_option);
#endif /* __SIEVE_TOOL_H */