]> git.ipfire.org Git - thirdparty/mlmmj.git/commitdiff
ifmodsendonlymodmoderate
authormmj <none@none>
Mon, 27 Jul 2009 11:55:27 +0000 (21:55 +1000)
committermmj <none@none>
Mon, 27 Jul 2009 11:55:27 +0000 (21:55 +1000)
TUNABLES
src/mlmmj-process.c

index e03ca0376684a301f68deb36d021acccfbb9c4ab..5d307a9d689925bc6b652e523befddf344fd99be 100644 (file)
--- 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.
index 241785982c5d281be7651498f46303f642b50cfe..bccd3e44519461abcf279742534338e943db355b 100644 (file)
@@ -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;
        }