summaryrefslogtreecommitdiff
path: root/fml/lib/Mail/ThreadTrack.pm
diff options
context:
space:
mode:
authorfukachan <fukachan>2001-11-09 11:28:41 +0000
committerfukachan <fukachan>2001-11-09 11:28:41 +0000
commitd70afc7a664bdba418a3bc1fe6c3b96834d85620 (patch)
tree1866a5e9dd0ef9803941aa19a6a39c525f4d6727 /fml/lib/Mail/ThreadTrack.pm
parentc8c9d60e344c33000fba46c5997120f659e09b8e (diff)
downloadfml8-d70afc7a664bdba418a3bc1fe6c3b96834d85620.tar.gz
fml8-d70afc7a664bdba418a3bc1fe6c3b96834d85620.tar.bz2
fml8-d70afc7a664bdba418a3bc1fe6c3b96834d85620.zip
move sorting function to Mail::ThreadTrack::Print::Sort
Diffstat (limited to 'fml/lib/Mail/ThreadTrack.pm')
-rwxr-xr-xfml/lib/Mail/ThreadTrack.pm69
1 files changed, 1 insertions, 68 deletions
diff --git a/fml/lib/Mail/ThreadTrack.pm b/fml/lib/Mail/ThreadTrack.pm
index 4edfa071..9d340c49 100755
--- a/fml/lib/Mail/ThreadTrack.pm
+++ b/fml/lib/Mail/ThreadTrack.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: ThreadTrack.pm,v 1.11 2001/11/07 04:05:25 fukachan Exp $
+# $FML: ThreadTrack.pm,v 1.12 2001/11/07 09:28:28 fukachan Exp $
#
package Mail::ThreadTrack;
@@ -248,73 +248,6 @@ sub list_up_thread_id
}
-=head2 sort($thread_id_list)
-
-=cut
-
-
-# Descriptions:
-# Arguments: $self $args
-# Side Effects:
-# Return Value: none
-sub sort
-{
- my ($self, $thread_id_list) = @_;
-
- # get age HASH TABLE
- my ($age, $cost) = $self->_calculate_age($thread_id_list);
- $self->{ _age } = $age;
- $self->{ _cost } = $cost;
-
- $self->_sort_thread_id($thread_id_list, $cost);
-}
-
-
-# Descriptions:
-# Arguments: $self $args
-# Side Effects:
-# Return Value: none
-sub _sort_thread_id
-{
- my ($self, $thread_id_list, $cost) = @_;
-
- @$thread_id_list = sort {
- $cost->{$b} cmp $cost->{$a};
- } @$thread_id_list;
-}
-
-
-# Descriptions:
-# Arguments: $self $args
-# Side Effects:
-# Return Value: none
-sub _calculate_age
-{
- my ($self, $thread_id_list) = @_;
- my (%age, %cost) = ();
- my $now = time; # save the current UTC for convenience
- my $rh = $self->{ _hash_table } || {};
- my $day = 24*3600;
-
- # $age hash referehence = { $thread_id => $age };
- my (@aid, $last, $age, $date, $status, $tid) = ();
- for $tid (sort @$thread_id_list) {
- # $last: get the latest one of article_id's
- (@aid) = split(/\s+/, $rh->{ _articles }->{ $tid });
- $last = $aid[ $#aid ] || 0;
-
- # how long this thread is not concerned ?
- $age = sprintf("%2.1f%s", ($now - $rh->{ _date }->{ $last })/$day);
- $age{ $tid } = $age;
-
- # evaluate cost hash table which is { $thread_id => $cost }
- $cost{ $tid } = $rh->{ _status }->{ $tid }.'-'. $age;
- }
-
- return (\%age, \%cost);
-}
-
-
=head2 set_mode($mode)
specify output format by $mode string.