[Mailman-Users] news2mail gateway

Jim Tittsler jwt at dskk.co.jp
Thu Feb 3 06:17:44 CET 2000

On Wed, Feb 02, 2000 at 11:59:53PM +0100, Feczak Szabolcs wrote:
> I fired up everything (the inn news server and mailman) on the
> same machine, and I want to display news postings on the web.
> is also works quite well alone. But after created a news2mail
> group and set it up with te => Mail-News and News-Mail gateway
> option. The normal mail which is sent by a mail client is ok
> and goes to the archive, but the news somehow doesn't want to
> get displayed in this group. Even I set the news host to localhost

If the python nntplib is run on the same machine as the news server (or
actually, any machine that is an NNTP peer of the news server) you can have
this problem... since you really want a "reader" connection to the news
server rather than the default NNTP connection.

I suggested modifying the Python nntplib to add the 'mode reader' that most
(all?) news servers need in this case, wrapped in a try/except just in case
you find one that doesn't[1].  Harald Meland went on to suggest adding
another argument to NNTP.__init__ so that my change wouldn't break use of
nntplib as a feeder.  I've attached one such patch for nntplib.  You would
then need to add mode='reader' to the nntplib calls in cron/gate_news and
Mailman/GatewayManager.py (or Mailman/Handlers/ToUsenet.py in the CVS
version).  Or change the patch to default to 'mode reader'.


[1] The draft-ietf-nntpext says servers should accept it, although it may
not be required, and that the only 'mode' command is 'mode reader'.

Jim Tittsler, Tokyo  7J1AJH/AI8A
Python Starship     http://starship.python.org/crew/jwt/

-------------- next part --------------
--- /home/jwt/nntplib.py.orig	Sat Sep 18 09:16:08 1999
+++ nntplib.py	Sat Sep 18 11:39:00 1999
@@ -61,17 +61,24 @@
 	# Initialize an instance.  Arguments:
 	# - host: hostname to connect to
 	# - port: port to connect to (default the standard NNTP port)
+	# - mode: if not None (or user is specified), issue 'mode reader'
-	def __init__(self, host, port = NNTP_PORT, user=None, password=None):
+	def __init__(self, host, port = NNTP_PORT, user=None, password=None,
+                     mode=None):
 		self.host = host
 		self.port = port
 		self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
 		self.sock.connect(self.host, self.port)
 		self.file = self.sock.makefile('rb')
 		self.debugging = 0
 		self.welcome = self.getresp()
+		if user or mode:
+			try:
+				self.welcome = self.shortcmd('mode reader')
+			except:
+				pass
 		if user:
 			resp = self.shortcmd('authinfo user '+user)
 			if resp[:3] == '381':
 				if not password:
@@ -466,9 +473,9 @@
 # Minimal test function
 def _test():
-	s = NNTP('news')
+	s = NNTP('news', mode='reader')
 	resp, count, first, last, name = s.group('comp.lang.python')
 	print resp
 	print 'Group', name, 'has', count, 'articles, range', first, 'to', last
 	resp, subs = s.xhdr('subject', first + '-' + last)

More information about the Mailman-Users mailing list