all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Peter Lee <pete_lee@swbell.net>
Subject: Re: w3 under development or not?
Date: Fri, 14 Nov 2003 15:30:15 GMT	[thread overview]
Message-ID: <ullqjary1.fsf@swbell.net> (raw)
In-Reply-To: 87brrf2wsu.fsf@yahoo.co.uk

>>>> Shane  writes:

    Shane> I know this is slightly off-topic, but I have the same
    Shane> problem when I download my email under GNUs. It hangs for a
    Shane> long time while 50 of the latest "Microsoft Internet
    Shane> Security patches" or other crap are retrieved. During this
    Shane> wait, I would prefer to be working in a another Emacs
    Shane> window, but Emacs won't accept any input.

I was getting about 50-80 of those a day myself for a while... I wrote
a perl script to parse a .spam file containing one regex per line.  If
any of the regexes in the .spam file match the author or subject in
the mail on the server, it's deleted on the server.  I mainly just
focused on the service packs as they took so long to download.  I'm a
perl novice, so I'm sure this code could be reduced to about 10 lines
by someone that knows the language better.

Here's a snippet from my .spam:

critical.*update
critical.*upgrade
customer.*bulletin
public.*assistanc
internet.*system
security.*pack
security.*update
security.*patch
delivery.*system
microsoft

And the script (I called pop-spam.pl) I just call with no arg for
preview: 'perl pop-spam.pl', and 'perl pop-spam.pl delete' when I'm
certain of my regexes.


#!e:/perl/bin/perl
# 
use strict;
use Mail::POP3Client;

open SPAM, "<.spam"
    or die "Failed to open .spam: $!";

my ($parm) = @ARGV;

my @spam = <SPAM>;
chomp @spam;

my $pop = new Mail::POP3Client(USER      => "yourusername",               
                               PASSWORD  => "yourpasswd",            
                               HOST      => "your.pop3.server",
                               AUTH_MODE => 'PASS',
                               TIMEOUT   => 30,
                               LOCALADDR => undef,
                               DEBUG     => 0);

for (my $i = 1; $i <= $pop->Count(); $i++) 
    {
    my @lines = $pop->Head($i);
    my $subj;
    my $from;

    foreach my $ln (@lines)
        {
        if ($ln =~ /^From:/i)
            {
            $from = $ln;
            }
        elsif ($ln =~ /^Subject:/i)
            {
            $subj = $ln;
            }
        }
    
    my ($msg, $size) = split ' ', $pop->List($i);
    my $deleted = 0;

    print "($msg) $size bytes\n";
    print $from, "\n";
    print $subj, "\n";

    foreach my $s (@spam)
        {
        if ($from =~ /$s/i)
            {
            print "-DELETE FROM ($s)\n";
            if ($parm =~ /delete/i)
                {
                $pop->Delete( $i );
                $deleted = 1;
                }
            last;
            }
        elsif ($subj =~ /$s/i)
            {
            print "-DELETE SUBJECT ($s)\n";
            if ($parm =~ /delete/i)
                {
                $pop->Delete( $i );
                $deleted = 1;
                }
            last;
            }
        }
    
    if ($deleted == 0)
        {
        print "-OK\n";
        }

    print "\n";
    }

$pop->Close();
close SPAM;

  parent reply	other threads:[~2003-11-14 15:30 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.124.1068506807.2005.help-gnu-emacs@gnu.org>
2003-11-11 17:16 ` w3 under development or not? Björn Lindström
2003-11-11 22:50   ` Stefan Monnier
     [not found]     ` <bosoof$hru$1@news1.wdf.sap-ag.de>
2003-11-12 10:21       ` A. L. Meyers
2003-11-12 13:59       ` Stefan Monnier
2003-11-13 15:10   ` Friedrich Dominicus
2003-11-14  8:12   ` Shane
2003-11-14  9:19     ` Poppong mail (Re: w3 under development or not?) Gian Uberto Lauri
2003-11-14 10:23     ` OT spamfilter A. L. Meyers
2003-11-14 18:22       ` Harry Putnam
2003-11-14 20:07         ` A. L. Meyers
2003-11-14 19:01       ` Tim McNamara
2003-11-14 15:30     ` Peter Lee [this message]
2003-11-14 16:09       ` w3 under development or not? Ted Zlatanov
2003-11-14 17:40         ` Peter Lee
2003-11-14 18:43           ` Ted Zlatanov
2003-11-14 22:39             ` Peter Lee
2003-11-15  4:34               ` Juri Linkov
2003-11-15 13:31               ` Ted Zlatanov
2003-11-17 15:44               ` Alan Mackenzie
2003-11-14 18:21       ` Harry Putnam
2003-11-14 16:01     ` Gnus attachment downloading blocks other Emacs interaction (was: w3 under development or not?) Ted Zlatanov
2003-11-12 21:07 w3 under development or not? Joe Corneli
  -- strict thread matches above, loose matches on Subject: below --
2003-11-10 21:59 Joe Corneli

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=ullqjary1.fsf@swbell.net \
    --to=pete_lee@swbell.net \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.