~mdw
/
newsgate
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
inject: Ditch preline.
[newsgate]
/
bin
/
inject
diff --git
a/bin/inject
b/bin/inject
index
3d7c65d
..
f6e360b
100755
(executable)
--- a/
bin/inject
+++ b/
bin/inject
@@
-7,6
+7,7
@@
import socket as S
from getopt import getopt, GetoptError
from sys import stdin, stdout, stderr, argv, exit
from cStringIO import StringIO
from getopt import getopt, GetoptError
from sys import stdin, stdout, stderr, argv, exit
from cStringIO import StringIO
+env = OS.environ
prog = argv[0]
prog = argv[0]
@@
-51,13
+52,16
@@
except:
host = 'localhost'
dist = 'mail'
path = 'newsgate'
host = 'localhost'
dist = 'mail'
path = 'newsgate'
+sender = env.get('SENDER')
+recip = env.get('RECIPIENT')
group = None
def opts():
group = None
def opts():
- global approved, remote, host, dist, path, group
+ global approved, remote, host, dist, path, group
, sender, recip
try:
try:
- opts, args = getopt(argv[1:], 'a:d:h:r:p:',
+ opts, args = getopt(argv[1:], 'a:d:h:r:p:
S:R:
',
['approved=', 'distribution=',
['approved=', 'distribution=',
+ 'sender=', 'recipient=',
'hostname=', 'remote=', 'path='])
except GetoptError:
usage()
'hostname=', 'remote=', 'path='])
except GetoptError:
usage()
@@
-70,6
+74,10
@@
def opts():
host = a
elif o in ('-r', '--remote'):
remote = (lambda addr, port = 119: (addr, int(port)))(*a.split(':'))
host = a
elif o in ('-r', '--remote'):
remote = (lambda addr, port = 119: (addr, int(port)))(*a.split(':'))
+ elif o in ('-R', '--recipient'):
+ recip = a
+ elif o in ('-S', '--sender'):
+ sender = a
if len(args) != 1:
usage()
group, = args
if len(args) != 1:
usage()
group, = args
@@
-106,6
+114,8
@@
def send():
'Newsgroups: %s\r\n'
% group)
if approved: hdr.write('Approved: %s\r\n' % approved)
'Newsgroups: %s\r\n'
% group)
if approved: hdr.write('Approved: %s\r\n' % approved)
+ if sender: hdr.write('Return-Path: <%s>\r\n' % sender)
+ if recip: hdr.write('Delivered-To: %s\r\n' % recip)
xify = {}
for h in '''
lines xref newsgroups path distribution approved received
xify = {}
for h in '''
lines xref newsgroups path distribution approved received