summaryrefslogtreecommitdiffabout
path: root/src
authorSergey Poznyakoff <gray@gnu.org.ua>2016-12-12 08:15:55 (GMT)
committer Sergey Poznyakoff <gray@gnu.org.ua>2016-12-12 08:18:10 (GMT)
commitdb77ffd15fc36c41e5d35deb6af5cad1defe379b (patch) (side-by-side diff)
treed901d8f13fbb6a1f090d0eb2804e10b44a1da9e4 /src
parentb6bbeeceb6ebc39156808babbc4c303e78449d73 (diff)
downloadmailfromd-db77ffd15fc36c41e5d35deb6af5cad1defe379b.tar.gz
mailfromd-db77ffd15fc36c41e5d35deb6af5cad1defe379b.tar.bz2
Use new Sieve API
* src/builtin/sieve.bi: Change to use new Sieve API * configure.ac: Version 8.0.90. Require MU 3.0.90 * NEWS: Update.
Diffstat (limited to 'src') (more/less context) (ignore whitespace changes)
-rw-r--r--src/builtin/sieve.bi38
1 files changed, 22 insertions, 16 deletions
diff --git a/src/builtin/sieve.bi b/src/builtin/sieve.bi
index cbb5246..ea531a8 100644
--- a/src/builtin/sieve.bi
+++ b/src/builtin/sieve.bi
@@ -19,14 +19,14 @@
#include "msg.h"
static void
-_sieve_text_action_log(void *env_ptr,
- mu_stream_t stream, size_t msgno,
- mu_message_t msg,
+_sieve_text_action_log(mu_sieve_machine_t mach,
const char *action, const char *fmt, va_list ap)
{
- eval_environ_t env = env_ptr;
+ mu_stream_t stream;
+ eval_environ_t env = mu_sieve_get_data (mach);
const char *id;
-
+
+ mu_sieve_get_diag_stream(mach, &stream);
mu_stream_printf(stream, "\033s<%d>", MU_LOG_NOTICE);
id = mailfromd_msgid(env_get_context(env));
if (id && id[0])
@@ -41,16 +41,16 @@ _sieve_text_action_log(void *env_ptr,
}
static void
-_sieve_file_action_log(void *env_ptr,
- mu_stream_t stream, size_t msgno,
- mu_message_t msg,
+_sieve_file_action_log(mu_sieve_machine_t mach,
const char *action, const char *fmt, va_list ap)
{
- eval_environ_t env = env_ptr;
+ mu_stream_t stream;
+ eval_environ_t env = mu_sieve_get_data(mach);
struct locus locus;
- _sieve_text_action_log(env_ptr, stream, msgno, msg, action, fmt, ap);
+ _sieve_text_action_log(mach, action, fmt, ap);
+ mu_sieve_get_diag_stream(mach, &stream);
env_get_locus(env, &locus);
mu_stream_printf(stream, "\033f<%lu>%s\033l<%lu>\033s<%d>\033O<%d>%s\n",
(unsigned long) strlen(locus.file), locus.file,
@@ -67,29 +67,35 @@ mach_cleanup(void *ptr)
mu_sieve_machine_destroy(&mach);
}
+static void
+modify_debug_flags(mu_debug_level_t set, mu_debug_level_t clr)
+{
+ mu_debug_level_t lev;
+
+ mu_debug_get_category_level(mu_sieve_debug_handle, &lev);
+ mu_debug_set_category_level(mu_sieve_debug_handle, (lev & ~clr) | set);
+}
+
MF_DEFUN(sieve, NUMBER, NUMBER nmsg, STRING script, OPTIONAL, NUMBER flags,
STRING file, NUMBER line)
{
mu_sieve_machine_t mach;
- int sieve_debug_flags = 0;
int rc;
int retval = 0;
int f = MF_OPTVAL(flags);
mu_attribute_t attr;
mu_message_t msg;
- rc = mu_sieve_machine_init(&mach);
+ 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)
- sieve_debug_flags |= MU_SIEVE_DEBUG_TRACE;
+ modify_debug_flags(MU_DEBUG_LEVEL_MASK(MU_DEBUG_TRACE4), 0);
if (f & MF_SIEVE_DEBUG_INSTR)
- sieve_debug_flags |= MU_SIEVE_DEBUG_INSTR;
-
- mu_sieve_set_debug_level(mach, sieve_debug_flags);
+ modify_debug_flags(MU_DEBUG_LEVEL_MASK(MU_DEBUG_TRACE9), 0);
mu_sieve_set_data(mach, env);

Return to:

Send suggestions and report system problems to the System administrator.