Coverage Report

Created: 2026-10-17 06:32

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/pigeonhole/src/lib-sieve/plugins/index/ext-index.c
Line
Count
Source
1
/* Copyright (c) Pigeonhole authors, see top-level COPYING file */
2
3
/* Extension index
4
 * ------------------
5
 *
6
 * Authors: Stephan Bosch
7
 * Specification: RFC 5260
8
 * Implementation: full
9
 * Status: testing
10
 *
11
 */
12
13
#include "lib.h"
14
#include "array.h"
15
16
#include "sieve-common.h"
17
#include "sieve-message.h"
18
#include "sieve-extensions.h"
19
#include "sieve-commands.h"
20
21
#include "sieve-validator.h"
22
#include "sieve-generator.h"
23
#include "sieve-binary.h"
24
#include "sieve-interpreter.h"
25
#include "sieve-dump.h"
26
27
#include "ext-index-common.h"
28
29
/*
30
 * Extension
31
 */
32
33
static bool
34
ext_index_validator_load(const struct sieve_extension *ext,
35
       struct sieve_validator *validator);
36
37
const struct sieve_extension_def index_extension = {
38
  .name = "index",
39
  .validator_load = ext_index_validator_load,
40
  SIEVE_EXT_DEFINE_OPERAND(index_operand),
41
};
42
43
static bool ext_index_validator_load
44
(const struct sieve_extension *ext, struct sieve_validator *valdtr)
45
0
{
46
  /* Register :index and :last tags with header, address and date test
47
     commands and we don't care whether these command are registered or
48
     even whether these will be registered at all. The validator handles
49
     either situation gracefully.
50
   */
51
0
  sieve_validator_register_external_tag(
52
0
    valdtr, "header", ext, &index_tag, SIEVE_OPT_MESSAGE_OVERRIDE);
53
0
  sieve_validator_register_external_tag(
54
0
    valdtr, "header", ext, &last_tag, 0);
55
56
0
  sieve_validator_register_external_tag(
57
0
    valdtr, "address", ext, &index_tag, SIEVE_OPT_MESSAGE_OVERRIDE);
58
0
  sieve_validator_register_external_tag(
59
0
    valdtr, "address", ext, &last_tag, 0);
60
61
0
  sieve_validator_register_external_tag(
62
0
    valdtr, "date", ext, &index_tag, SIEVE_OPT_MESSAGE_OVERRIDE);
63
0
  sieve_validator_register_external_tag(
64
0
    valdtr, "date", ext, &last_tag, 0);
65
66
0
  return TRUE;
67
0
}