430f35970299b5789ad3a44d2c7bf516e4e8a29b
[citadel.git] / citadel / serv_sieve.c
1 /*
2  * $Id: serv_test.c 3850 2005-09-13 14:00:24Z ajc $
3  *
4  *
5  */
6
7 #include "sysdep.h"
8 #include <stdlib.h>
9 #include <unistd.h>
10 #include <stdio.h>
11 #include <fcntl.h>
12 #include <signal.h>
13 #include <pwd.h>
14 #include <errno.h>
15 #include <sys/types.h>
16
17 #if TIME_WITH_SYS_TIME
18 # include <sys/time.h>
19 # include <time.h>
20 #else
21 # if HAVE_SYS_TIME_H
22 #  include <sys/time.h>
23 # else
24 #  include <time.h>
25 # endif
26 #endif
27
28 #include <sys/wait.h>
29 #include <string.h>
30 #include <limits.h>
31 #include "citadel.h"
32 #include "server.h"
33 #include "sysdep_decls.h"
34 #include "citserver.h"
35 #include "support.h"
36 #include "config.h"
37 #include "serv_extensions.h"
38 #include "room_ops.h"
39 #include "policy.h"
40 #include "database.h"
41 #include "msgbase.h"
42
43 #ifdef HAVE_LIBSIEVE
44
45 #include "sieve2.h"
46 #include "sieve2_error.h"
47
48 /**
49  *      We don't really care about dumping the entire credits to the log
50  *      every time the server is initialized.  The documentation will suffice
51  *      for that purpose.  We are making a call to sieve2_credits() in order
52  *      to demonstrate that we have successfully linked in to libsieve.
53  */
54 void log_the_sieve2_credits(void) {
55         char *cred = NULL;
56         char *ptr;
57
58         cred = strdup(sieve2_credits());
59         if (cred == NULL) return;
60
61         if (strlen(cred) > 60) {
62                 strcpy(&cred[55], "...");
63         }
64
65         lprintf(CTDL_INFO, "%s\n",cred);
66         free(cred);
67 }
68
69
70 char *serv_sieve_init(void)
71 {
72         log_the_sieve2_credits();
73         return "$Id: serv_sieve.c 3850 2005-09-13 14:00:24Z ajc $";
74 }
75
76 #else   /* HAVE_LIBSIEVE */
77
78 char *serv_sieve_init(void)
79 {
80         lprintf(CTDL_INFO, "This server is missing libsieve.  Mailbox filtering will be disabled.\n");
81         return "$Id: serv_sieve.c 3850 2005-09-13 14:00:24Z ajc $";
82 }
83
84 #endif  /* HAVE_LIBSIEVE */