dovecot-2.2-pigeonhole: lda sieve plugin: Started using smtp_cli...
pigeonhole at rename-it.nl
pigeonhole at rename-it.nl
Fri Mar 6 18:03:00 UTC 2015
details: http://hg.rename-it.nl/dovecot-2.2-pigeonhole/rev/572300c87a17
changeset: 1993:572300c87a17
user: Stephan Bosch <stephan at rename-it.nl>
date: Fri Mar 06 18:59:46 2015 +0100
description:
lda sieve plugin: Started using smtp_client_deinit_timeout() to give a session timeout.
diffstat:
src/lib-sieve/sieve-smtp.c | 6 +++---
src/lib-sieve/sieve-types.h | 11 ++++++++---
src/plugins/lda-sieve/lda-sieve-plugin.c | 15 +++++++++++----
src/sieve-tools/sieve-test.c | 10 +++++++---
src/testsuite/testsuite-smtp.c | 16 +++++++---------
src/testsuite/testsuite-smtp.h | 11 ++++++++---
6 files changed, 44 insertions(+), 25 deletions(-)
diffs (194 lines):
diff -r 72ff74f6cb11 -r 572300c87a17 src/lib-sieve/sieve-smtp.c
--- a/src/lib-sieve/sieve-smtp.c Fri Mar 06 17:12:35 2015 +0100
+++ b/src/lib-sieve/sieve-smtp.c Fri Mar 06 18:59:46 2015 +0100
@@ -42,7 +42,7 @@
(struct sieve_smtp_context *sctx, const char *address)
{
i_assert(!sctx->sent);
- sctx->senv->smtp_add_rcpt(sctx->handle, address);
+ sctx->senv->smtp_add_rcpt(sctx->senv, sctx->handle, address);
}
struct ostream *sieve_smtp_send
@@ -51,7 +51,7 @@
i_assert(!sctx->sent);
sctx->sent = TRUE;
- return sctx->senv->smtp_send(sctx->handle);
+ return sctx->senv->smtp_send(sctx->senv, sctx->handle);
}
struct sieve_smtp_context *sieve_smtp_start_single
@@ -74,6 +74,6 @@
void *handle = sctx->handle;
i_free(sctx);
- return senv->smtp_finish(handle, error_r);
+ return senv->smtp_finish(senv, handle, error_r);
}
diff -r 72ff74f6cb11 -r 572300c87a17 src/lib-sieve/sieve-types.h
--- a/src/lib-sieve/sieve-types.h Fri Mar 06 17:12:35 2015 +0100
+++ b/src/lib-sieve/sieve-types.h Fri Mar 06 18:59:46 2015 +0100
@@ -193,12 +193,17 @@
void *(*smtp_start)
(const struct sieve_script_env *senv, const char *return_path);
/* Add a new recipient */
- void (*smtp_add_rcpt) (void *handle, const char *address);
+ void (*smtp_add_rcpt)
+ (const struct sieve_script_env *senv, void *handle,
+ const char *address);
/* Get an output stream where the message can be written to. The recipients
must already be added before calling this. */
- struct ostream *(*smtp_send)(void *handle);
+ struct ostream *(*smtp_send)
+ (const struct sieve_script_env *senv, void *handle);
/* Returns 1 on success, 0 on permanent failure, -1 on temporary failure. */
- int (*smtp_finish)(void *handle, const char **error_r);
+ int (*smtp_finish)
+ (const struct sieve_script_env *senv, void *handle,
+ const char **error_r);
/* Interface for marking and checking duplicates */
int (*duplicate_check)
diff -r 72ff74f6cb11 -r 572300c87a17 src/plugins/lda-sieve/lda-sieve-plugin.c
--- a/src/plugins/lda-sieve/lda-sieve-plugin.c Fri Mar 06 17:12:35 2015 +0100
+++ b/src/plugins/lda-sieve/lda-sieve-plugin.c Fri Mar 06 18:59:46 2015 +0100
@@ -77,14 +77,17 @@
return (void *)smtp_client_init(dctx->set, return_path);
}
-static void lda_sieve_smtp_add_rcpt(void *handle, const char *address)
+static void lda_sieve_smtp_add_rcpt
+(const struct sieve_script_env *senv ATTR_UNUSED, void *handle,
+ const char *address)
{
struct smtp_client *smtp_client = (struct smtp_client *) handle;
smtp_client_add_rcpt(smtp_client, address);
}
-static struct ostream *lda_sieve_smtp_send(void *handle)
+static struct ostream *lda_sieve_smtp_send
+(const struct sieve_script_env *senv ATTR_UNUSED, void *handle)
{
struct smtp_client *smtp_client = (struct smtp_client *) handle;
@@ -92,11 +95,15 @@
}
static int lda_sieve_smtp_finish
-(void *handle, const char **error_r)
+(const struct sieve_script_env *senv, void *handle,
+ const char **error_r)
{
+ struct mail_deliver_context *dctx =
+ (struct mail_deliver_context *) senv->script_context;
struct smtp_client *smtp_client = (struct smtp_client *) handle;
- return smtp_client_deinit(smtp_client, error_r);
+ return smtp_client_deinit_timeout
+ (smtp_client, dctx->timeout_secs, error_r);
}
static int lda_sieve_reject_mail
diff -r 72ff74f6cb11 -r 572300c87a17 src/sieve-tools/sieve-test.c
--- a/src/sieve-tools/sieve-test.c Fri Mar 06 17:12:35 2015 +0100
+++ b/src/sieve-tools/sieve-test.c Fri Mar 06 18:59:46 2015 +0100
@@ -70,12 +70,15 @@
}
static void sieve_smtp_add_rcpt
-(void *handle ATTR_UNUSED, const char *address)
+(const struct sieve_script_env *senv ATTR_UNUSED,
+ void *handle ATTR_UNUSED, const char *address)
{
printf("\nRECIPIENT: %s\n", address);
}
-static struct ostream *sieve_smtp_send(void *handle)
+static struct ostream *sieve_smtp_send
+(const struct sieve_script_env *senv ATTR_UNUSED,
+ void *handle)
{
printf("START MESSAGE:\n");
@@ -83,7 +86,8 @@
}
static int sieve_smtp_finish
-(void *handle, const char **error_r ATTR_UNUSED)
+(const struct sieve_script_env *senv ATTR_UNUSED,
+ void *handle, const char **error_r ATTR_UNUSED)
{
struct ostream *output = (struct ostream *)handle;
diff -r 72ff74f6cb11 -r 572300c87a17 src/testsuite/testsuite-smtp.c
--- a/src/testsuite/testsuite-smtp.c Fri Mar 06 17:12:35 2015 +0100
+++ b/src/testsuite/testsuite-smtp.c Fri Mar 06 18:59:46 2015 +0100
@@ -74,12 +74,6 @@
struct ostream *output;
};
-void testsuite_smtp_add_rcpt(void *handle, const char *address);
-struct ostream *testsuite_smtp_send(void *handle);
-int testsuite_smtp_finish
- (void *handle, const char **error_r);
-
-
void *testsuite_smtp_start
(const struct sieve_script_env *senv ATTR_UNUSED, const char *return_path)
{
@@ -102,7 +96,9 @@
return (void *) smtp;
}
-void testsuite_smtp_add_rcpt(void *handle, const char *address)
+void testsuite_smtp_add_rcpt
+(const struct sieve_script_env *senv ATTR_UNUSED,
+ void *handle, const char *address)
{
struct testsuite_smtp *smtp = (struct testsuite_smtp *) handle;
struct testsuite_smtp_message *msg;
@@ -114,7 +110,8 @@
msg->envelope_to = p_strdup(testsuite_smtp_pool, address);
}
-struct ostream *testsuite_smtp_send(void *handle)
+struct ostream *testsuite_smtp_send
+(const struct sieve_script_env *senv ATTR_UNUSED, void *handle)
{
struct testsuite_smtp *smtp = (struct testsuite_smtp *) handle;
@@ -122,7 +119,8 @@
}
int testsuite_smtp_finish
-(void *handle, const char **error_r ATTR_UNUSED)
+(const struct sieve_script_env *senv ATTR_UNUSED,
+ void *handle, const char **error_r ATTR_UNUSED)
{
struct testsuite_smtp *smtp = (struct testsuite_smtp *) handle;
diff -r 72ff74f6cb11 -r 572300c87a17 src/testsuite/testsuite-smtp.h
--- a/src/testsuite/testsuite-smtp.h Fri Mar 06 17:12:35 2015 +0100
+++ b/src/testsuite/testsuite-smtp.h Fri Mar 06 18:59:46 2015 +0100
@@ -15,10 +15,15 @@
void *testsuite_smtp_start
(const struct sieve_script_env *senv ATTR_UNUSED,
const char *return_path);
-void testsuite_smtp_add_rcpt(void *handle, const char *address);
-struct ostream *testsuite_smtp_send(void *handle);
+void testsuite_smtp_add_rcpt
+ (const struct sieve_script_env *senv ATTR_UNUSED,
+ void *handle, const char *address);
+struct ostream *testsuite_smtp_send
+ (const struct sieve_script_env *senv ATTR_UNUSED,
+ void *handle);
int testsuite_smtp_finish
- (void *handle, const char **error_r);
+ (const struct sieve_script_env *senv ATTR_UNUSED,
+ void *handle, const char **error_r);
/*
* Access
More information about the dovecot-cvs
mailing list