/[mws]/trunk/mbox2index.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk/mbox2index.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4 - (show annotations)
Tue May 4 15:47:14 2004 UTC (19 years, 11 months ago) by dpavlin
File MIME type: text/plain
File size: 1172 byte(s)
added CGI interface (slow), global configuration, templates

1 #!/usr/bin/perl -w
2
3 use MWS;
4 use Data::Dumper;
5
6 my $mws = MWS->new('global.conf');
7
8 my $debug = 1;
9
10 foreach my $mbox ($mws->{config}->Parameters('folders')) {
11 my $mbox_path = $mws->{config}->val('folders', $mbox);
12
13 print STDERR "working on $mbox [$mbox_path]\n" if ($debug);
14
15 my $folder = $mws->{mgr}->open($mbox_path, extract => 'LAZY');
16 foreach my $message ($folder->messages) {
17
18 my $id = $message->messageId;
19 print "## $id\n";
20
21 my $document = {
22 id => $id,
23 folder => $mbox,
24 };
25
26
27
28 foreach my $direction (qw(to from cc bcc)) {
29 foreach my $f ($message->$direction) {
30 print "$direction: ";
31 foreach my $part (qw(phrase address comment)) {
32 next if (! $f->$part);
33 print "[$part]",$f->$part," ";
34 $document->{$direction.'_'.$part} .= $f->$part."\n";
35 }
36 print "\n";
37 # push @{$document->$d.'_phrase'}, $f->phrase,
38 # push @{$document->$d.'_address'}, $f->address,
39 ## push @{$document->$d.'_comment'}, $f->comment,
40 }
41 }
42
43 $document->{'subject'} = $message->get('Subject') || 'no subject';
44
45 # print Dumper($document);
46 $mws->{index}->add("$mbox $id" => $document);
47
48 }
49
50 $folder->close;
51 }
52
53 $mws->{index}->optimize;

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26