File: ext-ihave.c

package info (click to toggle)
dovecot 1%3A2.2.33.2-1~bpo8%2B1
  • links: PTS, VCS
  • area: main
  • in suites: jessie-backports-sloppy
  • size: 50,420 kB
  • sloc: ansic: 449,977; sh: 9,653; makefile: 6,792; cpp: 1,557; perl: 295; python: 73; xml: 44; pascal: 27
file content (70 lines) | stat: -rw-r--r-- 1,601 bytes parent folder | download
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
/* Copyright (c) 2002-2017 Pigeonhole authors, see the included COPYING file
 */

/* Extension ihave
 * ---------------
 *
 * Authors: Stephan Bosch
 * Specification: RFC 5463
 * Implementation: full
 * Status: testing
 *
 */

#include "lib.h"

#include "sieve-common.h"
#include "sieve-extensions.h"
#include "sieve-code.h"
#include "sieve-binary.h"
#include "sieve-validator.h"
#include "sieve-generator.h"

#include "ext-ihave-common.h"
#include "ext-ihave-binary.h"

/*
 * Operations
 */

const struct sieve_operation_def *ext_ihave_operations[] = {
	&tst_ihave_operation,
	&cmd_error_operation
};

/*
 * Extension
 */

static bool ext_ihave_validator_load
	(const struct sieve_extension *ext, struct sieve_validator *validator);
static bool ext_ihave_generator_load
	(const struct sieve_extension *ext, const struct sieve_codegen_env *cgenv);

const struct sieve_extension_def ihave_extension = {
	"ihave",
	.version = 1,
	.validator_load = ext_ihave_validator_load,
	.generator_load = ext_ihave_generator_load,
	.binary_load = ext_ihave_binary_load,
	.binary_dump = ext_ihave_binary_dump,
	SIEVE_EXT_DEFINE_OPERATIONS(ext_ihave_operations)
};

static bool ext_ihave_validator_load
(const struct sieve_extension *ext, struct sieve_validator *validator)
{
	sieve_validator_register_command(validator, ext, &ihave_test);
	sieve_validator_register_command(validator, ext, &error_command);

	return TRUE;
}

static bool ext_ihave_generator_load
(const struct sieve_extension *ext, const struct sieve_codegen_env *cgenv)
{
	(void)ext_ihave_binary_init(ext, cgenv->sbin, cgenv->ast);

	return TRUE;
}