X-Git-Url: https://code.citadel.org/?a=blobdiff_plain;f=citadel%2Fmodules%2Fsieve%2Fserv_sieve.c;h=85cd92a0c0d6bb365d4f6598768c250421e6f23d;hb=8c47559cb5ae97ec0fa35660ee16fd61a9451c72;hp=473a8dcf9cc7e8860f54f48b548cb3db46473298;hpb=c86759641df76c81c3c2273f2dcf71a656d61033;p=citadel.git diff --git a/citadel/modules/sieve/serv_sieve.c b/citadel/modules/sieve/serv_sieve.c index 473a8dcf9..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" @@ -518,7 +532,10 @@ 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; /* @@ -535,12 +552,6 @@ void sieve_do_msg(long msgnum, void *userdata) { CC->redirect_len = 0; CC->redirect_alloc = 0; - if (u == NULL) - { - CtdlLogPrintf(CTDL_EMERG, "userdata got clobbz0red! aaaaaaaaghhh!!!!\n"); - abort(); - } - /* * libSieve clobbers the stack if it encounters badly formed * headers. Sanitize our headers by stripping nonprintable @@ -633,35 +644,14 @@ void sieve_do_msg(long msgnum, void *userdata) { CtdlFreeMessage(msg); - if (u == NULL) - { - CtdlLogPrintf(CTDL_EMERG, "userdata got clobbz0red! aaaaaaaaghhh!!!!\n"); - abort(); - } - - - CtdlLogPrintf(CTDL_DEBUG, "HEADERS-------\n%s\n", my.rfc822headers); - sieve2_setvalue_string(sieve2_context, "allheaders", my.rfc822headers); - if (u == NULL) - { - CtdlLogPrintf(CTDL_EMERG, "userdata got clobbz0red! aaaaaaaaghhh!!!!\n"); - abort(); - } - CtdlLogPrintf(CTDL_DEBUG, "Calling sieve2_execute()\n"); res = sieve2_execute(sieve2_context, &my); if (res != SIEVE2_OK) { CtdlLogPrintf(CTDL_CRIT, "sieve2_execute() returned %d: %s\n", res, sieve2_errstr(res)); } - if (u == NULL) - { - CtdlLogPrintf(CTDL_EMERG, "userdata got clobbz0red! aaaaaaaaghhh!!!!\n"); - abort(); - } - free(my.rfc822headers); my.rfc822headers = NULL; @@ -674,12 +664,6 @@ void sieve_do_msg(long msgnum, void *userdata) { CtdlDeleteMessages(CC->room.QRname, &msgnum, 1, ""); } - if (u == NULL) - { - CtdlLogPrintf(CTDL_EMERG, "userdata got clobbz0red! aaaaaaaaghhh!!!!\n"); - abort(); - } - CtdlLogPrintf(CTDL_DEBUG, "Completed sieve processing on msg <%ld>\n", msgnum); u->lastproc = msgnum;