File: sieve-extprograms-plugin.c

package info (click to toggle)
dovecot 1:2.2.13-12~deb8u4
  • links: PTS, VCS
  • area: main
  • in suites: jessie
  • size: 38,792 kB
  • sloc: ansic: 341,472; sh: 16,920; makefile: 5,393; cpp: 1,474; perl: 265; xml: 44; python: 34; pascal: 27
file content (65 lines) | stat: -rw-r--r-- 1,487 bytes parent folder | download | duplicates (3)
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
/* Copyright (c) 2002-2013 Pigeonhole authors, see the included COPYING file
 */

#include "sieve-common.h"
#include "sieve-error.h"
#include "sieve-extensions.h"

#include "sieve-extprograms-common.h"
#include "sieve-extprograms-plugin.h"

/*
 * Sieve plugin interface
 */

struct _plugin_context {
	const struct sieve_extension *ext_pipe;
	const struct sieve_extension *ext_filter;
	const struct sieve_extension *ext_execute;		
};

void sieve_extprograms_plugin_load
(struct sieve_instance *svinst, void **context)
{
	struct _plugin_context *pctx = i_new(struct _plugin_context, 1);

	pctx->ext_pipe = sieve_extension_register
		(svinst, &pipe_extension, FALSE);
	pctx->ext_filter = sieve_extension_register
		(svinst, &filter_extension, FALSE);
	pctx->ext_execute = sieve_extension_register
		(svinst, &execute_extension, FALSE);

	if ( svinst->debug ) {
		sieve_sys_debug(svinst, "Sieve Extprograms plugin for %s version %s loaded",
			PIGEONHOLE_NAME, PIGEONHOLE_VERSION);
	}

	*context = (void *)pctx;
}

void sieve_extprograms_plugin_unload
(struct sieve_instance *svinst ATTR_UNUSED, void *context)
{
	struct _plugin_context *pctx = (struct _plugin_context *)context;

	sieve_extension_unregister(pctx->ext_pipe);
	sieve_extension_unregister(pctx->ext_filter);
	sieve_extension_unregister(pctx->ext_execute);

	i_free(pctx);
}

/*
 * Module interface
 */

void sieve_extprograms_plugin_init(void)
{
	/* Nothing */
}

void sieve_extprograms_plugin_deinit(void)
{
	/* Nothing */
}