[Mailman-Users] News to Mail gateway setup

Jerry Stratton jerry at sandiego.edu
Mon Mar 11 18:36:52 CET 2002


>I've got News to Mail gatewaying working, almost.  Currently, whenever
>someone posts to the news group, the post to the mailing list requires my
>approval.  Is there some way to automatically approve posts to the mailling
>list from the news group short of allowing anyone to post to the mailling
>list?  I only ask because the news group I'm gating is not public, and I
>assume the uni would like to keep it that way...

We needed the same thing, for pretty much the exact same setup. 
You'll need to change the source code to do this. It isn't that 
difficult, assuming that I've done this right:

In the "Handlers" directory of the "Mailman" directory, there is a 
file called "Hold.py". This is the script that determines whether or 
not a message needs to be held.

There is a section in there that says:

In it, there is a section that says:

     if mlist.member_posting_only:
         posters = Utils.List2Dict(map(string.lower, mlist.posters))
         if not mlist.IsMember(sender) and \
            not Utils.FindMatchingAddresses(sender, posters):
             # the sender is neither a member of the list, nor in the list of
             # explicitly approved posters
             hold_for_approval(mlist, msg, msgdata, NonMemberPost)
             # no return


Change this to:

     if mlist.member_posting_only:
         if mlist.gateway_to_mail:
             needgroup = mlist.linked_newsgroup
             newsgroup = msg.getheader('newsgroups')

         posters = Utils.List2Dict(map(string.lower, mlist.posters))
         if not mlist.IsMember(sender) and \
            not (mlist.gateway_to_mail and needgroup and 
newsgroup==needgroup) and \
            not Utils.FindMatchingAddresses(sender, posters):
             # the sender is neither a member of the list, nor in the list of
             # explicitly approved posters
             # nor is it from the gatewayed newsgroup
             hold_for_approval(mlist, msg, msgdata, NonMemberPost)
             # no return

Note that this still has some problems: if there is more than one 
newsgroup on the Newsgroups: line, the posting will still need 
approval (this could be considered a feature, of course). And the 
code does not check in a case-insensitive manner. I tried 
newsgroup=string.lower(msg.getheader('newsgroups')) and that 
generated errors in the error log for some reason. (I'm fairly new to 
python; this is, in fact, the first thing I've done in it.)

The above changes the code so that if the group's "gateway_to_mail" 
option is set, it checks to see if the message has a "Newsgroups:" 
header set to the same thing as the list's linked_newsgroup setting. 
If so, it lets the message through.

Jerry
-- 
jerry at sandiego.edu
http://www.sandiego.edu/~jerry/
Serra 188B/x8773
--
The more restrictions there are, the poorer the people become. The 
greater the government's power, the more chaotic the nation would 
become. The more the ruler imposes laws and prohibitions on his 
people, the more frequently evil deeds would occur.
--The Silence of the Wise: The Sayings of Lao Zi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/mailman-users/attachments/20020311/82968296/attachment.html 


More information about the Mailman-Users mailing list