From 6486981103d6b6dc400a869440dfc50fc3a24a8d Mon Sep 17 00:00:00 2001
From: Stephan Bosch <stephan@rename-it.nl>
Date: Sat, 25 Oct 2008 20:27:14 +0200
Subject: [PATCH] Started development of enotify extension.

---
 configure.in                                | 17 ++++++
 src/lib-sieve/plugins/Makefile.am           | 17 +++++-
 src/lib-sieve/plugins/enotify/Makefile.am   | 11 ++++
 src/lib-sieve/plugins/enotify/ext-enotify.c | 57 +++++++++++++++++++++
 4 files changed, 101 insertions(+), 1 deletion(-)
 create mode 100644 src/lib-sieve/plugins/enotify/Makefile.am
 create mode 100644 src/lib-sieve/plugins/enotify/ext-enotify.c

diff --git a/configure.in b/configure.in
index 5743c4e32..06268f819 100644
--- a/configure.in
+++ b/configure.in
@@ -40,6 +40,22 @@ else
 fi
 AM_CONDITIONAL(HAVE_DOVECOT_LIBS, test "$have_dovecot_libs" = "yes")
 
+# Extensions under development
+#
+
+AC_ARG_WITH(enotify,
+[AC_HELP_STRING([--with-enotify], [Build enotify extension (under development) [default=no]])],
+        if test x$withval = xno || test x$withval = xauto; then
+                want_enotify=$withval
+        else
+                want_enotify=yes
+        fi,
+        want_enotify=no)
+AM_CONDITIONAL(BUILD_ENOTIFY, test "$want_enotify" = "yes")
+
+#
+#
+
 dnl replace relative ../ paths in the file with full paths
 eval `cat $dovecotdir/dovecot-config|sed 's,\$(top_builddir)/,$dovecotdir/,g'`
 
@@ -69,6 +85,7 @@ src/lib-sieve/plugins/copy/Makefile
 src/lib-sieve/plugins/include/Makefile
 src/lib-sieve/plugins/body/Makefile
 src/lib-sieve/plugins/variables/Makefile
+src/lib-sieve/plugins/enotify/Makefile
 src/plugins/Makefile
 src/plugins/lda-sieve/Makefile
 src/sieve-bin/Makefile
diff --git a/src/lib-sieve/plugins/Makefile.am b/src/lib-sieve/plugins/Makefile.am
index 6db6a5e29..0aaa153b7 100644
--- a/src/lib-sieve/plugins/Makefile.am
+++ b/src/lib-sieve/plugins/Makefile.am
@@ -1,2 +1,17 @@
-SUBDIRS = vacation subaddress comparator-i-ascii-numeric relational regex imapflags copy include body variables
+if BUILD_ENOTIFY
+ENOTIFY = enotify
+endif
+
+SUBDIRS = \
+	vacation \
+	subaddress \
+	comparator-i-ascii-numeric \
+	relational \
+	regex \
+	imapflags \
+	copy \
+	include \
+	body \
+	variables \
+	$(ENOTIFY)
 
diff --git a/src/lib-sieve/plugins/enotify/Makefile.am b/src/lib-sieve/plugins/enotify/Makefile.am
new file mode 100644
index 000000000..38e0a66ee
--- /dev/null
+++ b/src/lib-sieve/plugins/enotify/Makefile.am
@@ -0,0 +1,11 @@
+noinst_LTLIBRARIES = libsieve_ext_enotify.la
+
+AM_CPPFLAGS = \
+	-I../../ \
+	-I$(dovecot_incdir) \
+	-I$(dovecot_incdir)/src/lib \
+	-I$(dovecot_incdir)/src/lib-mail \
+	-I$(dovecot_incdir)/src/lib-storage 
+
+libsieve_ext_enotify_la_SOURCES = \
+	ext-enotify.c
diff --git a/src/lib-sieve/plugins/enotify/ext-enotify.c b/src/lib-sieve/plugins/enotify/ext-enotify.c
new file mode 100644
index 000000000..d9fc0d0cf
--- /dev/null
+++ b/src/lib-sieve/plugins/enotify/ext-enotify.c
@@ -0,0 +1,57 @@
+/* Copyright (c) 2002-2008 Dovecot Sieve authors, see the included COPYING file
+ */
+
+/* Extension enotify
+ * ------------------
+ *
+ * Authors: Stephan Bosch
+ * Specification: draft-ietf-sieve-notify-12.txt
+ * Implementation: skeleton
+ * Status: under development
+ * 
+ */
+
+#include <stdio.h>
+
+#include "sieve-common.h"
+
+#include "sieve-code.h"
+#include "sieve-extensions.h"
+#include "sieve-actions.h"
+#include "sieve-commands.h"
+#include "sieve-validator.h"
+#include "sieve-generator.h"
+#include "sieve-interpreter.h"
+#include "sieve-result.h"
+
+/* 
+ * Extension
+ */
+
+static bool ext_enotify_load(int ext_id);
+static bool ext_enotify_validator_load(struct sieve_validator *validator);
+
+static int ext_my_id;
+
+const struct sieve_extension enotify_extension = { 
+	"enotify", 
+	&ext_my_id,
+	ext_enotify_load,
+	ext_enotify_validator_load, 
+	NULL, NULL, NULL, NULL, NULL,
+	SIEVE_EXT_DEFINE_NO_OPERATIONS,
+	SIEVE_EXT_DEFINE_NO_OPERANDS
+};
+
+static bool ext_enotify_load(int ext_id)
+{
+	ext_my_id = ext_id;
+
+	return TRUE;
+}
+
+static bool ext_enotify_validator_load(struct sieve_validator *validator)
+{
+	return TRUE;
+}
+
-- 
GitLab