[Mailman-Developers] VERP subscription confirmations

Gordon Rowell gordonr at gormand.com.au
Fri Feb 13 23:29:07 EST 2004


On Thu, Feb 05, 2004 at 09:44:05PM -0500, Gordon Rowell <gordonr at gormand.com.au> 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()
+        msg['Subject'] = self.GetConfirmSubject(realname, cookie, 'join')
+        msg['Reply-To'] = self.GetRequestEmail(cookie)
         msg.send(self)
 
     def ApprovedChangeMemberAddress(self, oldaddr, newaddr, globally):
@@ -1220,18 +1225,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(
-            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)
 
 

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



More information about the Mailman-Developers mailing list