aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--Mailman/Handlers/ToDigest.py9
-rw-r--r--Mailman/MailList.py54
2 files changed, 37 insertions, 26 deletions
diff --git a/Mailman/Handlers/ToDigest.py b/Mailman/Handlers/ToDigest.py
index 2f64b369..9051e846 100644
--- a/Mailman/Handlers/ToDigest.py
+++ b/Mailman/Handlers/ToDigest.py
@@ -39,6 +39,7 @@ from email.MIMEText import MIMEText
from email.MIMEMessage import MIMEMessage
from email.Utils import getaddresses
from email.Header import decode_header, make_header, Header
+from email.Charset import Charset
from Mailman import mm_cfg
from Mailman import Utils
@@ -137,9 +138,11 @@ def send_digests(mlist, mboxfp):
def send_i18n_digests(mlist, mboxfp):
mbox = Mailbox(mboxfp)
- # Prepare common information
+ # Prepare common information (first lang/charset)
lang = mlist.preferred_language
lcset = Utils.GetCharSet(lang)
+ lcset_out = Charset(lcset).output_charset
+ # Common Information (contd)
realname = mlist.real_name
volume = mlist.volume
issue = mlist.next_digest_number
@@ -316,6 +319,10 @@ def send_i18n_digests(mlist, mboxfp):
print >> plainmsg
payload = msg.get_payload(decode=True)\
or msg.as_string().split('\n\n',1)[1]
+ mcset = msg.get_content_charset('')
+ if mcset and mcset <> lcset and mcset <> lcset_out:
+ payload = unicode(payload, mcset, 'replace'
+ ).encode(lcset, 'replace')
print >> plainmsg, payload
if not payload.endswith('\n'):
print >> plainmsg
diff --git a/Mailman/MailList.py b/Mailman/MailList.py
index 2c5dfa7a..a98e4213 100644
--- a/Mailman/MailList.py
+++ b/Mailman/MailList.py
@@ -194,8 +194,11 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
def GetOwnerEmail(self):
return self.getListAddress('owner')
- def GetRequestEmail(self):
- return self.getListAddress('request')
+ def GetRequestEmail(self, cookie=''):
+ if mm_cfg.VERP_CONFIRMATIONS and cookie:
+ return self.GetConfirmEmail(cookie)
+ else:
+ return self.getListAddress('request')
def GetConfirmEmail(self, cookie):
return mm_cfg.VERP_CONFIRM_FORMAT % {
@@ -203,6 +206,13 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
'cookie': cookie,
} + '@' + self.host_name
+
+ def GetConfirmSubject(self, listname, cookie, verb):
+ if mm_cfg.VERP_CONFIRMATIONS and cookie:
+ return _( 'Your confirmation is required to %(verb)s the %(listname)s mailing list' )
+ else:
+ return 'confirm ' + cookie
+
def GetListEmail(self):
return self.getListAddress()
@@ -738,7 +748,6 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
"""
invitee = userdesc.address
Utils.ValidateEmail(invitee)
- requestaddr = self.GetRequestEmail()
# Hack alert! Squirrel away a flag that only invitations have, so
# that we can do something slightly different when an invitation
# subscription is confirmed. In those cases, we don't need further
@@ -746,6 +755,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
# list name to prevent invitees from cross-subscribing.
userdesc.invitation = self.internal_name()
cookie = self.pend_new(Pending.SUBSCRIPTION, userdesc)
+ requestaddr = self.GetRequestEmail(cookie)
confirmurl = '%s/%s' % (self.GetScriptURL('confirm', absolute=1),
cookie)
listname = self.real_name
@@ -759,14 +769,8 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
'cookie' : cookie,
'listowner' : self.GetOwnerEmail(),
}, mlist=self)
- if mm_cfg.VERP_CONFIRMATIONS:
- subj = _(
- 'You have been invited to join the %(listname)s mailing list')
- sender = self.GetConfirmEmail(cookie)
- else:
- # Do it the old fashioned way
- subj = 'confirm ' + cookie
- sender = requestaddr
+ subj = self.GetConfirmSubject(listname, cookie, 'join')
+ sender = self.GetRequestEmail(cookie)
msg = Message.UserNotification(
invitee, sender, subj,
text, lang=self.preferred_language)
@@ -876,18 +880,18 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
'listaddr' : self.GetListEmail(),
'listname' : realname,
'cookie' : cookie,
- 'requestaddr' : self.GetRequestEmail(),
+ 'requestaddr' : self.GetRequestEmail(cookie),
'remote' : remote,
'listadmin' : self.GetOwnerEmail(),
'confirmurl' : confirmurl,
}, lang=lang, mlist=self)
msg = Message.UserNotification(
- recipient, self.GetRequestEmail(),
+ recipient, self.GetRequestEmail(cookie),
text=text, lang=lang)
# BAW: See ChangeMemberAddress() for why we do it this way...
del msg['subject']
- msg['Subject'] = 'confirm ' + cookie
- msg['Reply-To'] = self.GetRequestEmail()
+ msg['Subject'] = self.GetConfirmSubject(realname, cookie, 'join')
+ msg['Reply-To'] = self.GetRequestEmail(cookie)
msg.send(self)
who = formataddr((name, email))
syslog('subscribe', '%s: pending %s %s',
@@ -1064,7 +1068,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
'listaddr' : self.GetListEmail(),
'listname' : realname,
'cookie' : cookie,
- 'requestaddr': self.GetRequestEmail(),
+ 'requestaddr': self.GetRequestEmail(cookie),
'remote' : '',
'listadmin' : self.GetOwnerEmail(),
'confirmurl' : confirmurl,
@@ -1077,18 +1081,18 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
# Subject: in a separate step, although we have to delete the one
# UserNotification adds.
msg = Message.UserNotification(
- newaddr, self.GetRequestEmail(),
+ newaddr, self.GetRequestEmail(cookie),
text=text, lang=lang)
del msg['subject']
- msg['Subject'] = 'confirm ' + cookie
- msg['Reply-To'] = self.GetRequestEmail()
+ msg['Subject'] = self.GetConfirmSubject(realname, cookie, 'join')
+ msg['Reply-To'] = self.GetRequestEmail(cookie)
msg.send(self)
def ApprovedChangeMemberAddress(self, oldaddr, newaddr, globally):
# It's possible they were a member of this list, but choose to change
# their membership globally. In that case, we simply remove the old
# address.
- if self.isMember(newaddr):
+ if self.getMemberCPAddress(oldaddr) == newaddr:
self.removeMember(oldaddr)
else:
self.changeMemberAddress(oldaddr, newaddr)
@@ -1108,7 +1112,7 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
mlist.Lock()
try:
# Same logic as above, re newaddr is already a member
- if mlist.isMember(newaddr):
+ if mlist.getMemberCPAddress(oldaddr) == newaddr:
mlist.removeMember(oldaddr)
else:
mlist.changeMemberAddress(oldaddr, newaddr)
@@ -1263,18 +1267,18 @@ class MailList(HTMLFormatter, Deliverer, ListAdmin,
'listaddr' : self.GetListEmail(),
'listname' : realname,
'cookie' : cookie,
- 'requestaddr' : self.GetRequestEmail(),
+ 'requestaddr' : self.GetRequestEmail(cookie),
'remote' : remote,
'listadmin' : self.GetOwnerEmail(),
'confirmurl' : confirmurl,
}, lang=lang, mlist=self)
msg = Message.UserNotification(
- addr, self.GetRequestEmail(),
+ addr, self.GetRequestEmail(cookie),
text=text, lang=lang)
# BAW: See ChangeMemberAddress() for why we do it this way...
del msg['subject']
- msg['Subject'] = 'confirm ' + cookie
- msg['Reply-To'] = self.GetRequestEmail()
+ msg['Subject'] = self.GetConfirmSubject(realname, cookie, 'leave')
+ msg['Reply-To'] = self.GetRequestEmail(cookie)
msg.send(self)