File: Smartlist.pm

package info (click to toggle)
libmail-listdetector-perl 1.03%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, squeeze, stretch, wheezy
  • size: 208 kB
  • ctags: 71
  • sloc: perl: 951; sh: 48; makefile: 2
file content (70 lines) | stat: -rw-r--r-- 1,573 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
package 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<undef>.

=head1 BUGS

No known bugs.

=head1 AUTHOR

Michael Stevens - michael@etla.org.

=cut