From: mmj Date: Mon, 27 Jul 2009 11:55:27 +0000 (+1000) Subject: ifmodsendonlymodmoderate X-Git-Tag: RELEASE_1_2_17~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d0058c0923bf45db366d9db42e14a32ad9fa6f42;p=thirdparty%2Fmlmmj.git ifmodsendonlymodmoderate --- diff --git a/TUNABLES b/TUNABLES index e03ca037..5d307a9d 100644 --- a/TUNABLES +++ b/TUNABLES @@ -198,8 +198,16 @@ to specify several entries (one pr. line), it's marked "list". If this is set, the LISTNAME+list@ functionality for requesting an email with the subscribers for owner is disabled. - · staticbounceaddr (normal) + · staticbounceaddr (normal) If this is set to something@example.org, the bounce address (Return-Path:) will be fixed to something+listname-bounces-and-so-on@example.org in case you need to disable automatic bounce handling. + + · ifmodsendonlymodmoderate (boolean) + + If this file is present, then mlmmj in case of moderation checks the + envelope from, to see if the sender is a moderator, and in that case + only send the moderation mails to that address. In practice this means that + a moderator sending mail to the list wont bother all the other moderators + with his mail. diff --git a/src/mlmmj-process.c b/src/mlmmj-process.c index 24178598..bccd3e44 100644 --- a/src/mlmmj-process.c +++ b/src/mlmmj-process.c @@ -70,13 +70,13 @@ static char *action_strs[] = { void newmoderated(const char *listdir, const char *mailfilename, - const char *mlmmjsend) + const char *mlmmjsend, const char *efromsender) { char *from, *listfqdn, *listname, *moderators = NULL; char *buf, *replyto, *listaddr = getlistaddr(listdir), *listdelim; - char *queuefilename = NULL, *moderatorsfilename; + char *queuefilename = NULL, *moderatorsfilename, *efromismod = NULL; char *mailbasename = mybasename(mailfilename), *tmp, *to; - int moderatorsfd; + int moderatorsfd, foundaddr = 0; char *maildata[4] = { "moderateaddr", NULL, "moderators", NULL }; #if 0 printf("mailfilename = [%s], mailbasename = [%s]\n", mailfilename, @@ -93,13 +93,23 @@ void newmoderated(const char *listdir, const char *mailfilename, } myfree(moderatorsfilename); + if(statctrl(listdir, "ifmodsendonlymodmoderate")) + efromismod = concatstr(2, efromsender, "\n"); + while((buf = mygetline(moderatorsfd))) { + if(efromismod && strcmp(buf, efromismod) == 0) + foundaddr = 1; tmp = moderators; moderators = concatstr(2, moderators, buf); myfree(buf); myfree(tmp); } + if(!foundaddr) { + myfree(efromismod); + efromismod = NULL; + } + close(moderatorsfd); listdelim = getlistdelim(listdir); @@ -107,7 +117,11 @@ void newmoderated(const char *listdir, const char *mailfilename, "@", listfqdn); maildata[1] = replyto; - maildata[3] = moderators; + if(efromismod) { + myfree(moderators); + maildata[3] = efromismod; + } else + maildata[3] = moderators; from = concatstr(4, listname, listdelim, "owner@", listfqdn); to = concatstr(3, listname, "-moderators@", listfqdn); /* FIXME JFA: Should this be converted? Why, why not? */ @@ -119,7 +133,15 @@ void newmoderated(const char *listdir, const char *mailfilename, queuefilename = prepstdreply(listdir, "moderation", "$listowner$", to, replyto, 2, maildata, NULL, mailfilename); - execlp(mlmmjsend, mlmmjsend, + if(efromismod) + execlp(mlmmjsend, mlmmjsend, + "-l", "1", + "-L", listdir, + "-F", from, + "-m", queuefilename, + "-T", efromsender, (char *)NULL); + else + execlp(mlmmjsend, mlmmjsend, "-l", "2", "-L", listdir, "-F", from, @@ -837,7 +859,7 @@ startaccess: /* Don't send a mail about denial to the list, but silently * discard and exit. Also do this in case it's turned off */ accret = do_access(access_rules, &allheaders, - fromemails.emaillist[0], listdir); + fromemails.emaillist[0], listdir); if (accret == DENY) { if ((strcasecmp(listaddr, fromemails.emaillist[0]) == 0) || noaccessdenymails) { @@ -912,7 +934,7 @@ startaccess: exit(EXIT_FAILURE); } myfree(donemailname); - newmoderated(listdir, mqueuename, mlmmjsend); + newmoderated(listdir, mqueuename, mlmmjsend, efrom); return EXIT_SUCCESS; }