File: sieve-result.h

package info (click to toggle)
dovecot 1%3A2.2.13-12~deb8u4
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 38,792 kB
  • sloc: ansic: 341,472; sh: 16,920; makefile: 5,393; cpp: 1,474; perl: 265; xml: 44; python: 34; pascal: 27
file content (175 lines) | stat: -rw-r--r-- 4,933 bytes parent folder | download | duplicates (3)
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file
 */

#ifndef __SIEVE_RESULT_H
#define __SIEVE_RESULT_H

#include "sieve-common.h"
#include "sieve-error.h"

/*
 * Types
 */

struct sieve_side_effects_list;

/*
 * Result object
 */

struct sieve_result;

struct sieve_result *sieve_result_create
	(struct sieve_instance *svinst, const struct sieve_message_data *msgdata,
		const struct sieve_script_env *senv,
		struct sieve_error_handler *ehandler);

void sieve_result_ref(struct sieve_result *result);

void sieve_result_unref(struct sieve_result **result);

pool_t sieve_result_pool(struct sieve_result *result);

/*
 * Getters/Setters
 */

struct sieve_error_handler *sieve_result_get_error_handler
	(struct sieve_result *result);
void sieve_result_set_error_handler
	(struct sieve_result *result, struct sieve_error_handler *ehandler);

const struct sieve_script_env *sieve_result_get_script_env
	(struct sieve_result *result);
const struct sieve_message_data *sieve_result_get_message_data
	(struct sieve_result *result);
struct sieve_message_context *sieve_result_get_message_context
	(struct sieve_result *result);

/*
 * Extension support
 */

void sieve_result_extension_set_context
	(struct sieve_result *result, const struct sieve_extension *ext,
		void *context);
const void *sieve_result_extension_get_context
	(struct sieve_result *result, const struct sieve_extension *ext);

/*
 * Result printing
 */

struct sieve_result_print_env {
	struct sieve_result *result;
	const struct sieve_script_env *scriptenv;
	struct ostream *stream;
};

void sieve_result_vprintf
	(const struct sieve_result_print_env *penv, const char *fmt, va_list args)
		ATTR_FORMAT(2, 0);
void sieve_result_printf
	(const struct sieve_result_print_env *penv, const char *fmt, ...)
		ATTR_FORMAT(2, 3);
void sieve_result_action_printf
	(const struct sieve_result_print_env *penv, const char *fmt, ...)
		ATTR_FORMAT(2, 3);
void sieve_result_seffect_printf
	(const struct sieve_result_print_env *penv, const char *fmt, ...)
		ATTR_FORMAT(2, 3);

bool sieve_result_print
	(struct sieve_result *result, const struct sieve_script_env *senv,
		struct ostream *stream, bool *keep);

/*
 * Error handling
 */

void sieve_result_error
(const struct sieve_action_exec_env *aenv, const char *fmt, ...)
	ATTR_FORMAT(2, 3);
void sieve_result_global_error
(const struct sieve_action_exec_env *aenv, const char *fmt, ...)
	ATTR_FORMAT(2, 3);
void sieve_result_warning
(const struct sieve_action_exec_env *aenv, const char *fmt, ...)
	ATTR_FORMAT(2, 3);
void sieve_result_global_warning
(const struct sieve_action_exec_env *aenv, const char *fmt, ...)
	ATTR_FORMAT(2, 3);
void sieve_result_log
(const struct sieve_action_exec_env *aenv, const char *fmt, ...)
	ATTR_FORMAT(2, 3);
void sieve_result_global_log
(const struct sieve_action_exec_env *aenv, const char *fmt, ...)
	ATTR_FORMAT(2, 3);
void sieve_result_global_log_error
(const struct sieve_action_exec_env *aenv, const char *fmt, ...)
	ATTR_FORMAT(2, 3);
void sieve_result_global_log_warning
(const struct sieve_action_exec_env *aenv, const char *fmt, ...)
	ATTR_FORMAT(2, 3);

/*
 * Result composition
 */

void sieve_result_add_implicit_side_effect
(struct sieve_result *result, const struct sieve_action_def *to_action,
	bool to_keep, const struct sieve_extension *ext,
	const struct sieve_side_effect_def *seffect, void *context);

int sieve_result_add_action
	(const struct sieve_runtime_env *renv, const struct sieve_extension *ext,
		const struct sieve_action_def *act_def,
		struct sieve_side_effects_list *seffects,	void *context,
		unsigned int instance_limit, bool preserve_mail);
int sieve_result_add_keep
	(const struct sieve_runtime_env *renv,
		struct sieve_side_effects_list *seffects);

void sieve_result_set_keep_action
	(struct sieve_result *result, const struct sieve_extension *ext,
		const struct sieve_action_def *act_def);
void sieve_result_set_failure_action
	(struct sieve_result *result, const struct sieve_extension *ext,
		const struct sieve_action_def *act_def);

/*
 * Result execution
 */

int sieve_result_implicit_keep(struct sieve_result *result);

void sieve_result_mark_executed(struct sieve_result *result);

int sieve_result_execute(struct sieve_result *result, bool *keep);

bool sieve_result_executed(struct sieve_result *result);

/*
 * Result evaluation
 */

struct sieve_result_iterate_context;

struct sieve_result_iterate_context *sieve_result_iterate_init
	(struct sieve_result *result);
const struct sieve_action *sieve_result_iterate_next
	(struct sieve_result_iterate_context *rictx, bool *keep);
void sieve_result_iterate_delete
	(struct sieve_result_iterate_context *rictx);

/*
 * Side effects list
 */

struct sieve_side_effects_list *sieve_side_effects_list_create
	(struct sieve_result *result);
void sieve_side_effects_list_add
	(struct sieve_side_effects_list *list,
		const struct sieve_side_effect *seffect);

#endif