[sysadmin-bin] ensure mailing lists accept @post-only members



commit ba6e5c58d5a6a1238e5a5a55ad65b0a69cdf6629
Author: Olav Vitters <olav vitters nl>
Date:   Thu Dec 22 21:07:19 2016 +0100

    ensure mailing lists accept @post-only members

 mail/mailman-moderated-lists |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/mail/mailman-moderated-lists b/mail/mailman-moderated-lists
index e615c04..8ce5037 100755
--- a/mail/mailman-moderated-lists
+++ b/mail/mailman-moderated-lists
@@ -30,6 +30,8 @@ CHECKS=[
         ('forward_auto_discards', False),
         # - ensure https
         ('web_page_url', 'https://mail.gnome.org/mailman/', lambda m: m.web_page_url == 
'http://mail.gnome.org/mailman/')
+        # - ensure post-only members are auto accepted
+        ('accept_these_nonmembers', set(('@post-only',))
 ]
 
 
@@ -48,10 +50,29 @@ for n in mlist_names:
         if getattr(mlist, attr_name) == attr_val:
             continue
 
+        curval = getattr(mlist, attr_name)
+
         # Do we have a specific lamba check and does it validate?
         if len(ck) > 2 and not ck[2](mlist):
             continue
 
+        if isinstance(curval, (list, tuple)):
+            if isinstance(attr_val, set):
+                # Remove members already found in curval
+                attr_val.difference_update(curval)
+
+                # Double check if there's anything to do
+                if not attr_val:
+                    continue
+
+                # Prepend missing items into the current items
+                curval[0:0] = list(sorted(attr_val))
+                # Now pretend that attr_val is this modified list
+                attr_val = curval
+            else:
+                # ignore any other lists!
+                continue
+
         # Remember to change the attr (done while mailing list is locked)
         change.append((attr_name, attr_val))
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]