+sub index_xapian { # msg_iter callback
+ my ($part, $depth, @idx) = @{$_[0]};
+ my ($self, $doc) = @{$_[1]};
+ my $ct = $part->content_type || 'text/plain';
+ my $fn = $part->filename;
+ if (defined $fn && $fn ne '') {
+ $self->index_text($fn, 1, 'XFN');
+ }
+
+ my ($s, undef) = msg_part_text($part, $ct);
+ defined $s or return;
+
+ my (@orig, @quot);
+ my @lines = split(/\n/, $s);
+ while (defined(my $l = shift @lines)) {
+ if ($l =~ /^>/) {
+ $self->index_body(\@orig, $doc) if @orig;
+ push @quot, $l;
+ } else {
+ $self->index_body(\@quot, 0) if @quot;
+ push @orig, $l;
+ }
+ }
+ $self->index_body(\@quot, 0) if @quot;
+ $self->index_body(\@orig, $doc) if @orig;
+}
+