diff options
| author | cotton | 1998-11-21 17:40:11 +0000 |
|---|---|---|
| committer | cotton | 1998-11-21 17:40:11 +0000 |
| commit | b3b9d11a05c6b69d8786db177d058fe7115bd6ed (patch) | |
| tree | 62a8fdf5e2d9b3748a68aa06120f2f8f23d99089 /Mailman/MailList.py | |
| parent | c4673a9a249262077384c71e146a8443d5bb1a2b (diff) | |
| download | mailman-b3b9d11a05c6b69d8786db177d058fe7115bd6ed.tar.gz mailman-b3b9d11a05c6b69d8786db177d058fe7115bd6ed.tar.zst mailman-b3b9d11a05c6b69d8786db177d058fe7115bd6ed.zip | |
I should have broken this up into 2 checkins because it implements one
fix and one addition. Sorry, i realized that too late.
This change adds another list conifg variable "admin_notify_mchanges",
which is a boolean 0 or 1 and specifies whether or not the list admin
gets notifications of subscriptions and unsubscriptions.
The functions MailList.DeleteMember and MailList.ApprovedAddMember
trigger the delivery if it is turned on for the list or passed in as
an optional argument. This way, it is the duty of programs/code that
do mass subscriptions/unsubscriptions where this notification may not
be appropriate to specify that in the call to .DeleteMember or
.ApprovedAddMember.
There are 2 new templates, adminsubscribeack.txt and
adminunsubscribeack.txt which are used in sending these
notifications.
Defaults.py.in has a variable "DEFAULT_ADMIN_NOTIFY_MCHANGES" which is
set to 0 so that old lists will act the same by default, and the data
version is up'ed to 12. versions.py sets the variable if it's not
already there for a list. The config info for the admin cgi program
for this new variable is set right after the variable for immediate
notifications.
The second change is a fix where ApprovedAddMember was calling a
"self.Save()", which made mass subscribe situiations really far too
slow. I removed the .Save() from there and added it to the more outer
level code in the following places:
bin/convert_list
Mailman/ListAdmin.py
Mailman/MailCommandHandler.py
Mailman/Cgi/admin.py
Note that since AddMember can trigger a call to ApprovedAddMember, all
the places where AddMember is called needed a .Save() added as well.
I need to add a call to .Save() for Mailman/Cgi/subscribe.py as well
and will do that in a moment.
scott
Diffstat (limited to 'Mailman/MailList.py')
| -rw-r--r-- | Mailman/MailList.py | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/Mailman/MailList.py b/Mailman/MailList.py index 0ca5b1714..7917e8356 100644 --- a/Mailman/MailList.py +++ b/Mailman/MailList.py @@ -191,6 +191,8 @@ class MailList(MailCommandHandler, HTMLFormatter, Deliverer, ListAdmin, self.posters = [] self.forbidden_posters = [] self.admin_immed_notify = mm_cfg.DEFAULT_ADMIN_IMMED_NOTIFY + self.admin_notify_mchanges = \ + mm_cfg.DEFAULT_ADMIN_NOTIFY_MCHANGES self.moderated = mm_cfg.DEFAULT_MODERATED self.require_explicit_destination = \ mm_cfg.DEFAULT_REQUIRE_EXPLICIT_DESTINATION @@ -373,6 +375,9 @@ class MailList(MailCommandHandler, HTMLFormatter, Deliverer, ListAdmin, " option causes notices to be sent immediately on the arrival" " of new requests, as well."), + ('admin_notify_mchanges', mm_cfg.Radio, ('No', 'Yes'), 0, + 'Should administrator get notices of subscribes/unsubscribes?'), + ('dont_respond_to_post_requests', mm_cfg.Radio, ('Yes', 'No'), 0, 'Send mail to poster when their posting is held for approval?', @@ -774,12 +779,17 @@ class MailList(MailCommandHandler, HTMLFormatter, Deliverer, ListAdmin, - def ApprovedAddMember(self, name, password, digest, ack=None): + def ApprovedAddMember(self, name, password, digest, ack=None, admin_notif=None): if ack is None: if self.send_welcome_msg: ack = 1 else: ack = 0 + if admin_notif is None: + if self.admin_notify_mchanges: + admin_notif = 1 + else: + admin_notif = 0 name = Utils.LCDomain(name) if self.IsMember(name): raise Errors.MMAlreadyAMember @@ -794,9 +804,17 @@ class MailList(MailCommandHandler, HTMLFormatter, Deliverer, ListAdmin, self.LogMsg("subscribe", "%s: new%s %s", self._internal_name, kind, name) self.passwords[name] = password - self.Save() if ack: self.SendSubscribeAck(name, password, digest) + if admin_notif: + import Message + txt = Utils.maketext("adminsubscribeack.txt", + {"mmowner": mm_cfg.MAILMAN_OWNER, + "admin_email": self.GetAdminEmail(), + "listname": self.real_name, + "member": name}, 1) + msg = Message.IncomingMessage(txt) + self.DeliverToOwner(msg, self.owner) def ProcessConfirmation(self, cookie): @@ -813,7 +831,7 @@ class MailList(MailCommandHandler, HTMLFormatter, Deliverer, ListAdmin, - def DeleteMember(self, name, whence=None): + def DeleteMember(self, name, whence=None, admin_notif=None): self.IsListInitialized() # FindMatchingAddresses *should* never return more than 1 address. # However, should log this, just to make sure. @@ -846,6 +864,20 @@ class MailList(MailCommandHandler, HTMLFormatter, Deliverer, ListAdmin, self.SendUnsubscribeAck(name) self.ClearBounceInfo(name) self.Save() + if admin_notif is None: + if self.admin_notify_mchanges: + admin_notif = 1 + else: + admin_notif = 0 + if admin_notif: + import Message + txt = Utils.maketext("adminunsubscribeack.txt", + {"mmowner": mm_cfg.MAILMAN_OWNER, + "admin_email": self.GetAdminEmail(), + "listname": self.real_name, + "member": name}, 1) + msg = Message.IncomingMessage(txt) + self.DeliverToOwner(msg, self.owner) if whence: whence = "; %s" % whence else: whence = "" self.LogMsg("subscribe", "%s: deleted %s%s", |
