summaryrefslogtreecommitdiff
path: root/fml/lib/Mail/ThreadTrack
diff options
context:
space:
mode:
authorfukachan <fukachan>2002-12-22 03:19:15 +0000
committerfukachan <fukachan>2002-12-22 03:19:15 +0000
commit22ed1722cc33d2ecb6de33a575a7a71531010ae0 (patch)
treee4b887fa9fde650b5b5111fbd41c927f9beaff5f /fml/lib/Mail/ThreadTrack
parent4387ec120c3e44bd704ada86ea3713f8d699b5d0 (diff)
downloadfml8-22ed1722cc33d2ecb6de33a575a7a71531010ae0.tar.gz
fml8-22ed1722cc33d2ecb6de33a575a7a71531010ae0.tar.bz2
fml8-22ed1722cc33d2ecb6de33a575a7a71531010ae0.zip
fix comments.
//o modify variable to be more readable: $h -> header
Diffstat (limited to 'fml/lib/Mail/ThreadTrack')
-rw-r--r--fml/lib/Mail/ThreadTrack/Print/Message.pm76
1 files changed, 41 insertions, 35 deletions
diff --git a/fml/lib/Mail/ThreadTrack/Print/Message.pm b/fml/lib/Mail/ThreadTrack/Print/Message.pm
index 8506faad..f93b6d2e 100644
--- a/fml/lib/Mail/ThreadTrack/Print/Message.pm
+++ b/fml/lib/Mail/ThreadTrack/Print/Message.pm
@@ -4,7 +4,7 @@
# All rights reserved. This program is free software; you can
# redistribute it and/or modify it under the same terms as Perl itself.
#
-# $FML: Message.pm,v 1.7 2002/09/11 23:18:30 fukachan Exp $
+# $FML: Message.pm,v 1.8 2002/09/22 14:57:07 fukachan Exp $
#
package Mail::ThreadTrack::Print::Message;
@@ -16,7 +16,7 @@ use Mail::ThreadTrack::Print::Utils qw(decode_mime_string STR2EUC);
=head1 NAME
-Mail::ThreadTrack::Print::Message - summarize et.al.
+Mail::ThreadTrack::Print::Message - summarize message et.al.
=head1 SYNOPSIS
@@ -35,7 +35,7 @@ make message summary for specified $file (article).
=cut
-# Descriptions: make message summary for specified $file (article)
+# Descriptions: make summary of the specified $file (article).
# Arguments: OBJ($self) STR($file)
# Side Effects: none
# Return Value: STR
@@ -54,44 +54,48 @@ sub message_summary
if (defined $fh) {
LINE:
while (<$fh>) {
- # nuke useless lines
- next LINE if /^\>/;
- next LINE if /^\-/;
+ # remove useless lines
+ next LINE if /^\>/o;
+ next LINE if /^\-/o;
- # header
- if (1 ../^$/) {
+ # header part
+ if (1 ../^$/o) {
push(@header, $_);
}
# body part
else {
- next LINE if /^\s*$/;
+ next LINE if /^\s*$/o;
- # ignore mail header like patterns
- next LINE if /^X-[-A-Za-z0-9]+:/i;
- next LINE if /^Return-[-A-Za-z0-9]+:/i;
- next LINE if /^Mime-[-A-Za-z0-9]+:/i;
- next LINE if /^Content-[-A-Za-z0-9]+:/i;
- next LINE if /^(To|From|Subject|Reply-To|Received):/i;
- next LINE if /^(Message-ID|Date):/i;
+ # ignore mail header like patterns.
+ next LINE if /^X-[-A-Za-z0-9]+:/io;
+ next LINE if /^Return-[-A-Za-z0-9]+:/io;
+ next LINE if /^Mime-[-A-Za-z0-9]+:/io;
+ next LINE if /^Content-[-A-Za-z0-9]+:/io;
+ next LINE if /^(To|From|Subject|Reply-To|Received):/io;
+ next LINE if /^(Message-ID|Date):/io;
# pick up effetive the first $line lines
- if (_valid_buf($_)) {
+ if (_is_valid_buf($_)) {
$line--;
$buf .= $padding. $_;
}
+
last LINE if $line < 0;
}
}
- close($fh);
+ $fh->close();
+
+ # XXX-TODO: WHO CARE FOR CSS ? return raw messages from here.
+ # XXX-TODO: care for non Japanese.
if (defined $self->{ _no_header_summary }) {
return STR2EUC( $buf );
}
else {
use Mail::Header;
- my $h = new Mail::Header \@header;
+ my $header = new Mail::Header \@header;
my $header_info = $self->header_summary({
- header => $h,
+ header => $header,
padding => $padding,
});
return STR2EUC( $header_info ."\n". $buf );
@@ -103,25 +107,25 @@ sub message_summary
}
-# Descriptions: str looks effective, not quotation et.al. ?
+# Descriptions: check if $str looks effective, not quotation et.al. ?
# Arguments: STR($str)
# Side Effects: none
# Return Value: 1 or 0
-sub _valid_buf
+sub _is_valid_buf
{
my ($str) = @_;
$str = STR2EUC( $str );
- if ($str =~ /^[\>\#\|\*\:\;\=]/) {
+ if ($str =~ /^[\>\#\|\*\:\;\=]/o) {
return 0;
}
- elsif ($str =~ /^in /) { # quotation ?
+ elsif ($str =~ /^in /o) { # quotation ?
return 0;
}
- elsif ($str =~ /\w+\@\w+/) { # mail address ?
+ elsif ($str =~ /\w+\@\w+/o) { # mail address ?
return 0;
}
- elsif ($str =~ /^\S+\>/) { # quotation ?
+ elsif ($str =~ /^\S+\>/o) { # quotation ?
return 0;
}
@@ -129,7 +133,7 @@ sub _valid_buf
}
-# Descriptions: remove subject tag like string in $str e.g. [elena 100]
+# Descriptions: remove subject tag like string in $str e.g. [elena 100].
# Arguments: STR($str)
# Side Effects: none
# Return Value: STR
@@ -138,6 +142,7 @@ sub _delete_subject_tag_like_string
my ($str) = @_;
if (defined $str) {
+ # XXX-TODO: hmm, method-ify Mail::Message::Utils ?
use Mail::Message::Utils;
return Mail::Message::Utils::remove_subject_tag_like_string($str);
}
@@ -147,7 +152,7 @@ sub _delete_subject_tag_like_string
}
-# Descriptions: make summary of header $args->{ header }
+# Descriptions: make summary of header $args->{ header }.
# Arguments: OBJ($self) HASH_REF($args)
# Side Effects: none
# Return Value: STR
@@ -159,6 +164,7 @@ sub header_summary
my $subject = $args->{ header }->get('subject');
my $padding = $args->{ padding } || ' ';
+ # XXX-TODO: care for non Japanese.
if (defined $subject) {
$subject = decode_mime_string($subject, { charset => 'euc-japan' });
$subject =~ s/\n/ /g;
@@ -167,11 +173,13 @@ sub header_summary
}
if (defined $from) {
- $from = $self->_who_of_address( $from );
- $from =~ s/\n/ /g;
- $from =~ s/[\s\n]*$//g;
+ $from = $self->_who_of_address( $from );
+ $from =~ s/\n/ /g;
+ $from =~ s/[\s\n]*$//g;
}
+ # XXX-TODO: WHO CARE FOR CSS ? return raw messages from here.
+ # XXX-TODO: care for non Japanese.
# return buffer
my $r = $padding. $date;
$r .= $padding. "$subject, $from\n";
@@ -194,6 +202,7 @@ sub _who_of_address
for my $addr (@addrs) {
if (defined( $addr->phrase() )) {
+ # XXX-TODO: care for non Japanese.
my $phrase = decode_mime_string( $addr->phrase(), {
charset => 'euc-japan',
});
@@ -206,6 +215,7 @@ sub _who_of_address
$user = $addr->user();
}
+ # XXX-TODO: hmm, CROSS SITE SCRIPTING may cause ?
if ($self->get_mode() eq 'html') {
return( $user ? "$user\@xxx.xxx.xxx.xxx" : $address );
}
@@ -219,10 +229,6 @@ sub _who_of_address
See C<http://www.fml.org/software/FNF/> on fml coding style guide.
-=head1 CODING STYLE
-
-See C<http://www.fml.org/software/FNF/> on fml coding style guide.
-
=head1 AUTHOR
Ken'ichi Fukamachi