initial prep for VACATION extension
authorArt Cancro <ajc@citadel.org>
Fri, 20 Oct 2006 04:23:04 +0000 (04:23 +0000)
committerArt Cancro <ajc@citadel.org>
Fri, 20 Oct 2006 04:23:04 +0000 (04:23 +0000)
citadel/serv_sieve.c
citadel/serv_sieve.h

index e9e3db834755415a7e26cc2602b30dc6be7c9819..0dcbfea29a4565f2dab399efa3bc8ab384d25b23 100644 (file)
@@ -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);
index e8eba73f1c9e378cd0b91ca91fd9dea428e176a0..944370bdfa202212ace522eca4e4e11db068f84e 100644 (file)
@@ -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-=<CtdlSieveConfigSeparator>=-\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 *);