From 2c34527aaabd003509f1ea453225c6b4b6c1925e Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Fri, 15 Mar 2002 17:34:29 +0000 Subject: ProcessSubscribeCmd(): If the address isn't given in the command, try to dig the full name out of the From: header. --- Mailman/MailCommandHandler.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Mailman/MailCommandHandler.py b/Mailman/MailCommandHandler.py index 1e5572ea8..24c6fbef8 100644 --- a/Mailman/MailCommandHandler.py +++ b/Mailman/MailCommandHandler.py @@ -25,6 +25,7 @@ import sys import re import traceback import email.Iterators +import email.Utils from cStringIO import StringIO from Mailman import mm_cfg @@ -626,8 +627,9 @@ approval."""), trunc=0) def ProcessSubscribeCmd(self, args, cmd, mail): """Parse subscription request and send confirmation request.""" digest = self.digest_is_default - password = "" - address = "" + password = '' + address = '' + fullname = '' done_digest = 0 if not len(args): password = Utils.MakeRandomPassword() @@ -655,13 +657,18 @@ Usage: subscribe [password] [digest|nodigest] [address=]""")) if not password: password = Utils.MakeRandomPassword() if not address: - subscribe_address = Utils.LCDomain(mail.get_sender()) + sender = mail['from'] + if not sender: + sender = mail.get_sender() + fullname, addr = email.Utils.parseaddr(sender) + subscribe_address = Utils.LCDomain(addr) else: subscribe_address = address remote = mail.get_sender() try: # FIXME: extract fullname userdesc = UserDesc(address=subscribe_address, + fullname=fullname, password=password, digest=digest) self.AddMember(userdesc, remote) -- cgit v1.2.3-70-g09d2