[Mailman-Developers] unioned lists patch

Mark Tearle mtearle@tartarus.uwa.edu.au
Mon, 3 Jan 2000 17:16:49 +0800 (WST)


Hi all

The following is a local patch to Mailman (against 1.1, the latest version
of packaged up for debian anyhow) to effect unions lists.  (ie for a 
list of lists, each recipient will only get one copy if they are on more
than one list. )

mooneye:/usr/lib/mailman/Mailman# diff -c MailList.py-orig MailList.py
*** MailList.py-orig    Tue Jan  4 00:09:21 2000
--- MailList.py Tue Jan  4 00:45:35 2000
***************
*** 1342,1350 ****
--- 1342,1374 ----
        # Deliver the mail.
        members = self.GetDeliveryMembers()
          recipients = []
+ 
+       recip_set = {}
+ 
          for m in members:
              if not self.GetUserOption(m, mm_cfg.DisableDelivery):
                  recipients.append(m)
+               recip_set[m] = 1
+ 
+       # Code to union in other lists.
+       if hasattr(self, "union_lists"):
+           msg.SetHeader('X-Unioned-Lists', string.join(self.union_lists, \
+               ", "))
+           for union_list in self.union_lists:
+               # Open the list. Do not lock, since this would cause deadlock.
+               try:
+                   imp_list = MailList(union_list, 0)
+               except:
+                   continue
+               imp_members = imp_list.GetDeliveryMembers()
+               for m in imp_members:
+                   if not imp_list.GetUserOption(m, mm_cfg.DisableDelivery):
+                       if not recip_set.has_key(m):
+                           recipients.append(m)
+                           recip_set[m] = 1
+               imp_list = None
+       recip_set = None
+ 
        if dont_send_to_sender:
              try:
                  recipients.remove(self.GetUserSubscribedAddress(sender))



Yours
Mark
-- 
Mark Tearle - mtearle@tartarus.uwa.edu.au

Captain Bipto: We did win, didn't we?
Blaznee: No, but if we think fast enough we might just live to lie about it.