aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2007-09-30 16:09:48 +0200
committerJohannes Berg <johannes@sipsolutions.net>2007-09-30 16:09:48 +0200
commitf07994f4ba5f6496b9d5a20e56834a89c86fe179 (patch)
tree0c7328d73e1aed9945a9778190180b226fb21631
parente092af66b51877e96ce0e87021cba79d84f7f813 (diff)
downloaddovecot-antispam-f07994f4ba5f6496b9d5a20e56834a89c86fe179.tar.gz
dovecot-antispam-f07994f4ba5f6496b9d5a20e56834a89c86fe179.tar.xz
dovecot-antispam-f07994f4ba5f6496b9d5a20e56834a89c86fe179.zip
fix error handling
-rw-r--r--plugin.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/plugin.c b/plugin.c
index 02c4a4c..fe98e85 100644
--- a/plugin.c
+++ b/plugin.c
@@ -163,9 +163,8 @@ static int fetch_and_copy(struct client *client,
/* MODIFIED: pass to backend */
#ifdef BACKEND_WANTS_SIGNATURE
/* got all signatures now, pass them to backend if no errors */
- if (ret == 0) {
- ret = backend(pool, src_spam, siglist);
- if (ret)
+ if (ret > 0) {
+ if (backend(pool, src_spam, siglist))
ret = BACKEND_FAILURE;
}
#else
@@ -262,12 +261,20 @@ static bool cmd_copy_antispam(struct client_command_context *cmd)
mailbox_close(&destbox);
}
+ /* MODIFIED: extended error codes */
if (ret > 0)
return cmd_sync(cmd, sync_flags, 0, "OK Copy completed.");
else if (ret == 0) {
/* some messages were expunged, sync them */
return cmd_sync(cmd, 0, 0,
"NO Some of the requested messages no longer exist.");
+ } else if (ret == SIGNATURE_MISSING) {
+ return cmd_sync(cmd, 0, 0,
+ "NO Some of the requested messages have no"
+ " antispam signature.");
+ } else if (ret == BACKEND_FAILURE) {
+ return cmd_sync(cmd, 0, 0,
+ "NO Antispam backend failed to retrain.");
} else {
client_send_storage_error(cmd, storage);
return TRUE;