Update of /cvsroot/cvs-syncmail/syncmail
In directory usw-pr-cvs1:/tmp/cvs-serv19163
Modified Files:
syncmail
Log Message:
Added -R/--reply-to option, and extended blast_mail() accordingly.
Index: syncmail
===================================================================
RCS file: /cvsroot/cvs-syncmail/syncmail/syncmail,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -d -r1.21 -r1.22
--- syncmail 19 Sep 2002 19:30:15 -0000 1.21
+++ syncmail 7 Nov 2002 15:02:10 -0000 1.22
@@ -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.'
|