~ubuntu-branches/ubuntu/wily/dovecot/wily-proposed

4.1.54 by Jaldhar H. Vyas, 3f3bf71
[3f3bf71] Updated pigeonhole patch to 0.4.8 (Closes: #792669)
1
/* Copyright (c) 2002-2015 Pigeonhole authors, see the included COPYING file
4.8.1 by Marco Nenciarini
* [a4764a4] New upstream major release (Closes: #573889, #580929,
2
 */
3
4
/* Extension notify
5
 * ----------------
6
 *
7
 * Authors: Stephan Bosch
8
 * Specification: draft-ietf-sieve-notify-00.txt
9
 * Implementation: full, but deprecated; provided for backwards compatibility
10
 * Status: testing
11
 *
12
 */
13
14
#include "sieve-common.h"
15
16
#include "sieve-code.h"
17
#include "sieve-extensions.h"
18
#include "sieve-actions.h"
19
#include "sieve-commands.h"
20
#include "sieve-validator.h"
21
#include "sieve-generator.h"
22
#include "sieve-interpreter.h"
23
#include "sieve-result.h"
24
25
#include "ext-notify-common.h"
26
27
/*
28
 * Operations
29
 */
30
31
const struct sieve_operation_def *ext_notify_operations[] = {
32
	&notify_old_operation,
33
	&denotify_operation
34
};
35
4.8.4 by Jaldhar H. Vyas, Jaldhar H. Vyas
[ Jaldhar H. Vyas ]
36
/*
4.8.1 by Marco Nenciarini
* [a4764a4] New upstream major release (Closes: #573889, #580929,
37
 * Extension
38
 */
39
40
static bool ext_notify_validator_load
41
	(const struct sieve_extension *ext, struct sieve_validator *valdtr);
42
4.8.4 by Jaldhar H. Vyas, Jaldhar H. Vyas
[ Jaldhar H. Vyas ]
43
const struct sieve_extension_def notify_extension = {
4.8.5 by Jaldhar H. Vyas, Micah Anderson, Jaldhar H. Vyas
[ Micah Anderson ]
44
	.name = "notify",
45
	.validator_load = ext_notify_validator_load,
46
	SIEVE_EXT_DEFINE_OPERATIONS(ext_notify_operations)
4.8.1 by Marco Nenciarini
* [a4764a4] New upstream major release (Closes: #573889, #580929,
47
};
48
49
/*
50
 * Extension validation
51
 */
52
53
static bool ext_notify_validator_extension_validate
4.8.4 by Jaldhar H. Vyas, Jaldhar H. Vyas
[ Jaldhar H. Vyas ]
54
	(const struct sieve_extension *ext, struct sieve_validator *valdtr,
4.8.1 by Marco Nenciarini
* [a4764a4] New upstream major release (Closes: #573889, #580929,
55
		void *context, struct sieve_ast_argument *require_arg);
56
57
const struct sieve_validator_extension notify_validator_extension = {
58
	&notify_extension,
59
	ext_notify_validator_extension_validate,
60
	NULL
61
};
62
63
static bool ext_notify_validator_load
64
(const struct sieve_extension *ext, struct sieve_validator *valdtr)
65
{
66
	/* Register validator extension to check for conflict with enotify */
67
	sieve_validator_extension_register
68
		(valdtr, ext, &notify_validator_extension, NULL);
69
70
	/* Register new commands */
71
	sieve_validator_register_command(valdtr, ext, &cmd_notify_old);
72
	sieve_validator_register_command(valdtr, ext, &cmd_denotify);
4.8.4 by Jaldhar H. Vyas, Jaldhar H. Vyas
[ Jaldhar H. Vyas ]
73
4.8.1 by Marco Nenciarini
* [a4764a4] New upstream major release (Closes: #573889, #580929,
74
	return TRUE;
75
}
76
77
static bool ext_notify_validator_extension_validate
4.8.4 by Jaldhar H. Vyas, Jaldhar H. Vyas
[ Jaldhar H. Vyas ]
78
(const struct sieve_extension *ext, struct sieve_validator *valdtr,
4.8.1 by Marco Nenciarini
* [a4764a4] New upstream major release (Closes: #573889, #580929,
79
	void *context ATTR_UNUSED, struct sieve_ast_argument *require_arg)
80
{
81
	const struct sieve_extension *ext_entfy;
82
83
	if ( (ext_entfy=sieve_extension_get_by_name(ext->svinst, "enotify")) != NULL ) {
84
85
		/* Check for conflict with enotify */
86
		if ( sieve_validator_extension_loaded(valdtr, ext_entfy) ) {
87
			sieve_argument_validate_error(valdtr, require_arg,
88
				"the (deprecated) notify extension cannot be used "
89
				"together with the enotify extension");
90
			return FALSE;
91
		}
92
	}
93
94
	return TRUE;
95
}
4.1.26 by Jaldhar H. Vyas
* [85ae320] Imported Upstream version 2.0.18
96
97