Coverage Report

Created: 2026-08-13 06:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/pigeonhole/src/lib-sieve/plugins/vacation/ext-vacation-common.c
Line
Count
Source
1
/* Copyright (c) Pigeonhole authors, see top-level COPYING file */
2
3
#include "lib.h"
4
#include "settings.h"
5
6
#include "sieve-common.h"
7
#include "sieve-error.h"
8
#include "sieve-extensions.h"
9
10
#include "ext-vacation-common.h"
11
12
int ext_vacation_load(const struct sieve_extension *ext, void **context)
13
0
{
14
0
  struct sieve_instance *svinst = ext->svinst;
15
0
  const struct ext_vacation_settings *set;
16
0
  struct ext_vacation_context *extctx;
17
0
  const char *error;
18
19
0
  if (*context != NULL) {
20
0
    ext_vacation_unload(ext);
21
0
    *context = NULL;
22
0
  }
23
24
0
  if (settings_get(svinst->event, &ext_vacation_setting_parser_info, 0,
25
0
       &set, &error) < 0) {
26
0
    e_error(svinst->event, "%s", error);
27
0
    return -1;
28
0
  }
29
30
0
  extctx = i_new(struct ext_vacation_context, 1);
31
0
  extctx->set = set;
32
33
0
  *context = extctx;
34
0
  return 0;
35
0
}
36
37
void ext_vacation_unload(const struct sieve_extension *ext)
38
0
{
39
0
  struct ext_vacation_context *extctx = ext->context;
40
41
0
  if (extctx == NULL)
42
0
    return;
43
0
  settings_free(extctx->set);
44
  i_free(extctx);
45
0
}