Re: [Mailman-Developers] VERP subscription confirmations

2004-02-13 Thread Gordon Rowell
On Thu, Feb 05, 2004 at 09:44:05PM -0500, Gordon Rowell [EMAIL PROTECTED] wrote:
 If I enable VERP_CONFIRMATIONS and Invite someone from the
 admin page, I get a VERP invite and a nice Subject line:
 [...]
 It appears that the VERP confirmations are only partially implemented,
 but maybe I've missed something.

 I was thinking of doing something like this in MailList.py
 (be gentle - Python newbie):
 [...]

The patch below seems to do the right thing for me. Anyone feel
game to test/comment?

Thanks,

Gordon

--- MailList.py-2.1.4   Sun Nov 30 19:54:16 2003
+++ MailList.py Fri Feb 13 23:25:44 2004
@@ -194,8 +194,11 @@
 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 @@
 'cookie': cookie,
 } + '@' + self.host_name
 
+
+def GetConfirmSubject(self, listname, cookie, verb):
+if mm_cfg.VERP_CONFIRMATIONS and cookie:
+return _( 'You have been invited to %(verb)s the %(listname)s mailing 
list' )
+else:
+return 'confirm ' + cookie
+
 def GetListEmail(self):
 return self.getListAddress()
 
@@ -695,7 +705,7 @@
 
 invitee = userdesc.address
 Utils.ValidateEmail(invitee)
-requestaddr = self.GetRequestEmail()
+#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
@@ -703,6 +713,7 @@
 # list name to prevent invitees from cross-subscribing.
 userdesc.invitation = self.internal_name()
 cookie = Pending.new(Pending.SUBSCRIPTION, userdesc)
+requestaddr = self.GetRequestEmail(cookie)
 confirmurl = '%s/%s' % (self.GetScriptURL('confirm', absolute=1),
 cookie)
 listname = self.real_name
@@ -716,14 +727,8 @@
  '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)
@@ -833,18 +838,18 @@
  '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',
@@ -1021,7 +1026,7 @@
  'listaddr'   : self.GetListEmail(),
  'listname'   : realname,
  'cookie' : cookie,
- 'requestaddr': self.GetRequestEmail(),
+ 'requestaddr': self.GetRequestEmail(cookie),
  'remote' : '',
  'listadmin'  : self.GetOwnerEmail(),
  'confirmurl' : confirmurl,
@@ -1034,11 +1039,11 @@
 # 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()
+

[Mailman-Developers] VERP subscription confirmations

2004-02-05 Thread Gordon Rowell
If I enable VERP_CONFIRMATIONS and Invite someone from the
admin page, I get a VERP invite and a nice Subject line:

   From: [EMAIL PROTECTED]
   To: [EMAIL PROTECTED]
   Subject: You have been invited to join the Info mailing list

Which is good. However, if I send mail to info-subscribe, I get a non-VERP
invite and an ugly Subject line (so sayeth the users):

  From: [EMAIL PROTECTED]
  To: [EMAIL PROTECTED]
  Subject: confirm 33921aa138c41a218e6f76b3b3d866fcb411e1f7

It appears that the VERP confirmations are only partially implemented,
but maybe I've missed something.

I was thinking of doing something like this in MailList.py
(be gentle - Python newbie):

def GetRequestEmail(self, cookie=''):
if (mm_cfg.VERP_CONFIRMATIONS == 'No') or (cookie == ''):
return self.getListAddress('request')
else:
return self.GetConfirmEmail(cookie)

and then replacing GetRequestEmail() calls with GetRequestEmail(cookie). 
In some places the call to GetRequestEmail() needs to be moved after
the cookie generation.

Before I go down that path, is there a simpler path, or am I going to
break something else by VERPing all of the GetRequestEmail() calls?

Thanks,

Gordon
--
 Gordon Rowell [EMAIL PROTECTED]  http://www.gormand.com.au
 Gormand Pty Ltd  PO Box 239 St Pauls NSW 2031 Australia

___
Mailman-Developers mailing list
[EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/mailman-developers
Unsubscribe: 
http://mail.python.org/mailman/options/mailman-developers/archive%40jab.org