From: mmj Date: Tue, 7 Sep 2004 11:49:11 +0000 (+1000) Subject: Bouncelife and crontab entry fix and a commented out genmsgid() function X-Git-Tag: RELEASE_1_0_0~9 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0329c3be35de2ab12106171ba6431cbafda92b8a;p=thirdparty%2Fmlmmj.git Bouncelife and crontab entry fix and a commented out genmsgid() function --- diff --git a/ChangeLog b/ChangeLog index 0d30a37e..58897bd9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/TUNABLES b/TUNABLES index e3eec3d8..f6e090fd 100644 --- a/TUNABLES +++ b/TUNABLES @@ -77,3 +77,8 @@ to specify several entries (one pr. line), it's marked "list". 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. diff --git a/contrib/web/perl-admin/conf/tunables.pl b/contrib/web/perl-admin/conf/tunables.pl index 1fba5713..3a0cdbf7 100644 --- a/contrib/web/perl-admin/conf/tunables.pl +++ b/contrib/web/perl-admin/conf/tunables.pl @@ -59,3 +59,7 @@ mlmmj_string("relayhost", 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."); diff --git a/contrib/web/php-admin/conf/tunables.php b/contrib/web/php-admin/conf/tunables.php index 8ed23a5c..d9809e92 100644 --- a/contrib/web/php-admin/conf/tunables.php +++ b/contrib/web/php-admin/conf/tunables.php @@ -62,4 +62,9 @@ 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."); + ?> diff --git a/include/mlmmj.h b/include/mlmmj.h index 022eeb1a..b7b539dd 100644 --- a/include/mlmmj.h +++ b/include/mlmmj.h @@ -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 */ diff --git a/src/Makefile.am b/src/Makefile.am index 13468cf0..a8a5a165 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -46,4 +46,5 @@ mlmmj_bounce_SOURCES = mlmmj-bounce.c print-version.c log_error.c \ 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 diff --git a/src/mlmmj-maintd.c b/src/mlmmj-maintd.c index ac330eed..8dc65809 100644 --- a/src/mlmmj-maintd.c +++ b/src/mlmmj-maintd.c @@ -41,6 +41,7 @@ #include "mygetline.h" #include "wrappers.h" #include "memory.h" +#include "ctrlvalue.h" static int maintdlogfd = -1; @@ -603,12 +604,12 @@ int unsub_bouncers(const char *listdir, const char *mlmmjunsub) 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 @@ int unsub_bouncers(const char *listdir, const char *mlmmjunsub) 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 @@ int unsub_bouncers(const char *listdir, const char *mlmmjunsub) 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 */ diff --git a/src/mlmmj-make-ml.sh b/src/mlmmj-make-ml.sh index 3aae0cf2..83185c25 100755 --- a/src/mlmmj-make-ml.sh +++ b/src/mlmmj-make-ml.sh @@ -106,7 +106,7 @@ if [ -z "$MLMMJRECIEVE" ]; then 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:" diff --git a/src/strgen.c b/src/strgen.c index d3412f12..0d46dce4 100644 --- a/src/strgen.c +++ b/src/strgen.c @@ -28,6 +28,7 @@ #include #include #include +#include #include "strgen.h" #include "wrappers.h" @@ -212,3 +213,23 @@ char *cleanquotedp(char *qpstr) 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; +} +*/