summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org.ua>2016-12-20 10:48:16 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2016-12-20 10:48:16 (GMT)
commitc2efb9e546db69a6c51532e35831c137d119f5b9 (patch) (side-by-side diff)
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') (more/less context) (ignore whitespace changes)
-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 ea531a8..871bbc9 100644
--- a/src/builtin/sieve.bi
+++ b/src/builtin/sieve.bi
@@ -85,7 +85,8 @@ MF_DEFUN(sieve, NUMBER, NUMBER nmsg, STRING script, OPTIONAL, NUMBER flags,
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"),
@@ -97,6 +98,15 @@ MF_DEFUN(sieve, NUMBER, NUMBER nmsg, STRING script, OPTIONAL, NUMBER flags,
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) {

Return to:

Send suggestions and report system problems to the System administrator.