aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-12-20 12:48:16 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2016-12-20 12:48:16 +0200
commitc2efb9e546db69a6c51532e35831c137d119f5b9 (patch)
treee67810bb8dddb967bd5b3de90229c5523902efea /src
parent6285eff8645b0b368f0f565caf39b656f5d4403e (diff)
downloadmailfromd-c2efb9e546db69a6c51532e35831c137d119f5b9.tar.gz
mailfromd-c2efb9e546db69a6c51532e35831c137d119f5b9.tar.bz2
Improve Sieve interface
* src/builtin/sieve.bi: Initialize Sieve environment * doc/functions.texi: Document changes.
Diffstat (limited to 'src')
-rw-r--r--src/builtin/sieve.bi12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/builtin/sieve.bi b/src/builtin/sieve.bi
index ea531a83..871bbc90 100644
--- a/src/builtin/sieve.bi
+++ b/src/builtin/sieve.bi
@@ -82,24 +82,34 @@ MF_DEFUN(sieve, NUMBER, NUMBER nmsg, STRING script, OPTIONAL, NUMBER flags,
mu_sieve_machine_t mach;
int rc;
int retval = 0;
int f = MF_OPTVAL(flags);
mu_attribute_t attr;
mu_message_t msg;
-
+ const char *s;
+
rc = mu_sieve_machine_create(&mach);
MF_ASSERT(rc == 0, mfe_failure,
_("failed to initialize sieve machine: %s"),
mu_strerror(rc));
MF_DCL_CLEANUP(mach, mach_cleanup);
if (f & MF_SIEVE_DEBUG_TRACE)
modify_debug_flags(MU_DEBUG_LEVEL_MASK(MU_DEBUG_TRACE4), 0);
if (f & MF_SIEVE_DEBUG_INSTR)
modify_debug_flags(MU_DEBUG_LEVEL_MASK(MU_DEBUG_TRACE9), 0);
+ mu_sieve_set_environ(mach, "location", "MTA");
+ mu_sieve_set_environ(mach, "phase", "pre");
+ s = env_get_macro(env, "client_addr");
+ if (s)
+ mu_sieve_set_environ(mach, "remote-ip", s);
+ s = env_get_macro(env, "client_ptr");
+ if (s)
+ mu_sieve_set_environ(mach, "remote-host", s);
+
mu_sieve_set_data(mach, env);
if (f & MF_SIEVE_TEXT) {
struct locus locus;
env_get_locus(env, &locus);

Return to:

Send suggestions and report system problems to the System administrator.