From 1b2660d2ea6c110480b1345bc39e1f0f6730361a Mon Sep 17 00:00:00 2001 From: Stephan Bosch <stephan@rename-it.nl> Date: Mon, 22 Oct 2007 12:32:53 +0200 Subject: [PATCH] * Further developed the extension support * Added plugins as static libraries (for now) --- configure.in | 2 + src/lib-sieve/Makefile.am | 5 +- src/lib-sieve/ext-envelope.c | 60 ++- src/lib-sieve/ext-fileinto.c | 2 +- src/lib-sieve/ext-reject.c | 2 +- src/lib-sieve/plugins/Makefile | 483 ++++++++++++++++++ src/lib-sieve/plugins/Makefile.am | 1 + src/lib-sieve/plugins/Makefile.in | 483 ++++++++++++++++++ .../plugins/comparator-i;ascii-numeric.c | 0 src/lib-sieve/plugins/copy.c | 1 - src/lib-sieve/plugins/vacation/Makefile.am | 10 + src/lib-sieve/plugins/vacation/ext-vacation.c | 233 +++++++++ src/lib-sieve/plugins/vacation/vacation.sieve | 24 + src/lib-sieve/scripts/tests/extensions.sieve | 4 +- src/lib-sieve/sieve-extensions.c | 5 +- 15 files changed, 1304 insertions(+), 11 deletions(-) create mode 100644 src/lib-sieve/plugins/Makefile create mode 100644 src/lib-sieve/plugins/Makefile.am create mode 100644 src/lib-sieve/plugins/Makefile.in delete mode 100644 src/lib-sieve/plugins/comparator-i;ascii-numeric.c delete mode 100644 src/lib-sieve/plugins/copy.c create mode 100644 src/lib-sieve/plugins/vacation/Makefile.am create mode 100644 src/lib-sieve/plugins/vacation/ext-vacation.c create mode 100644 src/lib-sieve/plugins/vacation/vacation.sieve diff --git a/configure.in b/configure.in index 0c0fc1ecf..5d99e296d 100644 --- a/configure.in +++ b/configure.in @@ -58,6 +58,8 @@ AC_CONFIG_FILES([ Makefile src/Makefile src/lib-sieve/Makefile +src/lib-sieve/plugins/Makefile +src/lib-sieve/plugins/vacation/Makefile stamp.h]) AC_OUTPUT diff --git a/src/lib-sieve/Makefile.am b/src/lib-sieve/Makefile.am index 243d17ea2..84f2675a0 100644 --- a/src/lib-sieve/Makefile.am +++ b/src/lib-sieve/Makefile.am @@ -1,5 +1,7 @@ #noinst_LTLIBRARIES = libsieve-dovecot.la +SUBDIRS = plugins + sbin_PROGRAMS = sievec AM_CPPFLAGS = \ @@ -7,7 +9,8 @@ AM_CPPFLAGS = \ -I$(dovecot_incdir)/src/lib sievec_LDADD = \ - ${dovecot_incdir}/src/lib/liblib.a + ${dovecot_incdir}/src/lib/liblib.a \ + ./plugins/vacation/lib_ext_vacation.a tsts = \ tst-not.c \ diff --git a/src/lib-sieve/ext-envelope.c b/src/lib-sieve/ext-envelope.c index fe17a5c8a..4379bea71 100644 --- a/src/lib-sieve/ext-envelope.c +++ b/src/lib-sieve/ext-envelope.c @@ -1,21 +1,29 @@ +#include <stdio.h> + #include "sieve-extensions.h" #include "sieve-commands.h" #include "sieve-validator.h" +#include "sieve-generator.h" +#include "sieve-interpreter.h" /* Forward declarations */ static bool ext_envelope_validator_load(struct sieve_validator *validator); +static bool ext_envelope_opcode_dump(struct sieve_interpreter *interpreter); + static bool tst_envelope_registered (struct sieve_validator *validator, struct sieve_command_registration *cmd_reg); static bool tst_envelope_validate (struct sieve_validator *validator, struct sieve_command_context *tst); +static bool tst_envelope_generate + (struct sieve_generator *generator, struct sieve_command_context *ctx); /* Extension definitions */ const struct sieve_extension envelope_extension = - { "envelope", ext_envelope_validator_load, NULL, NULL, NULL }; + { "envelope", ext_envelope_validator_load, NULL, ext_envelope_opcode_dump, NULL }; static const struct sieve_command envelope_test = - { "envelope", SCT_TEST, tst_envelope_registered, tst_envelope_validate, NULL, NULL }; + { "envelope", SCT_TEST, tst_envelope_registered, tst_envelope_validate, tst_envelope_generate, NULL }; /* Command Registration */ static bool tst_envelope_registered(struct sieve_validator *validator, struct sieve_command_registration *cmd_reg) @@ -28,7 +36,10 @@ static bool tst_envelope_registered(struct sieve_validator *validator, struct si return TRUE; } -/* Validation */ +/* + * Validation + */ + static bool tst_envelope_validate(struct sieve_validator *validator, struct sieve_command_context *tst) { struct sieve_ast_argument *arg; @@ -38,8 +49,11 @@ static bool tst_envelope_validate(struct sieve_validator *validator, struct siev * <envelope-part: string-list> <key-list: string-list> */ if ( !sieve_validate_command_arguments(validator, tst, 2, &arg) || - !sieve_validate_command_subtests(validator, tst, 0) ) + !sieve_validate_command_subtests(validator, tst, 0) ) { return FALSE; + } + + tst->data = (void *) arg; if ( sieve_ast_argument_type(arg) != SAAT_STRING && sieve_ast_argument_type(arg) != SAAT_STRING_LIST ) { sieve_command_validate_error(validator, tst, @@ -67,3 +81,41 @@ static bool ext_envelope_validator_load(struct sieve_validator *validator) return TRUE; } + +/* + * Generation + */ + +static bool tst_envelope_generate + (struct sieve_generator *generator, struct sieve_command_context *ctx) +{ + struct sieve_ast_argument *arg = (struct sieve_ast_argument *) ctx->data; + + sieve_generator_emit_opcode(generator, &envelope_extension); + + /* Emit envelope-part */ + if ( !sieve_generator_emit_stringlist_argument(generator, arg) ) + return FALSE; + + arg = sieve_ast_argument_next(arg); + + /* Emit key-list */ + if ( !sieve_generator_emit_stringlist_argument(generator, arg) ) + return FALSE; + + return TRUE; +} + +/* + * Code dump + */ + +static bool ext_envelope_opcode_dump(struct sieve_interpreter *interpreter) +{ + printf("ENVELOPE\n"); + sieve_interpreter_dump_operand(interpreter); + sieve_interpreter_dump_operand(interpreter); + + return TRUE; +} + diff --git a/src/lib-sieve/ext-fileinto.c b/src/lib-sieve/ext-fileinto.c index 8b51bf426..8c6cd58f4 100644 --- a/src/lib-sieve/ext-fileinto.c +++ b/src/lib-sieve/ext-fileinto.c @@ -35,7 +35,7 @@ static bool cmd_fileinto_validate(struct sieve_validator *validator, struct siev return FALSE; } - cmd->data = arg; + cmd->data = (void *) arg; return TRUE; } diff --git a/src/lib-sieve/ext-reject.c b/src/lib-sieve/ext-reject.c index 3ae44d0a7..36d25b2ce 100644 --- a/src/lib-sieve/ext-reject.c +++ b/src/lib-sieve/ext-reject.c @@ -39,7 +39,7 @@ static bool cmd_reject_validate(struct sieve_validator *validator, struct sieve_ return FALSE; } - cmd->data = arg; + cmd->data = (void *) arg; return TRUE; } diff --git a/src/lib-sieve/plugins/Makefile b/src/lib-sieve/plugins/Makefile new file mode 100644 index 000000000..282c7b6ca --- /dev/null +++ b/src/lib-sieve/plugins/Makefile @@ -0,0 +1,483 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# src/lib-sieve/plugins/Makefile. Generated from Makefile.in by configure. + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +srcdir = . +top_srcdir = ../../.. + +pkgdatadir = $(datadir)/dovecot-libsieve +pkglibdir = $(libdir)/dovecot-libsieve +pkgincludedir = $(includedir)/dovecot-libsieve +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = /usr/bin/install -c +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = i686-pc-linux-gnu +host_triplet = i686-pc-linux-gnu +subdir = src/lib-sieve/plugins +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/libsieve-config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = ${SHELL} /home/stephan/src/dovecot-libsieve/missing --run aclocal-1.9 +AMDEP_FALSE = # +AMDEP_TRUE = +AMTAR = ${SHELL} /home/stephan/src/dovecot-libsieve/missing --run tar +AR = ar +AUTOCONF = ${SHELL} /home/stephan/src/dovecot-libsieve/missing --run autoconf +AUTOHEADER = ${SHELL} /home/stephan/src/dovecot-libsieve/missing --run autoheader +AUTOMAKE = ${SHELL} /home/stephan/src/dovecot-libsieve/missing --run automake-1.9 +AWK = gawk +CC = gcc +CCDEPMODE = depmode=gcc3 +CFLAGS = -std=gnu99 -g -O2 -Wall -W -Wmissing-prototypes -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wformat=2 -Wbad-function-cast +CPP = gcc -E +CPPFLAGS = +CXX = g++ +CXXCPP = g++ -E +CXXDEPMODE = depmode=gcc3 +CXXFLAGS = -g -O2 +CYGPATH_W = echo +DEFS = -DHAVE_CONFIG_H +DEPDIR = .deps +ECHO = echo +ECHO_C = +ECHO_N = -n +ECHO_T = +EGREP = /bin/grep -E +EXEEXT = +F77 = +FFLAGS = +GREP = /bin/grep +HAVE_DOVECOT_LIBS_FALSE = # +HAVE_DOVECOT_LIBS_TRUE = +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_PROGRAM = ${INSTALL} +INSTALL_SCRIPT = ${INSTALL} +INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s +LDFLAGS = +LIBICONV = +LIBOBJS = +LIBS = +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LN_S = ln -s +LTLIBOBJS = +MAINT = # +MAINTAINER_MODE_FALSE = +MAINTAINER_MODE_TRUE = # +MAKEINFO = ${SHELL} /home/stephan/src/dovecot-libsieve/missing --run makeinfo +MODULE_LIBS = -export-dynamic -ldl +OBJEXT = o +PACKAGE = dovecot-libsieve +PACKAGE_BUGREPORT = stephan@rename-it.nl +PACKAGE_NAME = dovecot-libsieve +PACKAGE_STRING = dovecot-libsieve 1.0.2 +PACKAGE_TARNAME = dovecot-libsieve +PACKAGE_VERSION = 1.0.2 +PATH_SEPARATOR = : +RAND_LIBS = +RANLIB = ranlib +SET_MAKE = +SHELL = /bin/bash +STORAGE_LIBS = /home/stephan/src/dovecot/dovecot-1.0.2/src/lib-storage/index/maildir/libstorage_maildir.a /home/stephan/src/dovecot/dovecot-1.0.2/src/lib-storage/index/mbox/libstorage_mbox.a /home/stephan/src/dovecot/dovecot-1.0.2/src/lib-storage/index/libstorage_index.a /home/stephan/src/dovecot/dovecot-1.0.2/src/lib-index/libindex.a +STRIP = strip +VERSION = 1.0.2 +ac_ct_CC = gcc +ac_ct_CXX = g++ +ac_ct_F77 = +am__fastdepCC_FALSE = # +am__fastdepCC_TRUE = +am__fastdepCXX_FALSE = # +am__fastdepCXX_TRUE = +am__include = include +am__leading_dot = . +am__quote = +am__tar = ${AMTAR} chof - "$$tardir" +am__untar = ${AMTAR} xf - +bindir = ${exec_prefix}/bin +build = i686-pc-linux-gnu +build_alias = +build_cpu = i686 +build_os = linux-gnu +build_vendor = pc +datadir = ${datarootdir} +datarootdir = ${prefix}/share +docdir = ${datarootdir}/doc/${PACKAGE_TARNAME} +dovecot_incdir = /home/stephan/src/dovecot/dovecot-1.0.2 +dovecotdir = /home/stephan/src/dovecot/dovecot-1.0.2 +dvidir = ${docdir} +exec_prefix = ${prefix} +host = i686-pc-linux-gnu +host_alias = +host_cpu = i686 +host_os = linux-gnu +host_vendor = pc +htmldir = ${docdir} +includedir = ${prefix}/include +infodir = ${datarootdir}/info +install_sh = /home/stephan/src/dovecot-libsieve/install-sh +libdir = ${exec_prefix}/lib +libexecdir = ${exec_prefix}/libexec +localedir = ${datarootdir}/locale +localstatedir = ${prefix}/var +mandir = ${datarootdir}/man +mkdir_p = mkdir -p -- +moduledir = /usr/local/lib/dovecot +oldincludedir = /usr/include +pdfdir = ${docdir} +prefix = /usr/local +program_transform_name = s,x,x, +psdir = ${docdir} +sbindir = ${exec_prefix}/sbin +sharedstatedir = ${prefix}/com +sysconfdir = ${prefix}/etc +target_alias = +SUBDIRS = vacation +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: # $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib-sieve/plugins/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib-sieve/plugins/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: # $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): # $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/lib-sieve/plugins/Makefile.am b/src/lib-sieve/plugins/Makefile.am new file mode 100644 index 000000000..d1b05da32 --- /dev/null +++ b/src/lib-sieve/plugins/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = vacation diff --git a/src/lib-sieve/plugins/Makefile.in b/src/lib-sieve/plugins/Makefile.in new file mode 100644 index 000000000..a9eb5dde7 --- /dev/null +++ b/src/lib-sieve/plugins/Makefile.in @@ -0,0 +1,483 @@ +# Makefile.in generated by automake 1.9.6 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +top_builddir = ../../.. +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +INSTALL = @INSTALL@ +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +subdir = src/lib-sieve/plugins +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/configure.in +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/libsieve-config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-exec-recursive install-info-recursive \ + install-recursive installcheck-recursive installdirs-recursive \ + pdf-recursive ps-recursive uninstall-info-recursive \ + uninstall-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMDEP_FALSE = @AMDEP_FALSE@ +AMDEP_TRUE = @AMDEP_TRUE@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GREP = @GREP@ +HAVE_DOVECOT_LIBS_FALSE = @HAVE_DOVECOT_LIBS_FALSE@ +HAVE_DOVECOT_LIBS_TRUE = @HAVE_DOVECOT_LIBS_TRUE@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBICONV = @LIBICONV@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ +MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ +MAKEINFO = @MAKEINFO@ +MODULE_LIBS = @MODULE_LIBS@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +RAND_LIBS = @RAND_LIBS@ +RANLIB = @RANLIB@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STORAGE_LIBS = @STORAGE_LIBS@ +STRIP = @STRIP@ +VERSION = @VERSION@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ +am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ +am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ +am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dovecot_incdir = @dovecot_incdir@ +dovecotdir = @dovecotdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +moduledir = @moduledir@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +SUBDIRS = vacation +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/lib-sieve/plugins/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --gnu src/lib-sieve/plugins/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + -rm -f libtool +uninstall-info-am: + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +mostlyclean-recursive clean-recursive distclean-recursive \ +maintainer-clean-recursive: + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$tags $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && cd $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) $$here + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ + list='$(DISTFILES)'; for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ + esac; \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test "$$dir" != "$$file" && test "$$dir" != "."; then \ + dir="/$$dir"; \ + $(mkdir_p) "$(distdir)$$dir"; \ + else \ + dir=''; \ + fi; \ + if test -d $$d/$$file; then \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ + fi; \ + cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ + else \ + test -f $(distdir)/$$file \ + || cp -p $$d/$$file $(distdir)/$$file \ + || exit 1; \ + fi; \ + done + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(mkdir_p) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-libtool \ + distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-exec-am: + +install-info: install-info-recursive + +install-man: + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: uninstall-info-am + +uninstall-info: uninstall-info-recursive + +.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \ + clean clean-generic clean-libtool clean-recursive ctags \ + ctags-recursive distclean distclean-generic distclean-libtool \ + distclean-recursive distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-exec install-exec-am install-info \ + install-info-am install-man install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-generic maintainer-clean-recursive \ + mostlyclean mostlyclean-generic mostlyclean-libtool \ + mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-info-am + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/src/lib-sieve/plugins/comparator-i;ascii-numeric.c b/src/lib-sieve/plugins/comparator-i;ascii-numeric.c deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/lib-sieve/plugins/copy.c b/src/lib-sieve/plugins/copy.c deleted file mode 100644 index 8b1378917..000000000 --- a/src/lib-sieve/plugins/copy.c +++ /dev/null @@ -1 +0,0 @@ - diff --git a/src/lib-sieve/plugins/vacation/Makefile.am b/src/lib-sieve/plugins/vacation/Makefile.am new file mode 100644 index 000000000..221f81931 --- /dev/null +++ b/src/lib-sieve/plugins/vacation/Makefile.am @@ -0,0 +1,10 @@ +noinst_LIBRARIES = lib_ext_vacation.a + +AM_CPPFLAGS = \ + -I../../ \ + -I$(dovecot_incdir) \ + -I$(dovecot_incdir)/src/lib + +lib_ext_vacation_a_SOURCES = \ + ext-vacation.c + diff --git a/src/lib-sieve/plugins/vacation/ext-vacation.c b/src/lib-sieve/plugins/vacation/ext-vacation.c new file mode 100644 index 000000000..436c86eaf --- /dev/null +++ b/src/lib-sieve/plugins/vacation/ext-vacation.c @@ -0,0 +1,233 @@ +#include <stdio.h> + +#include "sieve-common.h" + +#include "sieve-extensions.h" +#include "sieve-commands.h" +#include "sieve-validator.h" +#include "sieve-generator.h" +#include "sieve-interpreter.h" + +/* Forward declarations */ +static bool ext_vacation_validator_load(struct sieve_validator *validator); +static bool ext_vacation_opcode_dump(struct sieve_interpreter *interpreter); + +static bool cmd_vacation_registered(struct sieve_validator *validator, struct sieve_command_registration *cmd_reg); +static bool cmd_vacation_validate(struct sieve_validator *validator, struct sieve_command_context *cmd); +static bool cmd_vacation_generate(struct sieve_generator *generator, struct sieve_command_context *ctx); + +/* Extension definitions */ +const struct sieve_extension vacation_extension = + { "vacation", ext_vacation_validator_load, NULL, ext_vacation_opcode_dump, NULL }; +static const struct sieve_command vacation_command = + { "vacation", SCT_COMMAND, cmd_vacation_registered, cmd_vacation_validate, cmd_vacation_generate, NULL }; + +/* Tag validation */ + +static bool cmd_vacation_validate_days_tag + (struct sieve_validator *validator, + struct sieve_ast_argument **arg, + struct sieve_command_context *cmd) +{ + /* Only one possible tag, so we don't bother checking the identifier */ + *arg = sieve_ast_argument_next(*arg); + + /* Check syntax: + * :days number + */ + if ( (*arg)->type != SAAT_NUMBER ) { + sieve_command_validate_error(validator, cmd, + "the :days tag for the vacation command requires one number argument, but %s was found", sieve_ast_argument_name(*arg) ); + return FALSE; + } + + /* FIXME: assign somewhere */ + + return TRUE; +} + +static bool cmd_vacation_validate_subject_tag + (struct sieve_validator *validator, + struct sieve_ast_argument **arg, + struct sieve_command_context *cmd) +{ + /* Only one possible tag, so we don't bother checking the identifier */ + *arg = sieve_ast_argument_next(*arg); + + /* Check syntax: + * :subject string + */ + if ( (*arg)->type != SAAT_STRING ) { + sieve_command_validate_error(validator, cmd, + "the :subject tag for the vacation command requires one string argument, but %s was found", + sieve_ast_argument_name(*arg) ); + return FALSE; + } + + /* FIXME: assign somewhere */ + + return TRUE; +} + +static bool cmd_vacation_validate_from_tag + (struct sieve_validator *validator, + struct sieve_ast_argument **arg, + struct sieve_command_context *cmd) +{ + /* Only one possible tag, so we don't bother checking the identifier */ + *arg = sieve_ast_argument_next(*arg); + + /* Check syntax: + * :from string + */ + if ( (*arg)->type != SAAT_STRING ) { + sieve_command_validate_error(validator, cmd, + "the :from tag for the vacation command requires one string argument, but %s was found", + sieve_ast_argument_name(*arg) ); + return FALSE; + } + + /* FIXME: assign somewhere */ + + return TRUE; +} + +static bool cmd_vacation_validate_addresses_tag + (struct sieve_validator *validator, + struct sieve_ast_argument **arg, + struct sieve_command_context *cmd) +{ + /* Only one possible tag, so we don't bother checking the identifier */ + *arg = sieve_ast_argument_next(*arg); + + /* Check syntax: + * :addresses string-list + */ + if ( (*arg)->type != SAAT_STRING && (*arg)->type != SAAT_STRING_LIST ) { + sieve_command_validate_error(validator, cmd, + "the :addresses tag for the vacation command requires one string argument, but %s was found", + sieve_ast_argument_name(*arg) ); + return FALSE; + } + + /* FIXME: assign somewhere */ + + return TRUE; +} + +static bool cmd_vacation_validate_mime_tag + (struct sieve_validator *validator __attr_unused__, + struct sieve_ast_argument **arg __attr_unused__, + struct sieve_command_context *cmd __attr_unused__) +{ + /* FIXME: assign somewhere */ + + return TRUE; +} + +static bool cmd_vacation_validate_handle_tag + (struct sieve_validator *validator, + struct sieve_ast_argument **arg, + struct sieve_command_context *cmd) +{ + /* Only one possible tag, so we don't bother checking the identifier */ + *arg = sieve_ast_argument_next(*arg); + + /* Check syntax: + * :addresses string-list + */ + if ( (*arg)->type != SAAT_STRING ) { + sieve_command_validate_error(validator, cmd, + "the :handle tag for the vacation command requires one string argument, but %s was found", + sieve_ast_argument_name(*arg) ); + return FALSE; + } + + /* FIXME: assign somewhere */ + + return TRUE; +} + +/* Command registration */ + +static const struct sieve_tag vacation_days_tag = { "days", cmd_vacation_validate_days_tag }; +static const struct sieve_tag vacation_subject_tag = { "subject", cmd_vacation_validate_subject_tag }; +static const struct sieve_tag vacation_from_tag = { "from", cmd_vacation_validate_from_tag }; +static const struct sieve_tag vacation_addresses_tag = { "addresses", cmd_vacation_validate_addresses_tag }; +static const struct sieve_tag vacation_mime_tag = { "mime", cmd_vacation_validate_mime_tag }; +static const struct sieve_tag vacation_handle_tag = { "handle", cmd_vacation_validate_handle_tag }; + +static bool cmd_vacation_registered(struct sieve_validator *validator, struct sieve_command_registration *cmd_reg) +{ + sieve_validator_register_tag(validator, cmd_reg, &vacation_days_tag); + sieve_validator_register_tag(validator, cmd_reg, &vacation_subject_tag); + sieve_validator_register_tag(validator, cmd_reg, &vacation_from_tag); + sieve_validator_register_tag(validator, cmd_reg, &vacation_addresses_tag); + sieve_validator_register_tag(validator, cmd_reg, &vacation_mime_tag); + sieve_validator_register_tag(validator, cmd_reg, &vacation_handle_tag); + + return TRUE; +} + +/* Command validation */ + +static bool cmd_vacation_validate(struct sieve_validator *validator, struct sieve_command_context *cmd) +{ + struct sieve_ast_argument *arg; + + /* Check valid syntax: + * vacation [":days" number] [":subject" string] + * [":from" string] [":addresses" string-list] + * [":mime"] [":handle" string] <reason: string> + */ + if ( !sieve_validate_command_arguments(validator, cmd, 1, &arg) || + !sieve_validate_command_subtests(validator, cmd, 0) || + !sieve_validate_command_block(validator, cmd, FALSE, FALSE) ) { + + return FALSE; + } + + cmd->data = (void *) arg; + + return TRUE; +} + +/* Load extension into validator */ +static bool ext_vacation_validator_load(struct sieve_validator *validator) +{ + /* Register new command */ + sieve_validator_register_command(validator, &vacation_command); + + return TRUE; +} + +/* + * Generation + */ + +static bool cmd_vacation_generate + (struct sieve_generator *generator, struct sieve_command_context *ctx) +{ + struct sieve_ast_argument *arg = (struct sieve_ast_argument *) ctx->data; + + sieve_generator_emit_opcode(generator, &vacation_extension); + + /* Emit folder string */ + if ( !sieve_generator_emit_string_argument(generator, arg) ) + return FALSE; + + return TRUE; +} + +/* + * Code dump + */ + +static bool ext_vacation_opcode_dump(struct sieve_interpreter *interpreter) +{ + printf("VACATION\n"); + sieve_interpreter_dump_operand(interpreter); + + return TRUE; +} + diff --git a/src/lib-sieve/plugins/vacation/vacation.sieve b/src/lib-sieve/plugins/vacation/vacation.sieve new file mode 100644 index 000000000..46f0787cc --- /dev/null +++ b/src/lib-sieve/plugins/vacation/vacation.sieve @@ -0,0 +1,24 @@ +require "vacation"; +vacation :subject "At the beach" :days 16 :mime text: +Content-Type: multipart/alternative; boundary=foo + +--foo + +I'm at the beach relaxing. Mmmm, surf... + +--foo +Content-Type: text/html; charset=us-ascii + +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" + "http://www.w3.org/TR/REC-html40/strict.dtd"> +<HTML><HEAD><TITLE>How to relax</TITLE> +<BASE HREF="http://home.example.com/pictures/"></HEAD> +<BODY><P>I'm at the <A HREF="beach.gif">beach</A> relaxing. +Mmmm, <A HREF="ocean.gif">surf</A>... +</BODY></HTML> + +--foo-- +. +; + + diff --git a/src/lib-sieve/scripts/tests/extensions.sieve b/src/lib-sieve/scripts/tests/extensions.sieve index f9094de77..b1c4076fb 100644 --- a/src/lib-sieve/scripts/tests/extensions.sieve +++ b/src/lib-sieve/scripts/tests/extensions.sieve @@ -1,9 +1,9 @@ -require ["fileinto", "reject"]; +require ["fileinto", "reject", "envelope"]; if anyof(exists "frop", size :over 45, size :under 10, address "from" "frop@student.utwente.nl") { keep; } else { - if address "to" "sirius@joker.com" { + if envelope ["from", "cc"] "sirius@drunksnipers.com" { reject "I dont want your email."; } else { fileinto "INBOX.Wtf"; diff --git a/src/lib-sieve/sieve-extensions.c b/src/lib-sieve/sieve-extensions.c index 4112b028c..68d53d1bd 100644 --- a/src/lib-sieve/sieve-extensions.c +++ b/src/lib-sieve/sieve-extensions.c @@ -7,8 +7,11 @@ extern const struct sieve_extension fileinto_extension; extern const struct sieve_extension reject_extension; extern const struct sieve_extension envelope_extension; +/* Plugins (FIXME: make this dynamic) */ +extern const struct sieve_extension vacation_extension; + const struct sieve_extension *sieve_core_extensions[] = { - &fileinto_extension, &reject_extension, &envelope_extension + &fileinto_extension, &reject_extension, &envelope_extension, &vacation_extension }; const unsigned int sieve_core_extensions_count = -- GitLab