Coverage Report

Created: 2026-09-03 07:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/pigeonhole/src/lib-sieve/plugins/variables/ext-variables.c
Line
Count
Source
1
/* Copyright (c) Pigeonhole authors, see top-level COPYING file */
2
3
/* Extension variables
4
 * -------------------
5
 *
6
 * Authors: Stephan Bosch
7
 * Specification: RFC 5229
8
 * Implementation: full
9
 * Status: testing
10
 *
11
 */
12
13
#include "lib.h"
14
#include "str.h"
15
#include "unichar.h"
16
17
#include "sieve-extensions.h"
18
#include "sieve-commands.h"
19
#include "sieve-binary.h"
20
#include "sieve-interpreter.h"
21
22
#include "sieve-validator.h"
23
24
#include "ext-variables-common.h"
25
#include "ext-variables-arguments.h"
26
#include "ext-variables-operands.h"
27
#include "ext-variables-namespaces.h"
28
#include "ext-variables-modifiers.h"
29
#include "ext-variables-dump.h"
30
31
/*
32
 * Operations
33
 */
34
35
const struct sieve_operation_def *ext_variables_operations[] = {
36
  &cmd_set_operation,
37
  &tst_string_operation,
38
};
39
40
/*
41
 * Operands
42
 */
43
44
const struct sieve_operand_def *ext_variables_operands[] = {
45
  &variable_operand,
46
  &match_value_operand,
47
  &namespace_variable_operand,
48
  &modifier_operand,
49
};
50
51
/*
52
 * Extension
53
 */
54
55
static bool
56
ext_variables_validator_load(const struct sieve_extension *ext,
57
           struct sieve_validator *validator);
58
59
const struct sieve_extension_def variables_extension = {
60
  .name = "variables",
61
  .load = ext_variables_load,
62
  .unload = ext_variables_unload,
63
  .validator_load = ext_variables_validator_load,
64
  .generator_load = ext_variables_generator_load,
65
  .interpreter_load = ext_variables_interpreter_load,
66
  .code_dump = ext_variables_code_dump,
67
  SIEVE_EXT_DEFINE_OPERATIONS(ext_variables_operations),
68
  SIEVE_EXT_DEFINE_OPERANDS(ext_variables_operands),
69
};
70
71
static bool
72
ext_variables_validator_load(const struct sieve_extension *ext,
73
           struct sieve_validator *validator)
74
0
{
75
0
  sieve_validator_argument_override(validator, SAT_VAR_STRING, ext,
76
0
            &variable_string_argument);
77
78
0
  sieve_validator_register_command(validator, ext, &cmd_set);
79
0
  sieve_validator_register_command(validator, ext, &tst_string);
80
81
0
  ext_variables_validator_initialize(ext, validator);
82
83
0
  return TRUE;
84
0
}