Hello
I need "filento" sieve functionality.
But current dbmail-svn rev 1970 don't wont to do this.
I create small patch and now my small and simple sieve script can work!
Correct me, if I did smth wrong, please.
Sieve script:
require "fileinto";
if header :is "X-Spam-Flag" "YES" {
fileinto "SPAM";}
else {
fileinto "INBOX";}
Patch:
--- sortsieve.c.orig 2006-01-30 09:07:35.000000000 +0300
+++ sortsieve.c 2006-02-03 13:39:23.000000000 +0300
@@ -180,7 +180,7 @@
m->mailbox = mailbox;
- m->cancelkeep = 0;
+ m->cancelkeep = 1;
return SIEVE2_OK;
}
@@ -262,6 +262,7 @@
return SIEVE2_ERROR_FAIL;
}
sieve2_setvalue_string(s, "script", m->s_buf);
+
} else {
return SIEVE2_ERROR_BADARGS;
}
@@ -269,6 +270,16 @@
return SIEVE2_OK;
}
+int my_getheaders(sieve2_context_t *s, void *my)
+{
+ struct my_context *m = (struct my_context *)my;
+ char *allh;
+ allh=dbmail_message_hdrs_to_string(m->message);
+ sieve2_setvalue_string(s, "allheaders", allh);
+ return SIEVE2_OK;
+}
+
+
int my_getheader(sieve2_context_t *s, void *my)
{
struct my_context *m = (struct my_context *)my;
@@ -276,7 +287,7 @@
header = sieve2_getvalue_string(s, "header");
- // FIXME: Use GMIME to get a header.
+//value = dbmail_message_get_header(m->message,header);
sieve2_setvalue_string(s, "value", value);
@@ -323,7 +334,12 @@
{ SIEVE2_ACTION_KEEP, my_keep },
{ SIEVE2_SCRIPT_GETSCRIPT, my_getscript },
+
+ { SIEVE2_MESSAGE_GETHEADER, NULL },
+ { SIEVE2_MESSAGE_GETALLHEADERS, my_getheaders },
+/*
{ SIEVE2_MESSAGE_GETHEADER, my_getheader },
+*/
{ SIEVE2_MESSAGE_GETENVELOPE, my_getenvelope },
{ SIEVE2_MESSAGE_GETBODY, my_getbody },
{ SIEVE2_MESSAGE_GETSIZE, my_getsize },
@@ -452,7 +468,10 @@
my_context->user_idnr = user_idnr;
res = db_get_sievescript_active(user_idnr, &my_context->script);
+/*
if (res != 0) {
+*/
+ if (res == 0) {
trace(TRACE_ERROR, "Error %d when calling
db_getactive_sievescript\n", res);
exitcode = 1;
goto freesieve;
--
Oleg Lapshin