Gnus development mailing list
 help / color / mirror / Atom feed
From: Dan Christensen <jdc+news@uwo.ca>
Cc: ding@gnus.org
Subject: Re: news to mail?
Date: Sun, 25 Nov 2001 19:49:42 -0500	[thread overview]
Message-ID: <877ksejqzd.fsf@uwo.ca> (raw)
In-Reply-To: <m3adxacyy6.fsf@wolfram.com> (Bill White's message of "Sun, 25 Nov 2001 15:39:29 -0600")

[-- Attachment #1: Type: text/plain, Size: 1676 bytes --]

Bill White <billw@wolfram.com> writes:

> Is it possible to have my employer's news server (some standard-issue
> thing, I suppose) to automatically send to me via email all new
> articles it receives in certain groups?
>
> I'm working from home and it's painfully slow to read news via
> modem.  If there's some way to get those messages by email I'd, well,
> I'd spend lots more time in Gnus :-)

I use the program "suck" and the attached script.  Comments welcome.

Almost a year ago, I wrote the following (updated a bit).  I still
think it'd be a great feature to have.

Wouldn't it be nice if you could specify a newsgroup and a news server
as a mail-source?  The articles would be downloaded from the news
server and stored in whatever mail backend you use.  Why not just read
the group via the nntp backend?  Well, doing it with a mail backend
would let you:

- filter the articles into groups in various ways, not just based
  on the newsgroup they came from
- edit articles [annotations, deleting attachments, reparenting, etc]
- move relevant mail messages you receive into the same group
  as the news message that started a private conversation
- supplement a flakey newsfeed by reading from two news servers
  and deleting duplicates
- not worry about articles expiring on the server for groups you
  read sporadically
- have no serious problems if you change news servers
  (keeping marks, read articles, cached articles, etc)
- download articles in the early morning, for less load on the
  news server and faster reading of news.

I'm imagining using this for low volume groups.  I read several low
volume groups for which the above features would be great.


[-- Attachment #2: suckmail script --]
[-- Type: text/plain, Size: 2399 bytes --]

#!/bin/sh
#
# Download new articles from the groups listed in $SUCKDIR/sucknewsrc
# and append them to $OUTPUTFILE in mbox format.

# My wishlist for suck:
# - generate mbox format (should be trivial to do!)
# - pipe each message to an external command (could then use formail and/or
#   procmail)
# Other similar programs:  news2mail, newsgate, pyg

PORT=119

BASEDIR=/home/jdc

OUTPUTFILE=$BASEDIR/Mail/suck
SUCKDIR=$BASEDIR/suck
DOWNLOADDIR=$SUCKDIR/download
LOG=$SUCKDIR/suck.log
# global lockfile.  Suck seems to create ./suck.lock
# while it is running.  But just to be safe, we'll put a global
# lock around this script so that we won't be running formail
# while another copy of this script has launched suck again and
# is changing DOWNLOADDIR.
LOCK=$SUCKDIR/suckmail.lock

SILENT="no"
if [ "$1" = "-q" ]
then
  shift
  SILENT="yes"
fi

# We cd to /home/jdc/suck so that the suck.lock file is always
# in the same place.
cd $SUCKDIR

if ! lockfile -r0 $LOCK
then
  echo "$NAME: unable to lock $LOCK."
  echo "Nothing downloaded."
  exit 1
fi

# -m: put output, one article per file, in the dir specified by -dm
# -c: update the sucknewsrc, located in dir specified by -dm, when done
# -q: quiet (doesn't work!)
[ -e ${LOG}.1 ] && mv -f ${LOG}.1 ${LOG}.2
[ -e ${LOG}   ] && mv -f ${LOG}   ${LOG}.1
suck news -N $PORT -m -c -dm $DOWNLOADDIR -dd $SUCKDIR > $SUCKDIR/suck.log 2>&1 
RET=$?
if [ $RET == 1 ]  # No articles downloaded
then
  rm -f $LOCK
  exit 0
elif [ $RET != 0 ]
then
  rm -f $LOCK
  echo "Error $RET returned by suck."
  exit 3
fi

if ! lockfile -r0 ${OUTPUTFILE}.lock
then
  echo "$NAME: unable to lock ${OUTPUTFILE}.lock."
  echo "Articles downloaded to ${DOWNLOADDIR}, but not moved to ${OUTPUTFILE}."
  exit 2
fi

for file in $DOWNLOADDIR/*; do
  # Add a "From " line.
  # This uses current time;  the '-a Date:' option uses the time in the
  # Date: header, but this isn't in the right format.
  formail < $file
done >> $OUTPUTFILE
rm -f ${OUTPUTFILE}.lock

rm $DOWNLOADDIR/*
rm -f $LOCK

[ "$SILENT" == "no" ] &&
[ -s $OUTPUTFILE ] && 
echo "suck: `frm $OUTPUTFILE | wc -l`m `cat $OUTPUTFILE | wc -c`b."

# If you don't get suck to put one message per file, then it produces
# one big file with articles separated by a single line containing ".".
# Sending this through "sed -e 's/^.$//'" and then adding the -ds options
# to formail works, but would also split digests.

[-- Attachment #3: Type: text/plain, Size: 37 bytes --]


-- 
Dan Christensen
jdc+news@uwo.ca

  parent reply	other threads:[~2001-11-26  0:49 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-25 21:39 Bill White
2001-11-25 21:51 ` Robin S. Socha
2001-11-25 22:21   ` Bill White
2001-11-25 23:10 ` Daniel Pittman
2001-11-26  0:49 ` Dan Christensen [this message]
2001-11-26  4:18   ` Harry Putnam
2001-11-27  2:54   ` Bill White
2001-11-27  2:59     ` Harry Putnam
2001-11-27  3:28       ` Bill White

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877ksejqzd.fsf@uwo.ca \
    --to=jdc+news@uwo.ca \
    --cc=ding@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).