From: Greg W. <gw...@py...> - 2002-10-29 19:28:51
|
Here's a patch to syncmail that adds a -R/--reply-to option, which makes syncmail add a "Reply-To" header to the email message. IMHO this is long overdue -- it makes perfect sense for replies to foo-checkins to be directed at foo-devel, and this is the obvious way to do it. Anyone object? Or shall I go ahead and check this in? --- syncmail 19 Sep 2002 19:30:15 -0000 1.21 +++ syncmail 29 Oct 2002 19:26:48 -0000 @@ -51,6 +51,10 @@ --subject-prefix=TEXT Prepend TEXT to the email subject line. + -R ADDR + --reply-to=ADDR + Add a "Reply-To: ADDR" header to the email message. + --quiet / -q Don't print as much status to stdout. @@ -215,7 +219,7 @@ -def blast_mail(subject, people, filestodiff, contextlines, fromhost): +def blast_mail(subject, people, filestodiff, contextlines, fromhost, replyto): # cannot wait for child process or that will cause parent to retain cvs # lock for too long. Urg! if not os.fork(): @@ -232,17 +236,15 @@ s = StringIO() sys.stdout = s try: - print '''\ -From: "%(name)s" <%(address)s> -To: %(people)s -Subject: %(subject)s -X-Mailer: Python syncmail %(version)s <http://sf.net/projects/cvs-syncmail> -''' % {'address' : address, - 'name' : name, - 'people' : string.join(people, COMMASPACE), - 'subject' : subject, - 'version' : __version__, - } + print 'From: "%s" <%s>' % (name, address) + print 'To: %s' % string.join(people, COMMASPACE) + print 'Subject: %s' % subject + if replyto: + print 'Reply-To: %s' % replyto + print ('X-Mailer: Python syncmail %s ' + '<http://sf.net/projects/cvs-syncmail>' + % __version__) + s.write(sys.stdin.read()) # append the diffs if available print @@ -260,8 +262,9 @@ def main(): try: opts, args = getopt.getopt( - sys.argv[1:], 'hC:cuS:qf:', - ['fromhost=', 'context=', 'cvsroot=', 'subject-prefix=', + sys.argv[1:], 'hC:cuS:R:qf:', + ['fromhost=', 'context=', 'cvsroot=', + 'subject-prefix=', 'reply-to=', 'help', 'quiet']) except getopt.error, msg: usage(1, msg) @@ -270,6 +273,7 @@ contextlines = 2 verbose = 1 subject_prefix = "" + replyto = None fromhost = None for opt, arg in opts: if opt in ('-h', '--help'): @@ -285,6 +289,8 @@ contextlines = 0 elif opt in ('-S', '--subject-prefix'): subject_prefix = arg + elif opt in ('-R', '--reply-to'): + replyto = arg elif opt in ('-q', '--quiet'): verbose = 0 elif opt in ('-f', '--fromhost'): @@ -326,7 +332,7 @@ if verbose: print 'Generating notification message...' - blast_mail(subject, people, specs[1:], contextlines, fromhost) + blast_mail(subject, people, specs[1:], contextlines, fromhost, replyto) if verbose: print 'Generating notification message... done.' -- Greg Ward <gw...@py...> http://www.gerg.ca/ Never put off till tomorrow what you can avoid all together. |