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