mhonarc-users

Re: Mail-lists: MHonArc/glimpse/wilma: so what should I use for news?

1998-09-26 14:45:19
Solutions can vary depending on what kind of access you have to your
newserver.  If you are the administrator, you can probably have MHonArc
process the directories the news server stores articles in directly.
Many servers store articles in a directoy structure that mirrors
newsgroup name hierarchies.  For example, comp.lang.perl.misc would be
mapped to comp/lang/perl/misc with each article in a separate file.

I use a little perl script to send news messages as email, which in
turn could also probably be processed by MHonArc (haven't tried
it).  Also use procmail to do filtering of my messages on the news
server (let me expand on this)...

First case:  I get a newsfeed (only gardening newsgroups) to my servers at
mallorn.com, but I want to pull out all URLs that come from them.  I
also have some internal newsgroups that I *don't* want to filter on.  I
use this definition in my newsfeeds file (inn):

   # pull out all messages that have URLs in them.
   pinnclip\
      :*,!mallorn.*\
      :Tp\
      :/usr/local/bin/procmail -m /usr/spool/news/procmailrc.news
   
My procmailrc file looks like this:

   # should actually try using the MATCH variable instead of 
   #    sending the whole message, but that's for a later date...
   :0 B
   * ^.*\/http://.*\>
   { 
      # repost to the mailing list garden-urls
      :0:
      ! garden-urls(_at_)mallorn(_dot_)com

      # repost this to a mallorn newsgroup
      :0 c:
      |/usr/local/news/bin/repost mallorn.garden-urls
   }
   
Of course, if you don't want to do any fancy filtering (I also do
scoring, etc. in my procmailrc file), then you can just call a news2mail 
script directly from the newsfeeds file:

   rc\
      :!*,rec.gardens.*\
      :Tp\
      :/usr/local/bin/news2mail rec-gardens(_at_)mallorn(_dot_)com

And your news2mail script looks pretty simple:

   #!/usr/local/bin/perl
   open( STDOUT, "| /usr/lib/sendmail -t" ) || die "Mail fail : $!\n" ;
   $/ = "\n\n" ;
   $_ = <STDIN> ;
   ( $realGroup ) = ( $_ =~ /newsgroups: (.*)/i ) ;
   s/Message-ID: <innclip([^>]+)>/Message-ID: <$1>/gi;
   s/^To: /X-To: /gi;
   s/^CC: /X-CC: /gi;
   s/^BCC: /X-BCC: /gi;
 
   print "To: @ARGV\n" ;
   print ;
   print "[ News via Email, clipped from :$realGroup ]\n\n";

   print <STDIN> ;

I make no guarantees -- I set this up about 3 years ago when I didn't
know what I was doing :).  But it's been running ever since...  sendmail
adds the "From " line, so it should be parseable by MHonArc...

Chris