diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-11-24 15:25:07 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2016-11-24 15:25:07 +0200 |
commit | 05df35d07a46f70e7d09a4da39fdd2d7a7d58ed0 (patch) | |
tree | 0ed8642e5ffb858ba12f1b01dfa3db1934fd4230 /sieve | |
parent | a4c1a0e88bdeb8372ae66e27da4009a49b0f8009 (diff) | |
download | mailutils-05df35d07a46f70e7d09a4da39fdd2d7a7d58ed0.tar.gz mailutils-05df35d07a46f70e7d09a4da39fdd2d7a7d58ed0.tar.bz2 |
sieve: simplify action logging API
* include/mailutils/sieve.h (mu_sieve_action_log_t): Change proto.
* lib/sieve.c (_sieve_action_log): Rewrite.
* libmu_sieve/util.c (mu_sieve_log_action): Rewrite.
* python/libmu_py/sieve.c (_sieve_action_printer): Rewrite.
* sieve/sieve.c (_sieve_action_log): Rewrite.
Diffstat (limited to 'sieve')
-rw-r--r-- | sieve/sieve.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sieve/sieve.c b/sieve/sieve.c index 4a77b122a..e5e066c93 100644 --- a/sieve/sieve.c +++ b/sieve/sieve.c @@ -264,18 +264,21 @@ Compatibility debug flags:\n\ }; static void -_sieve_action_log (void *unused, - mu_stream_t stream, size_t msgno, - mu_message_t msg, +_sieve_action_log (mu_sieve_machine_t mach, const char *action, const char *fmt, va_list ap) { size_t uid = 0; + mu_message_t msg; + mu_stream_t stream; + + mu_sieve_get_diag_stream (mach, &stream); + msg = mu_sieve_get_message (mach); mu_message_get_uid (msg, &uid); mu_stream_printf (stream, "\033s<%d>\033%c<%d>", MU_LOG_NOTICE, sieve_print_locus ? 'O' : 'X', MU_LOGMODE_LOCUS); mu_stream_printf (stream, _("%s on msg uid %lu"), - action, (unsigned long) uid); + action, (unsigned long) uid); if (fmt && strlen (fmt)) { @@ -283,6 +286,8 @@ _sieve_action_log (void *unused, mu_stream_vprintf (stream, fmt, ap); } mu_stream_printf (stream, "\n"); + + mu_stream_unref (stream); } static int |