changeset 320:b2fe9c6cb9fe

Bouncelife and crontab entry fix and a commented out genmsgid() function
author mmj
date Tue, 07 Sep 2004 21:49:11 +1000
parents e5a9f4406fbe
children 636e9c51320d
files ChangeLog TUNABLES contrib/web/perl-admin/conf/tunables.pl contrib/web/php-admin/conf/tunables.php include/mlmmj.h src/Makefile.am src/mlmmj-maintd.c src/mlmmj-make-ml.sh src/strgen.c
diffstat 9 files changed, 56 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Tue Sep 07 08:49:21 2004 +1000
+++ b/ChangeLog	Tue Sep 07 21:49:11 2004 +1000
@@ -1,3 +1,6 @@
+ o Make the time an address can bounce before unsubscribed configurable with
+   listdir/control/bouncelife
+ o Correct mlmmj-make-ml.sh cronentry line to include -F
  o Add manual pages. Thanks Soeren Boll for the initial ones
  o Make random numbers lowercase hex since gmail is lowercasing the address
    it replies to.
--- a/TUNABLES	Tue Sep 07 08:49:21 2004 +1000
+++ b/TUNABLES	Tue Sep 07 21:49:11 2004 +1000
@@ -77,3 +77,8 @@
 
    If this file is present, the owner(s) will get a mail with the address of
    someone sub/unsubscribing to a mailinglist.
+
+ · bouncelife			(normal)
+
+   Here is specified for how long time in seconds an address can bounce before
+   it's unsubscribed. Defaults to 432000 seconds, which is 5 days.
--- a/contrib/web/perl-admin/conf/tunables.pl	Tue Sep 07 08:49:21 2004 +1000
+++ b/contrib/web/perl-admin/conf/tunables.pl	Tue Sep 07 21:49:11 2004 +1000
@@ -59,3 +59,7 @@
 mlmmj_boolean("notifysub",
 			  "Notify subscribers",
 			  "If this option is set, the owner(s) will get a mail with the address of someone sub/unsubscribing to a mailinglist.");
+mlmmj_string("bouncelife",
+			  "Bouncing lifetime",
+			  "Here is specified for how long time in seconds an address can bounce before it's unsubscribed. Defaults ".
+			  "to 432000 seconds, which is 5 days.");
--- a/contrib/web/php-admin/conf/tunables.php	Tue Sep 07 08:49:21 2004 +1000
+++ b/contrib/web/php-admin/conf/tunables.php	Tue Sep 07 21:49:11 2004 +1000
@@ -62,4 +62,9 @@
 			  "Notify subscribers",
 			  "If this option is set, the owner(s) will get a mail with the address of someone sub/unsubscribing to a mailinglist.");
 
+mlmmj_string("bouncelife",
+			  "Bouncing lifetime",
+			  "Here is specified for how long time in seconds an address can bounce before it's unsubscribed. Defaults ".
+			  "to 432000 seconds, which is 5 days.");
+
 ?>
--- a/include/mlmmj.h	Tue Sep 07 08:49:21 2004 +1000
+++ b/include/mlmmj.h	Tue Sep 07 21:49:11 2004 +1000
@@ -36,7 +36,8 @@
 #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 */
+			     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 */
--- a/src/Makefile.am	Tue Sep 07 08:49:21 2004 +1000
+++ b/src/Makefile.am	Tue Sep 07 21:49:11 2004 +1000
@@ -46,4 +46,5 @@
 		       memory.c
 
 mlmmj_maintd_SOURCES = mlmmj-maintd.c print-version.c log_error.c mygetline.c \
-		       strgen.c random-int.c chomp.c writen.c memory.c
+		       strgen.c random-int.c chomp.c writen.c memory.c \
+		       ctrlvalue.c
--- a/src/mlmmj-maintd.c	Tue Sep 07 08:49:21 2004 +1000
+++ b/src/mlmmj-maintd.c	Tue Sep 07 21:49:11 2004 +1000
@@ -41,6 +41,7 @@
 #include "mygetline.h"
 #include "wrappers.h"
 #include "memory.h"
+#include "ctrlvalue.h"
 
 static int maintdlogfd = -1;
 
@@ -603,12 +604,12 @@
 	DIR *bouncedir;
 	char *dirname = concatstr(2, listdir, "/bounce/");
 	char *probefile, *address, *a, *firstbounce, *bouncedata;
-	char *logstr;
+	char *logstr, *bouncelifestr;
 	struct dirent *dp;
 	struct stat st;
 	pid_t pid, childpid;
 	int status, fd;
-	time_t bouncetime, t;
+	time_t bouncetime, t, bouncelife = 0;
 	
 	if(chdir(dirname) < 0) {
 		log_error(LOG_ARGS, "Could not chdir(%s)", dirname);
@@ -624,6 +625,15 @@
 
 	myfree(dirname);
 
+	bouncelifestr = ctrlvalue(listdir, "bouncelife");
+	if(bouncelifestr) {
+		bouncelife = atol(bouncelifestr);
+		myfree(bouncelifestr);
+	}
+	
+	if(bouncelife == 0)
+		bouncelife = BOUNCELIFE;
+
 	while((dp = readdir(bouncedir)) != NULL) {
 		if((strcmp(dp->d_name, "..") == 0) ||
 		   (strcmp(dp->d_name, ".") == 0))
@@ -682,7 +692,7 @@
 		bouncetime = (time_t)strtol(a, NULL, 10);
 		myfree(firstbounce);
 		t = time(NULL);
-		if(t - bouncetime < BOUNCELIFE + WAITPROBE)
+		if(t - bouncetime < bouncelife + WAITPROBE)
 			continue; /* ok, don't unsub this one */
 		
 		/* Ok, go ahead and unsubscribe the address */
--- a/src/mlmmj-make-ml.sh	Tue Sep 07 08:49:21 2004 +1000
+++ b/src/mlmmj-make-ml.sh	Tue Sep 07 21:49:11 2004 +1000
@@ -106,7 +106,7 @@
 fi
 
 ALIAS="$LISTNAME:  \"|$MLMMJRECIEVE -L $SPOOLDIR/$LISTNAME/\""
-CRONENTRY="0 */2 * * * \"$MLMMJMAINTD -L $SPOOLDIR/$LISTNAME/\""
+CRONENTRY="0 */2 * * * \"$MLMMJMAINTD -F -L $SPOOLDIR/$LISTNAME/\""
 
 if [ -n "$A_CREATE" ]; then
 	echo "I want to add the following to your /etc/aliases file:"
--- a/src/strgen.c	Tue Sep 07 08:49:21 2004 +1000
+++ b/src/strgen.c	Tue Sep 07 21:49:11 2004 +1000
@@ -28,6 +28,7 @@
 #include <unistd.h>
 #include <netdb.h>
 #include <libgen.h>
+#include <time.h>
 
 #include "strgen.h"
 #include "wrappers.h"
@@ -212,3 +213,23 @@
 
 	return retstr;
 }
+
+/* Unused for now, but lets keep it for later
+
+char *genmsgid()
+{
+	size_t len = 128;
+	char *s = mymalloc(len), *retstr;
+	time_t t;
+
+	t = time(NULL);
+
+	snprintf(s, len-1, "<%ld-%x-mlmmj-%x@%x.plonk", t, random_int(),
+				random_int(), random_int());
+
+	retstr = concatstr(3, "Message-ID: ", s, ">\n");
+	myfree(s);
+	
+	return retstr;
+}
+*/