X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fsieve%2Fserv_sieve.c;h=85cd92a0c0d6bb365d4f6598768c250421e6f23d;hb=8c47559cb5ae97ec0fa35660ee16fd61a9451c72;hp=0006604f32b040d017ccb8a68a07e5ded3aa8351;hpb=f89c5f3027859b19fc935ff76a958e1ec26c620a;p=citadel.git diff --git a/citadel/modules/sieve/serv_sieve.c b/citadel/modules/sieve/serv_sieve.c index 0006604f3..85cd92a0c 100644 --- a/citadel/modules/sieve/serv_sieve.c +++ b/citadel/modules/sieve/serv_sieve.c @@ -4,7 +4,21 @@ * This module glues libSieve to the Citadel server in order to implement * the Sieve mailbox filtering language (RFC 3028). * - * This code is released under the terms of the GNU General Public License. + * Copyright (c) 2007-2009 by the citadel.org team + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "sysdep.h" @@ -116,7 +130,7 @@ int ctdl_redirect(sieve2_context_t *s, void *my) return SIEVE2_ERROR_BADARGS; } - CtdlSubmitMsg(msg, valid, NULL); + CtdlSubmitMsg(msg, valid, NULL, 0); cs->cancel_implicit_keep = 1; free_recipients(valid); CtdlFreeMessage(msg); @@ -508,9 +522,9 @@ void sieve_do_msg(long msgnum, void *userdata) { size_t headers_len = 0; int len = 0; - if (userdata == NULL) + if (u == NULL) { - CtdlLogPrintf(CTDL_EMERG, "Cant process Message <%ld>without Userdata!\n", msgnum); + CtdlLogPrintf(CTDL_EMERG, "Can't process message <%ld> without userdata!\n", msgnum); return; } @@ -518,16 +532,20 @@ void sieve_do_msg(long msgnum, void *userdata) { CtdlLogPrintf(CTDL_DEBUG, "Performing sieve processing on msg <%ld>\n", msgnum); - msg = CtdlFetchMessage(msgnum, 0); + /* + * Make sure you include message body so you can get those second-level headers ;) + */ + msg = CtdlFetchMessage(msgnum, 1); if (msg == NULL) return; /* * Grab the message headers so we can feed them to libSieve. + * Use HEADERS_ONLY rather than HEADERS_FAST in order to include second-level headers. */ CC->redirect_buffer = malloc(SIZ); CC->redirect_len = 0; CC->redirect_alloc = SIZ; - CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ONLY, 0, 1); + CtdlOutputPreLoadedMsg(msg, MT_RFC822, HEADERS_ONLY, 0, 1, 0); my.rfc822headers = CC->redirect_buffer; headers_len = CC->redirect_len; CC->redirect_buffer = NULL;