def send():
hdr = StringIO()
+ body = StringIO()
hdr.write('Path: newsgate\r\n'
'Distribution: mail\r\n'
'Newsgroups: %s\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):
nntp.cmd('IHAVE %s' % msgid)
rc, msg = nntp.reply()
if rc == '335':
- nntp.write(hdr.getvalue())
+ n = 0
for i in stdin:
if i.startswith('.'):
i = '.' + i
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()