From: Art Cancro Date: Fri, 20 Oct 2006 04:23:04 +0000 (+0000) Subject: initial prep for VACATION extension X-Git-Tag: v7.86~3894 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=018b418ae3a5d59388a38ae3cf70a2e6c0318626;p=citadel.git initial prep for VACATION extension --- diff --git a/citadel/serv_sieve.c b/citadel/serv_sieve.c index e9e3db834..0dcbfea29 100644 --- a/citadel/serv_sieve.c +++ b/citadel/serv_sieve.c @@ -221,9 +221,7 @@ int ctdl_discard(sieve2_context_t *s, void *my) lprintf(CTDL_DEBUG, "Action is DISCARD\n"); - /* Yes, this is really all there is to it. Since we are not setting "keep" to 1, - * the message will be discarded because "some other action" was successfully taken. - */ + /* Cancel the implicit keep. That's all there is to it. */ cs->cancel_implicit_keep = 1; return SIEVE2_OK; } @@ -454,6 +452,15 @@ void sieve_do_msg(long msgnum, void *userdata) { strcpy(my.sender, ""); } + /* Keep track of the subject so we can use it for VACATION responses */ + if (msg->cm_fields['U'] != NULL) { + safestrncpy(my.subject, msg->cm_fields['U'], sizeof my.subject); + } + else { + strcpy(my.subject, ""); + } + + free(msg); sieve2_setvalue_string(sieve2_context, "allheaders", my.rfc822headers); diff --git a/citadel/serv_sieve.h b/citadel/serv_sieve.h index e8eba73f1..944370bdf 100644 --- a/citadel/serv_sieve.h +++ b/citadel/serv_sieve.h @@ -15,12 +15,19 @@ struct sdm_script { char *script_content; }; +struct sdm_vacation { + struct sdm_vacation *next; + char hash[256]; + time_t timestamp; +} + struct sdm_userdata { sieve2_context_t *sieve2_context; /**< for libsieve's use */ long config_msgnum; /**< confirms that a sieve config was located */ char config_roomname[ROOMNAMELEN]; long lastproc; /**< last message processed */ struct sdm_script *first_script; + struct sdm_vacation *first_vacation; }; struct ctdl_sieve { @@ -34,12 +41,19 @@ struct ctdl_sieve { char recp_node[256]; char recp_name[256]; char sender[256]; /* To whom shall we send reject bounces or vacation messages? */ + char subject[1024]; /* Retain msg subject so we can use it in vacation messages */ }; /* If you change this string you will break all of your Sieve configs. */ #define CTDLSIEVECONFIGSEPARATOR "\n-==-\n" +/* Maximum time we keep vacation hash records online. This implies that a vacation + * rule cannot exceed this amount of time. 5184000 seconds == 60 days, which is + * way too long for anyone to be on vacation. + */ +#define MAX_VACATION 5184000 + extern struct RoomProcList *sieve_list; void sieve_queue_room(struct ctdlroom *);