File: mlmmj.h

package info (click to toggle)
mlmmj 1.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 2,772 kB
  • sloc: ansic: 13,308; sh: 1,709; php: 1,133; perl: 904; python: 190; makefile: 184
file content (123 lines) | stat: -rw-r--r-- 4,245 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/* Copyright (C) 2002, 2003, 2004 Mads Martin Joergensen <mmj at mmj.dk>
 *
 * $Id$
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to
 * deal in the Software without restriction, including without limitation the
 * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 * sell copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
 * IN THE SOFTWARE.
 */

#ifndef MLMMJ_GENERIC_INCLUDES
#define MLMMJ_GENERIC_INCLUDES

#include "config.h"

#define RELAYHOST "127.0.0.1"
#define READ_BUFSIZE 2048
#define DEFAULT_RECIPDELIM "+"  /* Default recipient delimiter */
#define MODREQLIFE 604800 /* How long time will moderation requests be kept?
			   * 604800s is 7 days */
#define DISCARDEDLIFE 604800 /* How long time will discarded mails be kept?
			      * 604800s is 7 days */
#define CONFIRMLIFE 604800 /* How long time will (un)sub confirmations be kept?
			    * 604800s is 7 days */
#define BOUNCELIFE 432000 /* How long time can addresses bounce before
			     unsubscription happens? 432000s is 5 days
			     Tweakable with control/bouncelife */
#define WAITPROBE 43200   /* How long do we wait for a bounce of the probe
			     mail before concluding the address is no longer
			     bouncing? 43200 is 12 hours */
#define MAINTD_SLEEP 7200 /* How long between maintenance runs when
			     mlmmj-maintd runs daemonized? 7200s is 2 hours */
#define MAINTD_LOGFILE "mlmmj-maintd.lastrun.log"

#define MEMORYMAILSIZE 16384  /* How big can a mail be before we don't want to
			         it in memory? control/memorymailsize */
#define DIGESTINTERVAL 604800  /* How long do we collect mails for digests
				* 604800s is 7 days */
#define DIGESTMAXMAILS 50 /* How many mails can accumulate before we send the
			   * digest */
#define DIGESTMIMETYPE "digest" /* Which sub-type of multipart to use when
				 * sending digest mails */
#define OPLOGFNAME "mlmmj.operation.log" /* logfile to log operations */
#define OPLOGSIZE 524288

#define MAXVERPRECIPS 100

struct strlist {
	int count;
	char **strs;
};

struct mailhdr {
	const char *token;
	int valuecount;
	char **values;
};

/* Has to go here, since it's used in many places */

enum subtype {
	SUB_NORMAL,
	SUB_DIGEST,
	SUB_NOMAIL,
	SUB_FILE, /* For single files (moderator, owner etc.) */
	SUB_ALL, /* For listing or unsubscribing all kinds of subscribers */
	SUB_BOTH, /* For normal+digest subscription */
	SUB_NONE /* For when an address is not subscribed at all */
};

char *subtype_strs[7]; /* count matches enum above; defined in subscriberfuncs.c */

enum subreason {
	SUB_REQUEST,
	SUB_CONFIRM,
	SUB_PERMIT,
	SUB_ADMIN,
	SUB_BOUNCING,
	SUB_SWITCH
};

char * subreason_strs[6]; /* count matches enum above; defined in subscriberfuncs.c */

void print_version(const char *prg);

#define MY_ASSERT(expression) if (!(expression)) { \
			errno = 0; \
			log_error(LOG_ARGS, "assertion failed"); \
			exit(EXIT_FAILURE); \
		}

#define CHECKFULLPATH(name) if(strchr(name, '/') == NULL) { \
			fprintf(stderr, "All mlmmj binaries have to " \
					"be invoked with full path,\n" \
					"e.g. /usr/bin/%s\n", name); \
			exit(EXIT_FAILURE); \
			};

/* make sure we use the wrappers */
#ifndef _MEMORY_C
#define malloc	Bad_programmer__no_biscuit
#define realloc	Bad_programmer__no_biscuit
#define free	Bad_programmer__no_biscuit
#ifdef strdup
#undef strdup
#define strdup	Bad_programmer__no_biscuit
#endif  /* strdup */
#endif  /* _MEMORY_C */

#endif /* MLMMJ_GENERIC_INCLUDES */