516b8342054e933307b8947092f317716157e733
[citadel.git] / citadel / serv_sieve.h
1 /*
2  * $Id$
3  */
4
5
6 #include <sieve2.h>
7 #include <sieve2_error.h>
8
9 struct sdm_script {
10         struct sdm_script *next;
11         char script_name[256];
12         int script_active;
13         char *script_content;
14 };
15
16 struct sdm_vacation {
17         struct sdm_vacation *next;
18         char fromaddr[256];
19         time_t timestamp;
20 };
21
22 struct sdm_userdata {
23         sieve2_context_t *sieve2_context;       /**< for libsieve's use */
24         long config_msgnum;                     /**< confirms that a sieve config was located */
25         char config_roomname[ROOMNAMELEN];
26         long lastproc;                          /**< last message processed */
27         struct sdm_script *first_script;
28         struct sdm_vacation *first_vacation;
29 };
30
31 struct ctdl_sieve {
32         char *rfc822headers;
33         int cancel_implicit_keep;       /* Set to 1 if the message was successfully acted upon */
34         int keep;                       /* Set to 1 to suppress message deletion from the inbox */
35         long usernum;                   /* Owner of the mailbox we're processing */
36         long msgnum;                    /* Message base ID of the message being processed */
37         struct sdm_userdata *u;         /* Info related to the current session */
38         char recp_user[256];
39         char recp_node[256];
40         char recp_name[256];
41         char sender[256];               /* To whom shall we send reject bounces or vacation messages? */
42         char subject[1024];             /* Retain msg subject so we can use it in vacation messages */
43         char envelope_from[1024];
44         char envelope_to[1024];
45 };
46
47
48 /* If you change this string you will break all of your Sieve configs. */
49 #define CTDLSIEVECONFIGSEPARATOR        "\n-=<CtdlSieveConfigSeparator>=-\n"
50
51 /* Maximum time we keep vacation fromaddr records online.  This implies that a vacation
52  * rule cannot exceed this amount of time.   (Any more than 30 days is a ridiculously
53  * long vacation which the person probably doesn't deserve.)
54  */
55 #define MAX_VACATION    30
56
57 extern struct RoomProcList *sieve_list;
58
59 void sieve_queue_room(struct ctdlroom *);
60 void perform_sieve_processing(void);
61
62 void msiv_load(struct sdm_userdata *u);
63 void msiv_store(struct sdm_userdata *u, int changes_made);
64 int msiv_setactive(struct sdm_userdata *u, char *script_name);
65 char *msiv_getscript(struct sdm_userdata *u, char *script_name);
66 int msiv_deletescript(struct sdm_userdata *u, char *script_name);
67 void msiv_putscript(struct sdm_userdata *u, char *script_name, char *script_content);
68 extern char *msiv_extensions;