dovecot-2.0-pigeonhole: Added support for critical runtime errors.
pigeonhole at rename-it.nl
pigeonhole at rename-it.nl
Sun Sep 5 22:37:47 EEST 2010
details: http://hg.rename-it.nl/dovecot-2.0-pigeonhole/rev/33bc93bdde44
changeset: 1413:33bc93bdde44
user: Stephan Bosch <stephan at rename-it.nl>
date: Sun Sep 05 21:37:41 2010 +0200
description:
Added support for critical runtime errors.
diffstat:
src/lib-sieve/sieve-error.c | 10 +++++-----
src/lib-sieve/sieve-error.h | 5 +++--
src/lib-sieve/sieve-interpreter.c | 19 +++++++++++++++++++
src/lib-sieve/sieve-interpreter.h | 3 +++
4 files changed, 30 insertions(+), 7 deletions(-)
diffs (107 lines):
diff -r 1889ce6a3e66 -r 33bc93bdde44 src/lib-sieve/sieve-error.c
--- a/src/lib-sieve/sieve-error.c Sun Sep 05 17:57:17 2010 +0200
+++ b/src/lib-sieve/sieve-error.c Sun Sep 05 21:37:41 2010 +0200
@@ -377,7 +377,7 @@
void sieve_vcritical
(struct sieve_instance *svinst, struct sieve_error_handler *ehandler,
- const char *location, const char *prefix, const char *fmt, va_list args)
+ const char *location, const char *user_prefix, const char *fmt, va_list args)
{
char str[256];
struct tm *tm;
@@ -394,12 +394,12 @@
tm = localtime(&ioloop_time);
- if ( prefix == NULL || *prefix == '\0' ) {
+ if ( user_prefix == NULL || *user_prefix == '\0' ) {
sieve_direct_error(svinst, ehandler, 0, location, "%s",
( strftime(str, sizeof(str), CRITICAL_MSG_STAMP, tm) > 0 ?
str : CRITICAL_MSG ));
} else {
- sieve_direct_error(svinst, ehandler, 0, location, "%s: %s", prefix,
+ sieve_direct_error(svinst, ehandler, 0, location, "%s: %s", user_prefix,
( strftime(str, sizeof(str), CRITICAL_MSG_STAMP, tm) > 0 ?
str : CRITICAL_MSG ));
}
@@ -455,13 +455,13 @@
void sieve_critical
(struct sieve_instance *svinst, struct sieve_error_handler *ehandler,
- const char *location, const char *prefix, const char *fmt, ...)
+ const char *location, const char *user_prefix, const char *fmt, ...)
{
va_list args;
va_start(args, fmt);
T_BEGIN {
- sieve_vcritical(svinst, ehandler, location, prefix, fmt, args);
+ sieve_vcritical(svinst, ehandler, location, user_prefix, fmt, args);
} T_END;
va_end(args);
diff -r 1889ce6a3e66 -r 33bc93bdde44 src/lib-sieve/sieve-error.h
--- a/src/lib-sieve/sieve-error.h Sun Sep 05 17:57:17 2010 +0200
+++ b/src/lib-sieve/sieve-error.h Sun Sep 05 21:37:41 2010 +0200
@@ -106,7 +106,8 @@
const char *fmt, va_list args);
void sieve_vcritical
(struct sieve_instance *svinst, struct sieve_error_handler *ehandler,
- const char *location, const char *prefix, const char *fmt, va_list args);
+ const char *location, const char *user_prefix, const char *fmt,
+ va_list args);
void sieve_error
(struct sieve_error_handler *ehandler, const char *location,
@@ -122,7 +123,7 @@
const char *fmt, ...) ATTR_FORMAT(3, 4);
void sieve_critical
(struct sieve_instance *svinst, struct sieve_error_handler *ehandler,
- const char *location, const char *prefix, const char *fmt, ...)
+ const char *location, const char *user_prefix, const char *fmt, ...)
ATTR_FORMAT(5, 6);
/*
diff -r 1889ce6a3e66 -r 33bc93bdde44 src/lib-sieve/sieve-interpreter.c
--- a/src/lib-sieve/sieve-interpreter.c Sun Sep 05 17:57:17 2010 +0200
+++ b/src/lib-sieve/sieve-interpreter.c Sun Sep 05 21:37:41 2010 +0200
@@ -316,6 +316,25 @@
va_end(args);
}
+void sieve_runtime_critical
+(const struct sieve_runtime_env *renv, const char *location,
+ const char *user_prefix, const char *fmt, ...)
+{
+ va_list args;
+
+ va_start(args, fmt);
+
+ T_BEGIN {
+ if ( location == NULL )
+ location = sieve_runtime_get_full_command_location(renv);
+
+ sieve_vcritical
+ (renv->svinst, renv->interp->ehandler, location, user_prefix, fmt, args);
+ } T_END;
+
+ va_end(args);
+}
+
/*
* Source location
*/
diff -r 1889ce6a3e66 -r 33bc93bdde44 src/lib-sieve/sieve-interpreter.h
--- a/src/lib-sieve/sieve-interpreter.h Sun Sep 05 17:57:17 2010 +0200
+++ b/src/lib-sieve/sieve-interpreter.h Sun Sep 05 21:37:41 2010 +0200
@@ -92,6 +92,9 @@
void sieve_runtime_log
(const struct sieve_runtime_env *renv, const char *location,
const char *fmt, ...) ATTR_FORMAT(3, 4);
+void sieve_runtime_critical
+ (const struct sieve_runtime_env *renv, const char *location,
+ const char *user_prefix, const char *fmt, ...) ATTR_FORMAT(4, 5);
/*
* Extension support
More information about the dovecot-cvs
mailing list