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. |
From: <ba...@zo...> - 2002-10-29 19:57:32
|
>>>>> "GW" == Greg Ward <gw...@py...> writes: GW> Here's a patch to syncmail that adds a -R/--reply-to option, GW> which makes syncmail add a "Reply-To" header to the email GW> message. IMHO this is long overdue -- it makes perfect sense GW> for replies to foo-checkins to be directed at foo-devel, and GW> this is the obvious way to do it. GW> Anyone object? Or shall I go ahead and check this in? Except the patch also gets rid of the multiline string, which is a style I find more readable than multiple prints. +1 if you fix that <wink>. -Barry |
From: Greg W. <gw...@py...> - 2002-10-29 20:57:57
|
On 29 October 2002, Barry A. Warsaw said: > Except the patch also gets rid of the multiline string, which is a > style I find more readable than multiple prints. +1 if you fix that > <wink>. Damn, I was hoping I could subtly persuade you that, for cases where the string exceeds a certain threshold of variability, multiple prints work better. (In particular, I don't like redundant "Reply-To", so I want to suppress it if -R wasn't supplied -- IMHO that makes this string variable enough.) Second attempt at the patch (unlike the last attempt, I haven't tested this one): --- syncmail 19 Sep 2002 19:30:15 -0000 1.21 +++ syncmail 29 Oct 2002 20:56:26 -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,21 @@ s = StringIO() sys.stdout = s try: + vars = {'address' : address, + 'name' : name, + 'people' : string.join(people, COMMASPACE), + 'subject' : subject, + 'version' : __version__, + } print '''\ From: "%(name)s" <%(address)s> -To: %(people)s +To: %(people)s''' % vars + if replyto: + print 'Reply-To: %s' % replyto + print '''\ 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__, - } +''' % vars s.write(sys.stdin.read()) # append the diffs if available print @@ -260,8 +268,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 +279,7 @@ contextlines = 2 verbose = 1 subject_prefix = "" + replyto = None fromhost = None for opt, arg in opts: if opt in ('-h', '--help'): @@ -285,6 +295,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 +338,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/ I don't believe there really IS a GAS SHORTAGE.. I think it's all just a BIG HOAX on the part of the plastic sign salesmen -- to sell more numbers!! |
From: Greg W. <gw...@py...> - 2002-11-06 23:00:09
|
On 29 October 2002, I said: > Second attempt at the patch (unlike the last attempt, I haven't tested > this one): OK, I finally got around to actually testing my second attempt at the "add Reply-To" patch. It worked. Barry, can I check this in now? Greg -- Greg Ward <gw...@py...> http://www.gerg.ca/ God is omnipotent, omniscient, and omnibenevolent ---it says so right here on the label. |
From: <ba...@zo...> - 2002-11-07 13:40:48
|
>>>>> "GW" == Greg Ward <gw...@py...> writes: GW> On 29 October 2002, I said: >> Second attempt at the patch (unlike the last attempt, I haven't >> tested this one): GW> OK, I finally got around to actually testing my second attempt GW> at the "add Reply-To" patch. It worked. GW> Barry, can I check this in now? +1 -Barry |
From: Greg W. <gw...@py...> - 2002-11-07 15:05:09
|
On 07 November 2002, Barry A. Warsaw said: > GW> OK, I finally got around to actually testing my second attempt > GW> at the "add Reply-To" patch. It worked. > > GW> Barry, can I check this in now? > > +1 OK, my "reply-to" patch is checked in. Greg |