chiark
/
gitweb
/
~mdw
/
newsgate
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
4aef1dd
)
inject: Insert correct Lines header.
author
Mark Wooding
<mdw@distorted.org.uk>
Mon, 27 Mar 2006 14:11:24 +0000
(15:11 +0100)
committer
Mark Wooding
<mdw@distorted.org.uk>
Mon, 27 Mar 2006 14:11:24 +0000
(15:11 +0100)
bin/inject
patch
|
blob
|
blame
|
history
diff --git
a/bin/inject
b/bin/inject
index 62a75fd3d83114f9915fc49a6eacc909eb2e7615..6dbfdb3ac62ebc68269ff4b0c285b33c90b8323c 100755
(executable)
--- a/
bin/inject
+++ b/
bin/inject
@@
-100,6
+100,7
@@
class NNTP (object):
def send():
hdr = StringIO()
def send():
hdr = StringIO()
+ body = StringIO()
hdr.write('Path: newsgate\r\n'
'Distribution: mail\r\n'
'Newsgroups: %s\r\n'
hdr.write('Path: newsgate\r\n'
'Distribution: mail\r\n'
'Newsgroups: %s\r\n'
@@
-135,7
+136,6
@@
def send():
% (T.strftime('%a, %d %b %Y %H:%M:%S %Z')))
if 'subject' not in seen:
hdr.write('Subject: (no subject)\r\n')
% (T.strftime('%a, %d %b %Y %H:%M:%S %Z')))
if 'subject' not in seen:
hdr.write('Subject: (no subject)\r\n')
- hdr.write('\r\n')
msgid = seen['message-id']
if not rx_msgid.match(msgid):
msgid = seen['message-id']
if not rx_msgid.match(msgid):
@@
-145,7
+145,7
@@
def send():
nntp.cmd('IHAVE %s' % msgid)
rc, msg = nntp.reply()
if rc == '335':
nntp.cmd('IHAVE %s' % msgid)
rc, msg = nntp.reply()
if rc == '335':
- n
ntp.write(hdr.getvalue())
+ n
= 0
for i in stdin:
if i.startswith('.'):
i = '.' + i
for i in stdin:
if i.startswith('.'):
i = '.' + i
@@
-155,7
+155,12
@@
def send():
i = i[:-1] + '\r\n'
else:
i = i + '\r\n'
i = i[:-1] + '\r\n'
else:
i = i + '\r\n'
- nntp.write(i)
+ body.write(i)
+ n += 1
+ hdr.write('Lines: %d\r\n' % n)
+ hdr.write('\r\n')
+ nntp.write(hdr.getvalue())
+ nntp.write(body.getvalue())
nntp.write('.\r\n')
nntp.flush()
rc, msg = nntp.reply()
nntp.write('.\r\n')
nntp.flush()
rc, msg = nntp.reply()