libmail-listdetector-perl-1.03+dfsg.orig/0000755000175000017500000000000011416630202017654 5ustar gregoagregoalibmail-listdetector-perl-1.03+dfsg.orig/Makefile.PL0000644000175000017500000000150611412650743021640 0ustar gregoagregoause ExtUtils::MakeMaker; # See lib/ExtUtils/MakeMaker.pm for details of how to influence # the contents of the Makefile that is written. WriteMakefile( 'NAME' => 'Mail::ListDetector', 'VERSION_FROM' => 'lib/Mail/ListDetector.pm', # finds $VERSION 'PREREQ_PM' => { 'Carp' => 0, 'Email::Abstract' => 3.001, 'Email::Valid' => 0.182, 'URI' => 1.10, 'Test::More' => 0.08, 'Mail::Internet' => 2.04, }, 'dist' => { 'COMPRESS' => 'gzip -9f', 'SUFFIX' => 'gz', }, 'AUTHOR' => 'Michael Stevens ', 'ABSTRACT' => 'Mailing list message detector', 'LICENSE' => 'perl', ); libmail-listdetector-perl-1.03+dfsg.orig/AUTHORS0000644000175000017500000000064011412650743020734 0ustar gregoagregoaThese people have written this module: Michael Stevens Andy Turner Adam Lazur Peter Oliver Matthew Walker Tatsuhiko Miyagawa johnnnnnn sthoenna Mik Firestone Simon Cozens libmail-listdetector-perl-1.03+dfsg.orig/BUGS0000644000175000017500000000013211412650743020343 0ustar gregoagregoaBugs: Yes, it's dodgy for really unusual email addresses used as list names and suchlike.libmail-listdetector-perl-1.03+dfsg.orig/TODO0000644000175000017500000000037111412650743020355 0ustar gregoagregoaThings to do: Write more mailing list modules Add extra List methods Definately owner list description subscribe unsubscribe comments extra_data Fill in all the blanks in the docs. More fully document the API for writing your own plugin. libmail-listdetector-perl-1.03+dfsg.orig/Changes0000644000175000017500000000415311412651273021161 0ustar gregoagregoaRevision history for Perl extension Mail::ListDetector. 0.01 Mon Jan 15 19:54:06 2001 - original version; created by h2xs 1.20 with options -X -n Mail::ListDetector 0.15 Thu Aug 09 20:00:00 2001 - support more lists, - bugfixes - use Test::More - Patches from Andy Turner 0.19 Wed Jan 02 20:59:19 2002 - assimilate Mail::ListDetector::Detector::Fml 0.21 Mon May 06 22:19:00 2002 - unassimilate Fml - Patch from Peter Oliver for list owner messages 0.22 Thu Jun 27 21:15:00 2002 - Cleanup documentation to fix rt.cpan.org ticket 62 - Finally assimilate Mail::ListDetector::Detector::Fml properly - Import into CVS 0.24 Sun Jul 06 2003 - I've lost the CVS repository, oh well, that's what CPAN's for. - Add recognition for some mailman lists with minimal headers. 0.25 Mon Jul 21 2003 - Add mention of mailing list to README file. - Integrate cleanup and new detector from Matthew Walker 0.28 26 Aug 2003 - Add Patch from Mik Firestone for Mailman on freebsd mailing lists ( and probably others). 0.29 13 Oct 2003 - Add patch from Matthew Walker for Communigate. 0.30 28 May 2004 - Add patch from Simon Cozens for use of Email::Abstract. 0.31 8 June 2004 - Add correction to previous patch from Simon Cozens. - Add the following from Matthew Walker: - tweak docs for Listbox - for RFC2369 List-Post has URI in <>'s but may have comments, now extract text from within <>'s to give to URI - Majordomo now recognises lists using domo as unix user not just majordomo - added new detectors for AutoShare, Google Groups, LetterRip, ListSTAR, Lyris and Onelist 1- added tests for all changes and additions 0.32 30 Oct 2005 - Add patch from Peter Oliver for some mailman lists 0.34 08 Apr 2006 - Add patch for bare debug issue reported by Chip Salzenberg 1.01 13 Mar 2007 - Increase CPANTS score. 1.02 14 Nov 2009 - Fix CPAN RT bug 35320 - add missing dependency - Add Test::Kwalitee to ensure we always have kwalitee. - Add github repo http://github.com/mstevens/Mail--ListDetector 1.03 30 Jun 2010 - Make license more explicit libmail-listdetector-perl-1.03+dfsg.orig/META.yml0000644000175000017500000000126511412651636021143 0ustar gregoagregoa--- #YAML:1.0 name: Mail-ListDetector version: 1.03 abstract: Mailing list message detector author: - Michael Stevens license: perl distribution_type: module configure_requires: ExtUtils::MakeMaker: 0 build_requires: ExtUtils::MakeMaker: 0 requires: Carp: 0 Email::Abstract: 3.001 Email::Valid: 0.182 Mail::Internet: 2.04 Test::More: 0.08 URI: 1.1 no_index: directory: - t - inc generated_by: ExtUtils::MakeMaker version 6.56 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 libmail-listdetector-perl-1.03+dfsg.orig/lib/0000755000175000017500000000000011412651635020433 5ustar gregoagregoalibmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/0000755000175000017500000000000011412651635021315 5ustar gregoagregoalibmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/0000755000175000017500000000000011412651635023722 5ustar gregoagregoalibmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/List.pm0000644000175000017500000000316411412650743025176 0ustar gregoagregoapackage Mail::ListDetector::List; use strict; sub new { my $proto = shift; my $data = shift; my $class = ref($proto) || $proto; my $self = {}; $self->{'data'} = $data; bless ($self, $class); return $self; } sub listname { my $self = shift; my $name = shift; $self->{'data'}->{'listname'} = $name if defined $name; return $self->{'data'}->{'listname'}; } sub posting_address { my $self = shift; my $posting_address = shift; $self->{'data'}->{'posting_address'} = $posting_address if defined $posting_address; return $self->{'data'}->{'posting_address'}; } sub listsoftware { my $self = shift; my $listsoftware = shift; $self->{'data'}->{'listsoftware'} = $listsoftware if defined $listsoftware; return $self->{'data'}->{'listsoftware'}; } 1; __END__ =pod =head1 NAME Mail::ListDetector::List - an object representing a mailing list =head1 SYNOPSIS use Mail::ListDetector::List; =head1 DESCRIPTION This object provides a representation of the information extracted about a mailing list. It should not be instantiated directly by anything outside the Mail::ListDetector package. =head1 METHODS =head2 new Creates a new List object. =head2 listname This method gets or sets the name of the mailing list. The name to set is an optional argument. =head2 posting_address This method gets or sets the posting address of the mailing list. The posting address to set is an optional argument. =head2 listsoftware This method gets or sets the mailing list software name. The name to set is an optional argument. =head1 BUGS No known bugs. =head1 AUTHOR Michael Stevens - michael@etla.org. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/0000755000175000017500000000000011412651635025473 5ustar gregoagregoalibmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/Fml.pm0000644000175000017500000000504711412650743026554 0ustar gregoagregoapackage Mail::ListDetector::Detector::Fml; use strict; use vars qw($VERSION); $VERSION = '0.04'; use base qw(Mail::ListDetector::Detector::Base); use URI; use Email::Valid; use Carp; sub DEBUG { 0 } sub match { my($self, $message) = @_; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::Fml - no message supplied") unless defined($message); my $mlserver = Email::Abstract->get_header($message, 'X-MLServer') or return; $mlserver =~ /^fml \[(fml [^\]]*)\]/ or return; # OK, this is FML message my $list = Mail::ListDetector::List->new; $list->listsoftware($1); my $post; if ($post = Email::Abstract->get_header($message, 'List-Post')) { chomp($post); $post = URI->new($post)->to; } elsif ($post = Email::Abstract->get_header($message, 'List-Subscribe')) { chomp($post); $post = URI->new($post)->to; $post =~ s/-ctl\@/\@/; } elsif ($post = Email::Abstract->get_header($message, 'X-ML-Info')) { chomp($post); $post =~ s/\n/ /; $post =~ m/(<.*>)/; $post = $1; $post = URI->new($post)->to; $post =~ s/-admin\@/\@/; } elsif ($post = Email::Abstract->get_header($message, 'Resent-To')) { chomp($post); $post =~ m/([\w\d\+\.\-]+@[\w\d\.\-]+)/; $post = $1; } if ($post && Email::Valid->address($post)) { $list->posting_address($post); } my $mlname; if ($mlname = Email::Abstract->get_header($message, 'X-ML-Name')) { chomp($mlname); $list->listname($mlname); } elsif ($mlname = $list->posting_address) { $mlname =~ s/\@.*$//; $list->listname($mlname); } $list; } 1; __END__ =head1 NAME Mail::ListDetector::Detector::Fml - FML message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::Fml; =head1 DESCRIPTION Mail::ListDetector::Detector::Fml is an implementation of a mailing list detector, for FML. See http://www.fml.org/ for details about FML. When used, this module installs itself to Mail::ListDetector. FML maling list message is RFC2369 compliant, so can be matched with RFC2369 detector, but this module allows you to parse more FML specific information about the mailing list. =head1 METHODS =over 4 =item new, match Inherited from L =back =head1 AUTHOR Tatsuhiko Miyagawa Emiyagawa@bulknews.netE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 SEE ALSO L =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/Yahoogroups.pm0000644000175000017500000000371211412650743030352 0ustar gregoagregoapackage Mail::ListDetector::Detector::Yahoogroups; use strict; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::Yahoogroups - no message supplied") unless defined($message); use Email::Abstract; my $mailing_list = Email::Abstract->get_header($message, 'Mailing-List'); chomp $mailing_list if defined $mailing_list; if ((!defined $mailing_list) or $mailing_list =~ /^\s*$/) { print "Returning undef - couldn't find Mailing-List header\n" if DEBUG; return undef; } print "Yahoo! Groups: $mailing_list\n" if DEBUG my $list; $list = new Mail::ListDetector::List; $list->listsoftware("Yahoo! Groups"); my $listname; my $posting_address; if ($mailing_list =~ /^\s*list\s+([^@\s]+)@((?:e|yahoo)groups\.(..|com));\s+contact\s+\1-owner@\2$/) { print "Mailing-List matches pattern\n" if DEBUG; $listname = $1; $posting_address = "$1\@$2"; print "Got listname $listname\n" if DEBUG; $list->listname($listname); print "Got posting address $posting_address\n" if DEBUG; $list->posting_address($posting_address); } else { print "Mailing-List doesn't match\n" if DEBUG; return undef; } print "Returning object $list\n" if DEBUG; return $list; } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::Yahoogroups - Yahoo! Groups message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::Yahoogroups; =head1 DESCRIPTION An implementation of a mailing list detector, for Yahoo! Groups. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a Yahoo! Groups mailing list, or C. =head1 BUGS No known bugs. =head1 AUTHOR Andrew Turner - turner@cpan.org =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/Smartlist.pm0000644000175000017500000000304511412650743030014 0ustar gregoagregoapackage Mail::ListDetector::Detector::Smartlist; use strict; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::Smartlist - no message supplied") unless defined($message); use Email::Abstract; my $mailing_list = Email::Abstract->get_header($message, 'X-Mailing-List'); return undef unless defined $mailing_list; chomp $mailing_list; my ($posting_address) = ( $mailing_list =~ /^\<(\S+?)\> archive\/latest\/\d+/ ); return undef unless defined $posting_address; return undef unless grep(/^$posting_address\s?$/, Email::Abstract->get_header($message, 'X-Loop')); my $list = new Mail::ListDetector::List; $list->listsoftware('smartlist'); $list->posting_address($posting_address); my ($listname) = ($posting_address =~ /^([^@]+)@/); $list->listname($listname); return $list; } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::Smartlist - Smartlist message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::Smartlist; =head1 DESCRIPTION An implementation of a mailing list detector, for smartlist. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a smartlist mailing list, or C. =head1 BUGS No known bugs. =head1 AUTHOR Michael Stevens - michael@etla.org. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/Ezmlm.pm0000644000175000017500000000412411412650743027115 0ustar gregoagregoapackage Mail::ListDetector::Detector::Ezmlm; use strict; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::Ezmlm - no message supplied") unless defined($message); use Email::Abstract; print "Getting mailing list header\n" if DEBUG; my $mailing_list = Email::Abstract->get_header($message, 'Mailing-List'); return undef unless defined $mailing_list; print "Got header, and isn't null\n" if DEBUG; chomp $mailing_list; print "Mailing-List is [$mailing_list]\n" if DEBUG; my ($help, $listsoftware); print "Matching for information\n" if DEBUG; ($help, $listsoftware) = ($mailing_list =~ /^contact (\S+?)\; run by (\w+)$/); print "Help was [$help], listsoftware was [$listsoftware]\n" if DEBUG; if ((defined $listsoftware) and ($listsoftware eq 'ezmlm')) { print "List software matched\n" if DEBUG; my $list = new Mail::ListDetector::List; print "Set listsoftware = [$listsoftware]\n" if DEBUG; $list->listsoftware($listsoftware); my $posting = $help; $posting =~ s/-help\@/\@/; DEBUG && print "posting is [$posting]\n"; $list->posting_address($posting); # FIXME: dodgy for unusual addresses. my ($listname) = ($posting =~ /^([^@]+)@/); $list->listname($listname); print "Returning list object\n" if DEBUG; return $list; } else { print "Didn't match, returning\n" if DEBUG; return undef; } } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::Ezmlm - Ezmlm message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::Ezmlm; =head1 DESCRIPTION An implementation of a mailing list detector, for ezmlm. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to an ezmlm mailing list, or C. =head1 BUGS No known bugs. =head1 AUTHOR Michael Stevens - michael@etla.org. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/RFC2919.pm0000644000175000017500000000324611412650743026774 0ustar gregoagregoapackage Mail::ListDetector::Detector::RFC2919; use strict; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Mail::ListDetector::Detector::RFC2369; use URI; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::RFC2919 - no message supplied") unless defined($message); use Email::Abstract; my $list_id = Email::Abstract->get_header($message, 'List-ID'); return undef unless defined($list_id); $list_id =~ m/<(.+)>/ or return undef; my $listname = $1; my $rfc2369 = new Mail::ListDetector::Detector::RFC2369; my $list = ( $rfc2369->match($message) or new Mail::ListDetector::List ); $list->listsoftware('RFC2919'); $list->listname($listname); return $list; } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::RFC2919 - RFC2919 message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::RFC2919; =head1 DESCRIPTION An implementation of a mailing list detector, for RFC2919 compliant mailing lists, i.e., those with List-ID lines in the header. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a RFC2919 compliant mailing list, or C. Since RFC2919 only specifies a (mostly) unique ID for a mailing list, Mail::ListDetector::Detector::RFC2369 is used to attempt to extract further information about the list. =head1 BUGS No known bugs. =head1 AUTHOR Michael Stevens - michael@etla.org, Peter Oliver - p.d.oliver@mavit.freeserve.co.uk. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/Majordomo.pm0000644000175000017500000000563711412650743027772 0ustar gregoagregoapackage Mail::ListDetector::Detector::Majordomo; use strict; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Email::Valid; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::Majordomo - no message supplied") unless defined($message); use Email::Abstract; my $sender = Email::Abstract->get_header($message, 'Sender'); print "Got sender\n" if DEBUG; return unless defined $sender; print "Sender was defined\n" if DEBUG; chomp $sender; print "Sender is [$sender]\n" if DEBUG; my ($list) = ($sender =~ /^owner-(\S+)$/); if (!(defined $list)) { print "Sender didn't match owner-, trying -owner\n" if DEBUG; if ($sender =~ /^(\S+?)-owner/) { print "Sender matched -owner, removing\n" if DEBUG; $list = $sender; $list =~ s/-owner@/@/; } else { print "Sender didn't match second owner form\n" if DEBUG; return undef; } } return unless defined $list; chomp $list; print "Got list [$list]\n" if DEBUG; if ($list =~ m/(majordomo?|domo)\@/) { return undef; } return unless Email::Valid->address($list); print "List is valid email\n" if DEBUG; my $mv; # Some versions of Majordomo provide a version number unless ($mv = Email::Abstract->get_header($message, 'X-Majordomo-Version')) { # If we don't have a version number check the received headers. my (@received) = Email::Abstract->get_header($message, 'Received'); my $majordom = 0; foreach my $received_line (@received) { if ($received_line =~ /(majordomo?|domo)\@/) { $majordom++; last; } } print "Received check returned [$majordom]\n" if DEBUG; return unless $majordom; } print "On list\n" if DEBUG; my $l = new Mail::ListDetector::List; if ($mv) { $l->listsoftware("majordomo $mv"); } else { $l->listsoftware('majordomo'); } $l->posting_address($list); print "Set listsoftware 'majordomo', posting address [$list]\n" if DEBUG; my ($listname) = ($list =~ /^([^@]+)@/); print "Listname is [$listname]\n" if DEBUG; $l->listname($listname); return $l; } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::Majordomo - Majordomo message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::Majordomo; =head1 DESCRIPTION An implementation of a mailing list detector, for majordomo. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a majordomo mailing list, or C. =head1 BUGS =over 4 =item * This module needs to guess a little about whether a message is a post to a majordomo mailing list, as majordomo puts so little information in the message headers. =back =head1 AUTHOR Michael Stevens - michael@etla.org. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/Onelist.pm0000644000175000017500000000410111412650743027441 0ustar gregoagregoapackage Mail::ListDetector::Detector::Onelist; use strict; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::Onelist - no message supplied") unless defined($message); use Email::Abstract; my $mailing_list = Email::Abstract->get_header($message, 'Mailing-List'); chomp $mailing_list if defined $mailing_list; if ((!defined $mailing_list) or $mailing_list =~ /^\s*$/) { print "Returning undef - couldn't find Mailing-List header\n" if DEBUG; return undef; } print "ONElist: $mailing_list\n" if DEBUG my $list; $list = new Mail::ListDetector::List; $list->listsoftware("ONElist"); my $listname; my $posting_address; if ($mailing_list =~ /^\s*list\s+([^@\s]+)@(onelist\.(..|com));\s+contact\s+\1-owner@\2$/) { print "Mailing-List matches pattern\n" if DEBUG; $listname = $1; $posting_address = "$1\@$2"; print "Got listname $listname\n" if DEBUG; $list->listname($listname); print "Got posting address $posting_address\n" if DEBUG; $list->posting_address($posting_address); } else { print "Mailing-List doesn't match\n" if DEBUG; return undef; } print "Returning object $list\n" if DEBUG; return $list; } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::Onelist - ONElist message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::Onelist; =head1 DESCRIPTION An implementation of a mailing list detector, for ONElist mailing lists. ONElist was eaten by eGroups which became Yahoo! Groups so this detector is really only useful for historical mail. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a ONElist mailing list, or C. =head1 BUGS No known bugs. =head1 AUTHOR Andrew Turner - turner@cpan.org Matthew Walker - matthew@walker.wattle.id.au =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/Listserv.pm0000644000175000017500000000437011412650743027647 0ustar gregoagregoapackage Mail::ListDetector::Detector::Listserv; use strict; use vars qw($VERSION); $VERSION = '0.01'; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::Listserv - no message supplied") unless defined($message); use Email::Abstract; my ($posting_address, $list_name, $list_software); my @received = Email::Abstract->get_header($message, 'Received'); foreach my $received (@received) { # $received =~ s/\n/ /; if($received =~ m/\(LISTSERV-TCP\/IP\s+release\s+([^\s]+)\)/s) { $list_software = "LISTSERV-TCP/IP release $1"; my $sender = Email::Abstract->get_header($message, 'Sender'); if($sender =~ m/^(.*) <(.+)>$/) { $list_name = $1; $posting_address = $2; } last; } } unless (defined $list_software) { return undef; } my $list = new Mail::ListDetector::List; if(defined $list_name) { $list->listname($list_name); } else { $list->listname($posting_address); } $list->listsoftware($list_software); $list->posting_address($posting_address); return $list; } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::Listserv - Listserv message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::Listserv; =head1 DESCRIPTION An implementation of a mailing list detector, for LISTSERV(R) mailing lists, LISTSERV(R) is commercial email list management software, see for details. There is very little to go on to detect a LISTSERV(R) message, this detector needs to be called close to last. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a Listserv mailing list, or C. =head1 BUGS No known bugs. =head1 NOTES =head1 AUTHOR Matthew Walker - matthew@walker.wattle.id.au, Michael Stevens - michael@etla.org, Peter Oliver - p.d.oliver@mavit.freeserve.co.uk. Tatsuhiko Miyagawa Emiyagawa@bulknews.netE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/GoogleGroups.pm0000644000175000017500000000410411412650743030443 0ustar gregoagregoapackage Mail::ListDetector::Detector::GoogleGroups; use strict; use vars qw($VERSION); $VERSION = '0.01'; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Mail::ListDetector::Detector::RFC2919; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::GoogleGroups - no message supplied") unless defined($message); use Email::Abstract; my $x_google_loop = Email::Abstract->get_header($message, 'X-Google-Loop'); if (defined($x_google_loop)) { my $rfc2919 = new Mail::ListDetector::Detector::RFC2919; my $list = $rfc2919->match($message); unless (defined ($list)) { return undef; } $list->listsoftware ('Google Groups'); my $listname = $list->listname; $listname =~ s/\.googlegroups\.com$//; $list->listname ($listname); return $list; } else { return undef; } } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::GoogleGroups - Google Groups message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::GoogleGroups; =head1 DESCRIPTION An implementation of a mailing list detector, for Google Groups mailing lists, See http://groups-beta.google.com for information about Google Groups Google Groups mailing list messages are RFC2919 compliant but this module provides more information. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a Google Groups mailing list, or C. Mail::ListDetector::Detector::RFC2919 is used to extract the information about the list, we just munge it so we know it is a Google Groups list. =head1 BUGS No known bugs. =head1 AUTHOR Matthew Walker - matthew@walker.wattle.id.au, Michael Stevens - michael@etla.org, Peter Oliver - p.d.oliver@mavit.freeserve.co.uk. Tatsuhiko Miyagawa Emiyagawa@bulknews.netE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/AutoShare.pm0000644000175000017500000000467511412650743027737 0ustar gregoagregoapackage Mail::ListDetector::Detector::AutoShare; use strict; use vars qw($VERSION); $VERSION = '0.01'; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Mail::ListDetector::Detector::RFC2919; use Mail::ListDetector::Detector::RFC2369; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::AutoShare - no message supplied") unless defined($message); use Email::Abstract; my $list_software = Email::Abstract->get_header($message, 'List-Software'); if (defined($list_software) && ($list_software =~ m/(AutoShare [\w\.]+)/)) { $list_software = $1; my $list_post = Email::Abstract->get_header($message, 'List-Post'); return undef unless defined($list_post); $list_post =~ m/<(.+)>/ or return undef; my $posting_address = $1; my $rfc2919 = new Mail::ListDetector::Detector::RFC2919; my $rfc2369 = new Mail::ListDetector::Detector::RFC2369; my $list = ( $rfc2919->match($message) or $rfc2369->match($message) ); $list->listsoftware($list_software); return $list; } else { return undef; } } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::AutoShare - AutoShare message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::AutoShare; =head1 DESCRIPTION An implementation of a mailing list detector, for AutoShare mailing lists, AutoShare is a freeware Macintosh list server by Mikael Hansen, see http://home.comcast.net/~autoshare/autoshare/ for details about AutoShare. Some AutoShare mailing list messages are RFC2919 compliant and all are RFC2369 compliant but this module provides more information. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a AutoShare mailing list, or C. Since later version of AutoShare specifies a (mostly) unique ID for a mailing list in the format of RFC2919, Mail::ListDetector::Detector::RFC2919 is used to attempt to extract this information about the list. =head1 BUGS No known bugs. =head1 AUTHOR Matthew Walker - matthew@walker.wattle.id.au, Michael Stevens - michael@etla.org, Peter Oliver - p.d.oliver@mavit.freeserve.co.uk. Tatsuhiko Miyagawa Emiyagawa@bulknews.netE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/Listar.pm0000644000175000017500000000475711412650743027303 0ustar gregoagregoapackage Mail::ListDetector::Detector::Listar; use strict; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Email::Valid; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::Listar - no message supplied") unless defined($message); use Email::Abstract; my @senders = Email::Abstract->get_header($message, 'Sender'); my $list; foreach my $sender (@senders) { chomp $sender; ($list) = ($sender =~ /^owner-(\S+)$/); if (!(defined $list)) { print "Sender didn't match owner-, trying -owner\n" if DEBUG; if ($sender =~ /^(\S+?)-owner/) { print "Sender matched -owner, removing\n" if DEBUG; $list = $sender; $list =~ s/-owner@/@/; } else { print "Sender didn't match second owner form\n" if DEBUG; if ($sender =~ /^(\S+?)-bounce/) { print "Sender matched -bounce, removing\n" if DEBUG; $list = $sender; $list =~ s/-bounce@/@/; } else { print "Sender didn't match bounce form\n" if DEBUG; } } } last if defined $list; } return unless defined $list; chomp $list; print "Got list [$list]\n" if DEBUG; return unless Email::Valid->address($list); print "List is valid email\n" if DEBUG; # get listar version my $lv = Email::Abstract->get_header($message, 'X-listar-version'); return undef unless defined $lv; chomp $lv; my $listname = Email::Abstract->get_header($message, 'X-list'); return undef unless defined $listname; chomp $listname; my $l = new Mail::ListDetector::List; $l->listsoftware($lv); $l->posting_address($list); $l->listname($listname); return $l; } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::Listar - Listar message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::Listar; =head1 DESCRIPTION An implementation of a mailing list detector, for Listar. Listar can be configured for rfc2369 compliance, however often this is not done. If an Listar list is configured to be rfc2369 compliant then it will be recognized by that detector instead. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a listar mailing list, or C. =head1 BUGS None known. =head1 AUTHOR Michael Stevens - michael@etla.org. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/Lyris.pm0000644000175000017500000000577711412650743027152 0ustar gregoagregoapackage Mail::ListDetector::Detector::Lyris; use strict; use vars qw($VERSION); $VERSION = '0.01'; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Mail::ListDetector::Detector::RFC2369; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::Lyris - no message supplied") unless defined($message); use Email::Abstract; my $x_listserver = Email::Abstract->get_header($message, 'X-Listserver'); my $x_list_software = Email::Abstract->get_header($message, 'X-List-Software'); my $list_software = Email::Abstract->get_header($message, 'List-Software'); my $x_lyris_message_id = Email::Abstract->get_header($message, 'X-Lyris-Message-Id'); my $message_id = Email::Abstract->get_header($message, 'Message-Id'); my $listsoftware; if (defined($x_listserver) && ($x_listserver =~ m/(Lyris v[\w\.]+)/)) { $listsoftware = $1; } elsif (defined($list_software) && ($list_software =~ m/Lyris Server version ([\w\.]+)/)) { $listsoftware = "Lyris $1"; } elsif (defined($x_list_software) && ($x_list_software =~ m/Lyris v([\w\.]+)/)) { $listsoftware = "Lyris $1"; } elsif (defined($x_lyris_message_id) && ($x_lyris_message_id =~ m/^get_header($message, 'List-Unsubscribe'); print $list_unsubscribe if DEBUG; if (defined($list_unsubscribe)) { if ($list_unsubscribe =~ m//) { $listname = $2; $posting_address = "$listname\@$3"; } elsif ($list_unsubscribe =~ m//) { $listname = $2; $posting_address = "$listname\@$3"; } else { return undef; } } else { return undef; } my $list = new Mail::ListDetector::List; $list->listname($listname); $list->posting_address($posting_address); $list->listsoftware($listsoftware); return $list; } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::Lyris - Lyris message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::Lyris; =head1 DESCRIPTION An implementation of a mailing list detector, for Lyris mailing lists, Lyris is a ???? by MCF Software, see http://www.liststar.com/ for details about Lyris. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a Lyris mailing list, or C. =head1 BUGS No known bugs. =head1 AUTHOR Matthew Walker - matthew@walker.wattle.id.au, Michael Stevens - michael@etla.org, Peter Oliver - p.d.oliver@mavit.freeserve.co.uk. Tatsuhiko Miyagawa Emiyagawa@bulknews.netE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/CommuniGate.pm0000644000175000017500000000373011412650743030243 0ustar gregoagregoapackage Mail::ListDetector::Detector::CommuniGate; use strict; use vars qw($VERSION); use Email::Abstract; $VERSION = '0.01'; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::CommuniGate - no message supplied") unless defined($message); my $x_listserver = Email::Abstract->get_header($message, 'X-Listserver'); if (defined($x_listserver) && ($x_listserver =~ m/CommuniGate List/)) { chomp $x_listserver; my $sender = Email::Abstract->get_header($message, 'Sender'); return undef unless defined($sender); $sender =~ m/([^\s]+@[^\s]+)\s+\((.*)\)/ or return undef; my $posting_address = $1; my $listname = $2; my $list = new Mail::ListDetector::List; $list->listsoftware($x_listserver); $list->posting_address($posting_address); $list->listname($listname); return $list; } else { return undef; } } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::CommuniGate - CommuniGate message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::CommuniGate; =head1 DESCRIPTION An implementation of a mailing list detector, for CommuniGate mailing lists, CommuniGate is a legacy MacOS messaging application, see http://www.stalker.com/mac/default.html for details about CommuniGate. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a CommuniGate mailing list, or C. =head1 BUGS No known bugs. =head1 AUTHOR Matthew Walker - matthew@walker.wattle.id.au, Michael Stevens - michael@etla.org, Peter Oliver - p.d.oliver@mavit.freeserve.co.uk. Tatsuhiko Miyagawa Emiyagawa@bulknews.netE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/Base.pm0000644000175000017500000000160611412650743026705 0ustar gregoagregoapackage Mail::ListDetector::Detector::Base; use strict; sub new { my $proto = shift; my $data = shift; my $class = ref($proto) || $proto; my $self = {}; $self->{'data'} = $data; bless ($self, $class); return $self; } sub match { die "This method must be implemented by a subclass\n"; } 1; __END__ =head1 NAME Mail::ListDetector::Detector::Base - base class for mailing list detectors =head1 SYNOPSIS use Mail::ListDetector::Detector::Base; =head1 DESCRIPTION Abstract base class for mailing list detectors, should not be instantiated directly. =head1 METHODS =head2 new() Provides a simple constructor for the class. Accepts an optional data argument and stores that argument in the object if it is supplied. =head2 match() This just dies, and should be implemented in any subclass. =head1 BUGS No known bugs. =head1 AUTHOR Michael Stevens - michael@etla.org. libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/RFC2369.pm0000644000175000017500000000340711412650743026772 0ustar gregoagregoapackage Mail::ListDetector::Detector::RFC2369; use strict; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use URI; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::RFC2369 - no message supplied") unless defined($message); use Email::Abstract; my $posting_uri = Email::Abstract->get_header($message, 'List-Post'); return undef unless defined($posting_uri); chomp $posting_uri; return undef unless $posting_uri =~ m/(<.*>)/; my $posting_u = new URI($1); return undef unless defined $posting_u; if ($posting_u->scheme ne 'mailto') { return undef; } my $posting_email = $posting_u->to; my $software = 'RFC2369'; my ($listname) = ($posting_email =~ /^([^@]+)@/); my $list = new Mail::ListDetector::List; $list->listsoftware($software); $list->posting_address($posting_email); $list->listname($listname); return $list; } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::RFC2369 - RFC2369 message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::RFC2369; =head1 DESCRIPTION An implementation of a mailing list detector, for RFC2369 compliant mailing lists. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a RFC2369 compliant mailing list, or C. The RFC2369 standard does not REQUIRE all the information we wish to extract to be present - therefore this module may not be able to return full information for all RFC2369 compliant lists. =head1 BUGS No known bugs. =head1 AUTHOR Michael Stevens - michael@etla.org. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/Listbox.pm0000644000175000017500000000510511412650743027455 0ustar gregoagregoapackage Mail::ListDetector::Detector::Listbox; use strict; use vars qw($VERSION); $VERSION = '0.02'; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::Listbox - no message supplied") unless defined($message); use Email::Abstract; my $posting_address; my $list_software = Email::Abstract->get_header($message, 'List-Software'); my $list_id = Email::Abstract->get_header($message, 'List-Id'); if(defined($list_software) && ($list_software =~ m/listbox.com v/)) { unless (defined($list_id) && ($list_id =~ m/<([^\@]+\@[^\@]+)>/)) { return undef; } $posting_address = $1; chomp($list_software); } elsif(defined($list_id) && ($list_id =~ m/<([^\@]+\@v2.listbox.com)>/)) { $posting_address = $1; $list_software = 'listbox.com v2.0'; } else { return undef; } my $list = new Mail::ListDetector::List; $list->listname($posting_address); $list->listsoftware($list_software); $list->posting_address($posting_address); return $list; } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::Listbox - Listbox message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::Listbox; =head1 DESCRIPTION An implementation of a mailing list detector, for Listbox mailing lists, Listbox is a commercial list hosting service, see http://www.listbox.com/ for details about Listbox. Listbox mailing list messages look like RFC2919 messages to the current RFC2919 detector (although they are not compliant) but this module provides more information and does not test for their full compliance (like a future RFC2919 module might). For this reason this module must be installed before the RFC2919 module. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a Listbox mailing list, or C. =head1 BUGS No known bugs. =head1 NOTES Thanks to Mark Overmeer for asking and Meng Weng Wong for adding the List-Software header to Listbox mails to make this detector more robust. =head1 AUTHOR Matthew Walker - matthew@walker.wattle.id.au, Michael Stevens - michael@etla.org, Peter Oliver - p.d.oliver@mavit.freeserve.co.uk. Tatsuhiko Miyagawa Emiyagawa@bulknews.netE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/LetterRip.pm0000644000175000017500000000370611412650743027750 0ustar gregoagregoapackage Mail::ListDetector::Detector::LetterRip; use strict; use vars qw($VERSION); $VERSION = '0.01'; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::LetterRip - no message supplied") unless defined($message); use Email::Abstract; my $posting_address; my $list_software = Email::Abstract->get_header($message, 'List-Software'); if(defined($list_software) && ($list_software =~ m/(LetterRip (Pro ){0,1}[\w\.]+)/)) { $list_software = $1; } else { return undef; } return undef unless my $sender = Email::Abstract->get_header($message, 'Sender'); chomp $sender; $sender =~ s/<(.*)>/$1/; my $list = new Mail::ListDetector::List; $list->listname($sender); $list->listsoftware($list_software); $list->posting_address($sender); return $list; } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::LetterRip - LetterRip message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::LetterRip; =head1 DESCRIPTION An implementation of a mailing list detector, for LetterRip and LetterRip Pro mailing lists, LetterRip is a commercial mailing list manager from LetterRip Software, see http://www.letterrip.com/ for details about LetterRip. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a LetterRip mailing list, or C. =head1 BUGS No known bugs. =head1 NOTES =head1 AUTHOR Matthew Walker - matthew@walker.wattle.id.au, Michael Stevens - michael@etla.org, Peter Oliver - p.d.oliver@mavit.freeserve.co.uk. Tatsuhiko Miyagawa Emiyagawa@bulknews.netE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/Mailman.pm0000644000175000017500000000600311412650743027405 0ustar gregoagregoapackage Mail::ListDetector::Detector::Mailman; use strict; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::Mailman - no message supplied") unless defined($message); use Email::Abstract; my $version = Email::Abstract->get_header($message, 'X-Mailman-Version'); chomp $version if defined $version; if ((!defined $version) or $version =~ /^\s*$/) { print "Returning undef - couldn't find mailman version - $version\n" if DEBUG; return undef; } print "Mailman version $version\n" if DEBUG my $list; $list = new Mail::ListDetector::List; $list->listsoftware("GNU Mailman version $version"); my $sender = Email::Abstract->get_header($message, 'Sender'); print "Sender is $sender\n" if DEBUG && defined $sender; # return undef unless defined $sender; my $poss_posting_address; if (defined $sender) { chomp $sender; if ($sender =~ /^(([^@]+)-(admin|owner|bounces)(?:\+[^@]+)?\@(\S+))$/) { print "sender matches pattern\n" if DEBUG; $list->listname($2); print "Listname is $2\n" if DEBUG; $poss_posting_address = $2 . '@' . $4; print "Possible posting address is $poss_posting_address\n" if DEBUG; } elsif ($sender =~ /^((admin|owner)-([^@]+)\@(\S+))$/) { $list->listname($3); $poss_posting_address = $3 . '@' . $4; print "Listname is $3\n" if DEBUG; print "Possible posting address is $poss_posting_address\n" if DEBUG; } } else { # fallback way to guess posting address and list name. my $beenthere = Email::Abstract->get_header($message, 'X-BeenThere'); return undef unless defined $beenthere; print "X-BeenThere is $beenthere\n" if DEBUG; $poss_posting_address = $beenthere; chomp $poss_posting_address; if ($beenthere =~ /^([^@]+)\@/) { $list->listname($1); } } my $posting_address; my $list_post = Email::Abstract->get_header($message, 'List-Post'); if (defined $list_post) { print "Got list post $list_post\n" if DEBUG; if ($list_post =~ /^\]*)\>$/) { $posting_address = $1; print "Got posting address $posting_address\n" if DEBUG; $list->posting_address($posting_address); } } else { print "Got posting address $poss_posting_address\n" if DEBUG; $list->posting_address($poss_posting_address); } print "Returning object $list\n" if DEBUG; return $list; } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::Mailman - Mailman message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::Mailman; =head1 DESCRIPTION An implementation of a mailing list detector, for GNU Mailman. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a Mailman mailing list, or C. =head1 BUGS No known bugs. =head1 AUTHOR Michael Stevens - michael@etla.org. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/Ecartis.pm0000644000175000017500000000477211412650743027434 0ustar gregoagregoapackage Mail::ListDetector::Detector::Ecartis; use strict; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Email::Valid; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::Ecartis - no message supplied") unless defined($message); use Email::Abstract; my @senders = Email::Abstract->get_header($message, 'Sender'); my $list; foreach my $sender (@senders) { chomp $sender; ($list) = ($sender =~ /^owner-(\S+)$/); if (!(defined $list)) { print "Sender didn't match owner-, trying -owner\n" if DEBUG; if ($sender =~ /^(\S+?)-owner/) { print "Sender matched -owner, removing\n" if DEBUG; $list = $sender; $list =~ s/-owner@/@/; } else { print "Sender didn't match second owner form\n" if DEBUG; if ($sender =~ /^(\S+?)-bounce/) { print "Sender matched -bounce, removing\n" if DEBUG; $list = $sender; $list =~ s/-bounce@/@/; } else { print "Sender didn't match bounce form\n" if DEBUG; } } } last if defined $list; } return unless defined $list; chomp $list; print "Got list [$list]\n" if DEBUG; return unless Email::Valid->address($list); print "List is valid email\n" if DEBUG; # get Ecartis version my $lv = Email::Abstract->get_header($message, 'X-Ecartis-Version'); return undef unless defined $lv; chomp $lv; my $listname = Email::Abstract->get_header($message, 'X-List'); return undef unless defined $listname; chomp $listname; my $l = new Mail::ListDetector::List; $l->listsoftware($lv); $l->posting_address($list); $l->listname($listname); return $l; } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::Ecartis - Ecartis message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::Ecartis; =head1 DESCRIPTION An implementation of a mailing list detector, for Ecartis. Ecartis can be configured for rfc2369 compliance, however often this is not done. If an Ecartis list is configured to be rfc2369 compliant then it will be recognized by that detector instead. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a Ecartis mailing list, or C. =head1 BUGS None known. =head1 AUTHOR Michael Stevens - michael@etla.org. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/CommuniGatePro.pm0000644000175000017500000000444411412650743030727 0ustar gregoagregoapackage Mail::ListDetector::Detector::CommuniGatePro; use strict; use vars qw($VERSION); $VERSION = '0.02'; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Mail::ListDetector::Detector::RFC2919; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::CommuniGatePro - no message supplied") unless defined($message); use Email::Abstract; my $x_listserver = Email::Abstract->get_header($message, 'X-Listserver'); if (defined($x_listserver) && ($x_listserver =~ m/CommuniGate Pro LIST/)) { chomp $x_listserver; my $sender = Email::Abstract->get_header($message, 'Sender'); return undef unless defined($sender); $sender =~ m/<(.+)>/ or return undef; my $posting_address = $1; my $rfc2919 = new Mail::ListDetector::Detector::RFC2919; my $list = ( $rfc2919->match($message) or new Mail::ListDetector::List ); $list->listsoftware($x_listserver); $list->posting_address($posting_address); return $list; } else { return undef; } } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::CommuniGatePro - CommuniGate Pro message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::CommuniGatePro; =head1 DESCRIPTION An implementation of a mailing list detector, for CommuniGate Pro mailing lists, See http://www.stalker.com/ for details about CommuniGate Pro. CommuniGate Pro mailing list messages are RFC2919 compliant but this module provides more information. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a CommuniGate Pro mailing list, or C. Since CommuniGate Pro specifies a (mostly) unique ID for a mailing list in the format of RFC2919, Mail::ListDetector::Detector::RFC2919 is used to attempt to extract this information about the list. =head1 BUGS No known bugs. =head1 AUTHOR Matthew Walker - matthew@walker.wattle.id.au, Michael Stevens - michael@etla.org, Peter Oliver - p.d.oliver@mavit.freeserve.co.uk. Tatsuhiko Miyagawa Emiyagawa@bulknews.netE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector/Detector/ListSTAR.pm0000644000175000017500000000572711412650743027450 0ustar gregoagregoapackage Mail::ListDetector::Detector::ListSTAR; use strict; use vars qw($VERSION); $VERSION = '0.01'; use base qw(Mail::ListDetector::Detector::Base); use Mail::ListDetector::List; use Mail::ListDetector::Detector::RFC2369; use Carp; sub DEBUG { 0 } sub match { my $self = shift; my $message = shift; print "Got message $message\n" if DEBUG; carp ("Mail::ListDetector::Detector::ListSTAR - no message supplied") unless defined($message); use Email::Abstract; my $x_listserver = Email::Abstract->get_header($message, 'X-Listserver'); my $x_list_software = Email::Abstract->get_header($message, 'X-List-Software'); my $list_software = Email::Abstract->get_header($message, 'List-Software'); my $listsoftware; if (defined($x_listserver) && ($x_listserver =~ m/(ListSTAR v[\w\.]+)/)) { $listsoftware = $1; } elsif (defined($list_software) && ($list_software =~ m/(ListSTAR v[\w\.]+)/)) { $listsoftware = $1; } elsif (defined($x_list_software) && ($x_list_software =~ m/(ListSTAR v[\w\.]+)/)) { $listsoftware = $1; } else { return undef; } my $listname; my $sender = Email::Abstract->get_header($message, 'Sender'); if (defined($sender) && ($sender =~ m/<(.*)@.*>/)) { $listname = $1; } my $rfc2369 = new Mail::ListDetector::Detector::RFC2369 my $list; unless ($list = $rfc2369->match($message)) { my $x_list_subscribe = Email::Abstract->get_header($message, 'X-List-Subscribe'); return undef unless defined($x_list_subscribe); chomp $x_list_subscribe; return undef unless $x_list_subscribe =~ m/(<.*>)/; my $list_uri = new URI($1); return undef unless defined $list_uri; if ($list_uri->scheme ne 'mailto') { return undef; } my $posting_address = $list_uri->to; my $listname; if($posting_address =~ m/^(.*)@.*$/) { $listname = $1; } $list = new Mail::ListDetector::List; $list->listname($listname); $list->posting_address($posting_address); } if (defined($listname)) { $list->listname($listname); } $list->listsoftware($listsoftware); return $list; } 1; __END__ =pod =head1 NAME Mail::ListDetector::Detector::ListSTAR - ListSTAR message detector =head1 SYNOPSIS use Mail::ListDetector::Detector::ListSTAR; =head1 DESCRIPTION An implementation of a mailing list detector, for ListSTAR mailing lists, ListSTAR (not to be confused with Listar) is a MacOS mailing list publishing tool by MCF Software, see http://www.liststar.com/ for details about ListSTAR. =head1 METHODS =head2 new() Inherited from Mail::ListDetector::Detector::Base. =head2 match() Accepts a Mail::Internet object and returns either a Mail::ListDetector::List object if it is a post to a ListSTAR mailing list, or C. =head1 BUGS No known bugs. =head1 AUTHOR Matthew Walker - matthew@walker.wattle.id.au, Michael Stevens - michael@etla.org, Peter Oliver - p.d.oliver@mavit.freeserve.co.uk. Tatsuhiko Miyagawa Emiyagawa@bulknews.netE This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =cut libmail-listdetector-perl-1.03+dfsg.orig/lib/Mail/ListDetector.pm0000644000175000017500000001077711412651247024273 0ustar gregoagregoapackage Mail::ListDetector; use strict; use Carp qw(carp croak); require Exporter; use AutoLoader qw(AUTOLOAD); use vars qw(@ISA %EXPORT_TAGS @EXPORT_OK @EXPORT $VERSION); use vars qw(@DETECTORS); @ISA = qw(Exporter); # Items to export into callers namespace by default. Note: do not export # names by default without a very good reason. Use EXPORT_OK instead. # Do not simply export all your public functions/methods/constants. # This allows declaration use Mail::ListDetector ':all'; # If you do not need this, moving things directly into @EXPORT or @EXPORT_OK # will save memory. %EXPORT_TAGS = ( 'all' => [ qw( ) ] ); @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); @EXPORT = qw( ); $VERSION = '1.03'; my @default_detectors = qw(Mailman Ezmlm Smartlist Listar Ecartis Yahoogroups CommuniGatePro GoogleGroups Listbox AutoShare RFC2919 Fml ListSTAR RFC2369 CommuniGate LetterRip Lyris Onelist Majordomo Listserv); foreach (@default_detectors) { s/^/Mail::ListDetector::Detector::/; Mail::ListDetector->register_plugin($_); } # package subs sub new { my $proto = shift; my $message = shift; carp("Mail::ListDetector:: no message supplied\n") unless defined($message); my $class = ref($proto) || $proto; # get message # for all detectors, instantiate and pass until one returns # an object my $list; foreach my $detector_name (@DETECTORS) { my $detector; $detector = eval "new $detector_name"; if ($@) { die $@; } if ($list = $detector->match($message)) { return $list; } } return undef; } # load a plugin module sub register_plugin { my $self = shift; my $plugin_name = shift; eval "require $plugin_name; ${plugin_name}->import;"; croak("register_plugin couldn't load $plugin_name: $@") if $@; push @DETECTORS, $plugin_name; } 1; __END__ =head1 NAME Mail::ListDetector - Perl extension for detecting mailing list messages =head1 SYNOPSIS use Mail::ListDetector; =head1 DESCRIPTION This module analyzes mail objects in any of the classes handled by L. It returns a Mail::ListDetector::List object representing the mailing list. The RFC2369 mailing list detector is also capable of matching some Mailman and Ezmlm messages. It is deliberately checked last to allow the more specific Mailman and Ezmlm parsing to happen first, and more accurately identify the type of mailing list involved. =head1 METHODS =head2 new This method is the core of the module. Pass it a mail object, it will either return a Mail::ListDetector::List object that describes the mailing list that the message was posted to, or C if it appears not to have been a mailing list post. =head2 register_plugin($plugin_name) Registers a new plugin module that might recognise lists. Should be a subclass of Mail::ListDetector::Detector::Base, and provide the same interface as the other detector modules. You can eval arbitrary perl code with this, so don't do that if that's not what you want. =head1 EMAILS USED This module includes a number of sample emails from various mailing lists. In all cases, mails are used with permission of the author, and must not be distributed separately from this archive. If you believe I may have accidentally used your email or content without permission, contact me, and if this turns out to be the case I will immediately remove it from the latest version of the archive. =head1 BUGS =over 4 =item * A lot of the code applies fairly simple regular expressions to email address to extract information. This may fall over for really weird email addresses, but I'm hoping no-one will use those for names of mailing lists. =item * The majordomo and smartlist recognisers don't have much to go on, and therefore are probably not as reliable as the other detectors. This is liable to be hard to fix. =item * Forwarding messages (for example using procmail) can sometimes break the C header information needed to recognise some list types. =back =head1 AUTHORS =over 4 =item * Michael Stevens - michael@etla.org. =item * Andy Turner - turner@mikomi.org. =item * Adam Lazur - adam@lazur.org. =item * Peter Oliver - p.d.oliver@mavit.freeserve.co.uk =item * Matthew Walker - matthew@walker.wattle.id.au =item * Tatsuhiko Miyagawa - miyagawa@bulknews.net =item * johnnnnnn - john@phaedrusdeinus.org =item * Mik Firestone - mik@racerx.homedns.org =item * Simon Cozens - simon@simon-cozens.org =back =head1 SEE ALSO perl(1). The Mail::Audit::List module, which is a convenient way of using Mail::Audit and Mail::ListDetector together. =cut libmail-listdetector-perl-1.03+dfsg.orig/examples/0000755000175000017500000000000011412651635021503 5ustar gregoagregoalibmail-listdetector-perl-1.03+dfsg.orig/examples/sample.pl0000644000175000017500000000062711412650743023325 0ustar gregoagregoa#!/usr/bin/perl -w use strict; use Mail::Internet; use Mail::ListDetector; my $message = Mail::Internet->new(\*STDIN); my $list = Mail::ListDetector->new($message); if (defined($list)) { print "List software: ", $list->listsoftware, "\n"; print "List posting address: ", $list->posting_address, "\n"; print "list name: ", $list->listname, "\n"; } else { print "No object returned\n"; } exit 0; libmail-listdetector-perl-1.03+dfsg.orig/README0000644000175000017500000000211711412651221020535 0ustar gregoagregoaMail::ListDetector ------------------ This module can be installed as standard for a CPAN module: perl Makefile.PL make make test make install It provides the ability to examine Mail::Internet objects to determine if they were posted to a mailing list, and if so, which mailing list. See examples/sample.pl for how to use the module. The documentation is as yet very poor, and this module should be considered to still have alpha status - I may change functionality or the API at any time, and it may not actually DO anything for you. Or it might delete all your files. This module is licensed under the same terms as perl itself. It is free software; you can redistribute it and/or modify it under the terms of either: a) the GNU General Public License as published by the Free Software Foundation; either version 1, or (at your option) any later version: http://www.gnu.org/licenses/gpl.html or b) the "Artistic License" : http://dev.perl.org/licenses/artistic.html Created github repo for the code at http://github.com/mstevens/Mail--ListDetector Michael Stevens michael@etla.org libmail-listdetector-perl-1.03+dfsg.orig/MANIFEST0000644000175000017500000000202511416630202021004 0ustar gregoagregoalib/Mail/ListDetector/Detector/RFC2369.pm lib/Mail/ListDetector/Detector/Fml.pm lib/Mail/ListDetector/Detector/CommuniGatePro.pm lib/Mail/ListDetector/Detector/Smartlist.pm lib/Mail/ListDetector/Detector/Ecartis.pm lib/Mail/ListDetector/Detector/Listar.pm lib/Mail/ListDetector/Detector/Listserv.pm lib/Mail/ListDetector/Detector/Majordomo.pm lib/Mail/ListDetector/Detector/RFC2919.pm lib/Mail/ListDetector/Detector/Ezmlm.pm lib/Mail/ListDetector/Detector/Base.pm lib/Mail/ListDetector/Detector/Yahoogroups.pm lib/Mail/ListDetector/Detector/Mailman.pm lib/Mail/ListDetector/Detector/Listbox.pm lib/Mail/ListDetector/Detector/CommuniGate.pm lib/Mail/ListDetector/Detector/AutoShare.pm lib/Mail/ListDetector/Detector/GoogleGroups.pm lib/Mail/ListDetector/Detector/LetterRip.pm lib/Mail/ListDetector/Detector/ListSTAR.pm lib/Mail/ListDetector/Detector/Lyris.pm lib/Mail/ListDetector/Detector/Onelist.pm lib/Mail/ListDetector/List.pm lib/Mail/ListDetector.pm Changes MANIFEST TODO META.yml examples/sample.pl BUGS AUTHORS README LICENSE Makefile.PL libmail-listdetector-perl-1.03+dfsg.orig/LICENSE0000644000175000017500000000010011412650743020660 0ustar gregoagregoaThis module is distributed under the same terms as perl itself.