Last active
February 23, 2016 10:05
-
-
Save komeda-shinji/d2cfa8008b02cd4d0468 to your computer and use it in GitHub Desktop.
Mailman: disable X-BeenThere, disable Cc when full personalize, disable notification if bounce_you_are_disabled_warnings_interval ==0
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -u Mailman/Queue/CommandRunner.py- Mailman/Queue/CommandRunner.py | |
--- Mailman/Queue/CommandRunner.py- 2015-04-03 22:03:27.000000000 +0900 | |
+++ Mailman/Queue/CommandRunner.py 2015-04-22 19:28:34.221206025 +0900 | |
@@ -244,6 +244,9 @@ | |
syslog('vette', 'replied and discard') | |
# w/discard | |
return False | |
+ if hasattr(mlist, 'ignore_requests') and mlist.ignore_requests: | |
+ syslog('vette', 'ignore and discard') | |
+ return False | |
# Now craft the response | |
res = Results(mlist, msg, msgdata) | |
# BAW: Not all the functions of this qrunner require the list to be | |
diff -u Mailman/Handlers/SMTPDirect.py- Mailman/Handlers/SMTPDirect.py | |
--- Mailman/Handlers/SMTPDirect.py- 2015-04-03 22:03:27.000000000 +0900 | |
+++ Mailman/Handlers/SMTPDirect.py 2015-04-22 16:48:58.647710862 +0900 | |
@@ -314,6 +314,8 @@ | |
name = None | |
if mlist.isMember(recip): | |
name = mlist.getMemberName(recip) | |
+ if hasattr(mlist, 'msg_to') and mlist.msg_to: | |
+ name = mlist.msg_to % name | |
if name: | |
# Convert the name to an email-safe representation. If the | |
# name is a byte string, convert it first to Unicode, given | |
diff -u Mailman/Handlers/Cleanse.py- Mailman/Handlers/Cleanse.py | |
--- Mailman/Handlers/Cleanse.py- 2015-04-03 22:03:27.000000000 +0900 | |
+++ Mailman/Handlers/Cleanse.py 2015-04-28 15:18:05.828988661 +0900 | |
@@ -61,6 +61,21 @@ | |
if uf: | |
uf = re.sub(r'\S*@\S*', mlist.GetListEmail(), uf) | |
msg.set_unixfrom(uf) | |
+ if hasattr(mlist, 'list_from') and mlist.list_from: | |
+ i18ndesc, list_from = parseaddr(mlist.list_from) | |
+ if i18ndesc: | |
+ i18ndesc = str(uheader(mlist, i18ndesc, 'From')) | |
+ else: | |
+ i18ndesc = str(uheader(mlist, mlist.description, 'From')) | |
+ if list_from: | |
+ del msg['from'] | |
+ del msg['reply-to'] | |
+ msg['From'] = formataddr((i18ndesc, list_from)) | |
+ msg['Reply-To'] = list_from | |
+ uf = msg.get_unixfrom() | |
+ if uf: | |
+ uf = re.sub(r'\S*@\S*', list_from, uf) | |
+ msg.set_unixfrom(uf) | |
# Some headers can be used to fish for membership | |
del msg['return-receipt-to'] | |
del msg['disposition-notification-to'] | |
diff -u Mailman/Handlers/CookHeaders.py- Mailman/Handlers/CookHeaders.py | |
--- Mailman/Handlers/CookHeaders.py- 2015-04-03 22:03:27.000000000 +0900 | |
+++ Mailman/Handlers/CookHeaders.py 2015-04-22 12:11:47.208346795 +0900 | |
@@ -94,7 +94,12 @@ | |
pass | |
# Mark message so we know we've been here, but leave any existing | |
# X-BeenThere's intact. | |
- change_header('X-BeenThere', mlist.GetListEmail(), | |
+ if hasattr(mlist, 'disable_x_beenthere'): | |
+ disable_x_beenthere = mlist.disable_x_beenthere | |
+ else: | |
+ disable_x_beenthere = False | |
+ if not disable_x_beenthere: | |
+ change_header('X-BeenThere', mlist.GetListEmail(), | |
mlist, msg, msgdata, delete=False) | |
# Add Precedence: and other useful headers. None of these are standard | |
# and finding information on some of them are fairly difficult. Some are | |
@@ -189,7 +194,11 @@ | |
# Also skip Cc if this is an anonymous list as list posting address | |
# is already in From and Reply-To in this case and similarly for | |
# an 'author is list' list. | |
- if mlist.personalize == 2 and mlist.reply_goes_to_list <> 1 \ | |
+ if hasattr(mlist, 'disable_full_personalize_add_cc'): | |
+ disable_add_cc = mlist.disable_full_personalize_add_cc | |
+ else: | |
+ disable_add_cc = False | |
+ if not disable_add_cc and mlist.personalize == 2 and mlist.reply_goes_to_list <> 1 \ | |
and not mlist.anonymous_list and not (mlist.from_is_list and | |
mm_cfg.ALLOW_FROM_IS_LIST): | |
# Watch out for existing Cc headers, merge, and remove dups. Note | |
diff -u Mailman/MailList.py- Mailman/MailList.py | |
--- Mailman/MailList.py- 2015-04-03 22:03:26.000000000 +0900 | |
+++ Mailman/MailList.py 2015-04-22 16:25:15.835345377 +0900 | |
@@ -233,6 +233,12 @@ | |
def GetListEmail(self): | |
return self.getListAddress() | |
+ def GetListEmailFrom(self): | |
+ if hasattr(self, 'list_from'): | |
+ return self.list_from | |
+ else: | |
+ return '' | |
+ | |
def GetMemberAdminEmail(self, member): | |
"""Usually the member addr, but modified for umbrella lists. | |
@@ -425,6 +431,17 @@ | |
# automatic discarding | |
self.max_days_to_hold = mm_cfg.DEFAULT_MAX_DAYS_TO_HOLD | |
+ if hasattr(mm_cfg, 'DEFAULT_DISABLE_X_BEENTHERE'): | |
+ self.disable_x_beenthere = mm_cfg.DEFAULT_DISABLE_X_BEENTHERE | |
+ else: | |
+ self.disable_x_beenthere = False | |
+ if hasattr(mm_cfg, 'DEFAULT_DISABLE_FULL_PERSONALIZE_ADD_CC'): | |
+ self.disable_full_personalize_add_cc = mm_cfg.DEFAULT_DISABLE_FULL_PERSONALIZE_ADD_CC | |
+ else: | |
+ self.disable_full_personalize_add_cc = False | |
+ self.list_from = '' | |
+ self.msg_to = '' | |
+ | |
# | |
# Web API support via administrative categories | |
diff -u Mailman/Cgi/admin.py- Mailman/Cgi/admin.py | |
--- Mailman/Cgi/admin.py- 2015-04-03 22:03:26.000000000 +0900 | |
+++ Mailman/Cgi/admin.py 2015-04-22 14:15:48.314482082 +0900 | |
@@ -653,7 +653,10 @@ | |
value = gui.getValue(mlist, kind, varname, params) | |
# Filter out None, and volatile attributes | |
if value is None and not varname.startswith('_'): | |
- value = getattr(mlist, varname) | |
+ if hasattr(mlist, varname): | |
+ value = getattr(mlist, varname) | |
+ else: | |
+ value = '' | |
# Now create the widget for this value | |
if kind == mm_cfg.Radio or kind == mm_cfg.Toggle: | |
# If we are returning the option for subscribe policy and this site | |
@@ -903,6 +906,10 @@ | |
all.sort(lambda x, y: cmp(x.lower(), y.lower())) | |
# See if the query has a regular expression | |
regexp = cgidata.getvalue('findmember', '').strip() | |
+ try: | |
+ regexp = regexp.decode(Utils.GetCharSet(mlist.preferred_language)) | |
+ except: | |
+ pass | |
if regexp: | |
try: | |
cre = re.compile(regexp, re.IGNORECASE) | |
diff -u Mailman/versions.py- Mailman/versions.py | |
--- Mailman/versions.py- 2015-04-03 22:03:26.000000000 +0900 | |
+++ Mailman/versions.py 2015-04-22 12:11:47.248347618 +0900 | |
@@ -422,6 +422,9 @@ | |
add_only_if_missing('regular_exclude_ignore', | |
mm_cfg.DEFAULT_REGULAR_EXCLUDE_IGNORE) | |
+ add_only_if_missing('disable_full_personalize_add_cc', 0) | |
+ add_only_if_missing('disable_x_beenthere', 0) | |
+ | |
def UpdateOldUsers(mlist): | |
diff -u Mailman/Gui/Autoresponse.py- Mailman/Gui/Autoresponse.py | |
--- Mailman/Gui/Autoresponse.py- 2015-04-03 22:03:27.000000000 +0900 | |
+++ Mailman/Gui/Autoresponse.py 2015-04-22 19:27:00.875170780 +0900 | |
@@ -74,6 +74,10 @@ | |
Mailman to discard the original email, or forward it on to the | |
system as a normal mail command.''')), | |
+ ('ignore_requests', mm_cfg.Radio, | |
+ (_('No'), _('Yes')), 0, | |
+ _('Should Mailman ignore command mail sent to -request address?')), | |
+ | |
('autoresponse_request_text', mm_cfg.FileUpload, | |
(6, WIDTH), 0, | |
_('Auto-response text to send to -request emails.')), | |
diff -u Mailman/Gui/GUIBase.py- Mailman/Gui/GUIBase.py | |
--- Mailman/Gui/GUIBase.py- 2015-04-03 22:03:27.000000000 +0900 | |
+++ Mailman/Gui/GUIBase.py 2015-04-22 16:43:11.692580045 +0900 | |
@@ -136,8 +136,9 @@ | |
def _setValue(self, mlist, property, val, doc): | |
# Set the value, or override to take special action on the property | |
- if not property.startswith('_') and getattr(mlist, property) <> val: | |
- setattr(mlist, property, val) | |
+ if not property.startswith('_'): | |
+ if not hasattr(mlist, property) or getattr(mlist, property) <> val: | |
+ setattr(mlist, property, val) | |
def _postValidate(self, mlist, doc): | |
# Validate all the attributes for this category | |
diff -u Mailman/Gui/General.py- Mailman/Gui/General.py | |
--- Mailman/Gui/General.py- 2015-04-03 22:03:27.000000000 +0900 | |
+++ Mailman/Gui/General.py 2015-04-22 18:38:40.071772448 +0900 | |
@@ -175,6 +175,8 @@ | |
('anonymous_list', mm_cfg.Radio, (_('No'), _('Yes')), 0, | |
_("""Hide the sender of a message, replacing it with the list | |
address (Removes From, Sender and Reply-To fields)""")), | |
+ ('list_from', mm_cfg.String, WIDTH, 0, | |
+ _("""Rewrite From: header of a message, replacing it with this address""")), | |
_('''<tt>Reply-To:</tt> header munging'''), | |
@@ -464,6 +466,11 @@ | |
Use 0 for no automatic discarding.""")) | |
) | |
+ rtn.append( | |
+ ('disable_x_beenthere', mm_cfg.Toggle, (_('No'), _('Yes')), 0, | |
+ _('Disable add X-BeenThere header')) | |
+ ) | |
+ | |
return rtn | |
def _setValue(self, mlist, property, val, doc): | |
diff -u Mailman/Gui/NonDigest.py- Mailman/Gui/NonDigest.py | |
--- Mailman/Gui/NonDigest.py- 2015-04-03 22:03:27.000000000 +0900 | |
+++ Mailman/Gui/NonDigest.py 2015-04-22 18:34:04.681712936 +0900 | |
@@ -137,6 +137,11 @@ | |
]) | |
info.extend([ | |
+ ('msg_to', mm_cfg.String, WIDTH, 0, | |
+ _('Header To: template for mail sent to regular list members')), | |
+ ]) | |
+ | |
+ info.extend([ | |
('scrub_nondigest', mm_cfg.Toggle, (_('No'), _('Yes')), 0, | |
_('Scrub attachments of regular delivery message?'), | |
_('''When you scrub attachments, they are stored in the archive | |
@@ -145,6 +150,12 @@ | |
totally disappear, you can use content filtering options.''')), | |
]) | |
+ if mm_cfg.OWNERS_CAN_ENABLE_PERSONALIZATION: | |
+ info.extend([ | |
+ ('disable_full_personalize_add_cc', mm_cfg.Toggle, (_('No'), _('Yes')), 0, | |
+ _('Disable add list address to Cc when full personalized')) | |
+ ]) | |
+ | |
info.extend([ | |
_('Sibling lists'), | |
diff -u Mailman/Bouncer.py- Mailman/Bouncer.py | |
--- Mailman/Bouncer.py- 2015-04-03 22:03:26.000000000 +0900 | |
+++ Mailman/Bouncer.py 2015-04-22 12:11:47.248347618 +0900 | |
@@ -257,10 +257,14 @@ | |
reason = self.getDeliveryStatus(member) | |
if info.noticesleft <= 0: | |
# BAW: Remove them now, with a notification message | |
+ if self.bounce_you_are_disabled_warnings_interval > 0: | |
+ userack = 1 | |
+ else: | |
+ userack = 0 | |
self.ApprovedDeleteMember( | |
member, 'disabled address', | |
admin_notif=self.bounce_notify_owner_on_removal, | |
- userack=1) | |
+ userack=userack) | |
# Expunge the pending cookie for the user. We throw away the | |
# returned data. | |
self.pend_confirm(info.cookie) | |
diff -u Mailman/Autoresponder.py- Mailman/Autoresponder.py | |
--- Mailman/Autoresponder.py- 2015-04-03 22:03:26.000000000 +0900 | |
+++ Mailman/Autoresponder.py 2015-04-22 19:27:43.168092987 +0900 | |
@@ -36,6 +36,7 @@ | |
self.autoresponse_admin_text = '' | |
self.autoresponse_request_text = '' | |
self.autoresponse_graceperiod = 90 # days | |
+ self.ignore_requests = 0 | |
# non-configurable | |
self.postings_responses = {} | |
self.admin_responses = {} | |
diff -u Mailman/Defaults.py- Mailman/Defaults.py | |
--- Mailman/Defaults.py- 2015-04-03 22:03:26.000000000 +0900 | |
+++ Mailman/Defaults.py 2015-04-22 12:11:47.252347701 +0900 | |
@@ -1318,6 +1318,8 @@ | |
DEFAULT_BOUNCE_NOTIFY_OWNER_ON_DISABLE = Yes | |
DEFAULT_BOUNCE_NOTIFY_OWNER_ON_REMOVAL = Yes | |
+DEFAULT_DISABLE_X_BEENTHERE = False | |
+DEFAULT_DISABLE_FULL_PERSONALIZE_ADD_CC = False | |
##### | |
diff -u cron/disabled- cron/disabled | |
--- cron/disabled- 2015-04-03 22:03:26.000000000 +0900 | |
+++ cron/disabled 2015-04-22 12:11:47.252347701 +0900 | |
@@ -196,7 +196,7 @@ | |
member, 0, today, | |
mlist.bounce_you_are_disabled_warnings) | |
lastnotice = time.mktime(info.lastnotice + (0,) * 6) | |
- if force or today >= lastnotice + interval: | |
+ if force or interval > 0 and today >= lastnotice + interval: | |
notify.append(member) | |
# Get a fresh re-enable cookie and set it. | |
info.cookie = mlist.pend_new(Pending.RE_ENABLE, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment