[Mailman-Users] Mac, me, icloud. Many domains one user.

Mark Sapiro mark at msapiro.net
Thu Oct 16 00:44:55 CEST 2014


On 10/15/2014 12:18 PM, Marino Pascal wrote:
> Long time lurker, first time poster.


Welcome.


> I have subscribers who subscribed with user at mac.com and then they try to
> post from user at me.com or user at icloud.com and their mail bounces off
> course since only subscribers can post.
> 
> I know how to add addresses with the "accept_these_nonmembers Option"
> but I have quite a few .mac users and I'm wondering if there is a way to
> treat
> mac.com, me.com & icloud.com as interchangeable.


I have attached the patch I use. It actually supports more than one set
of equivalent domains. The EQ_DOMAINS list is a list of tuples and each
tuple is a set of domains considered equivalent for list membership tests.

In the patch I have included, there are two sets. The ('mac.com',
'me.com', 'icloud.com') domains you're interested in and ('grizz.org',
'grizzlypeakcyclists.org') which are local equivalent domains.

The patched code works for list members, but not for addresses in
*_these_nonmembers even if those addresses come from another list via an
@listname reference.

There can be other issues in that if the poster's address is not the
actual member's address but an equivalent, the member's options like
'ack' and 'not metoo' aren't honored, but moderation is honored if the
actual member is moderated.

I don't think there's a way to do this short of patching the code.

I have considered making this a feature with configurable equivalent
domains in a future release, but I haven't thought it through.

-- 
Mark Sapiro <mark at msapiro.net>        The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan
-------------- next part --------------
=== modified file 'Mailman/Handlers/Moderate.py'
--- Mailman/Handlers/Moderate.py	2014-06-26 21:52:28 +0000
+++ Mailman/Handlers/Moderate.py	2014-10-15 22:22:57 +0000
@@ -32,6 +32,20 @@
 from Mailman.Logging.Syslog import syslog
 from Mailman.MailList import MailList
 
+EQ_DOMAINS = [('mac.com', 'me.com', 'icloud.com'),
+              ('grizz.org', 'grizzlypeakcyclists.org'),
+             ]
+
+def check_doms(sender):
+    if sender.find('@') < 0:
+        return []
+    local, domain = sender.split('@')
+    domain = domain.lower()
+    for domains in EQ_DOMAINS:
+        if domain in domains:
+            return [local + '@' + x for x in domains if x != domain]
+    return []
+
 
 

 class ModeratedMemberPost(Hold.ModeratedPost):
@@ -54,6 +68,13 @@
     for sender in msg.get_senders():
         if mlist.isMember(sender):
             break
+        double_break = False
+        for sender in check_doms(sender):
+            if mlist.isMember(sender):
+                double_break = True
+                break
+        if double_break:
+            break
     else:
         sender = None
     if sender:



More information about the Mailman-Users mailing list