summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfukachan <fukachan>2004-08-13 13:23:46 +0000
committerfukachan <fukachan>2004-08-13 13:23:46 +0000
commit5150d3e6ee7e529e789ad644db34cdb136f7d54a (patch)
tree7e1eb04703b378999830fbce0f93432eb559db6e
parent770470aa8b81a8d01eb1689bdb4cd9de8bf4b00e (diff)
downloadfml8-5150d3e6ee7e529e789ad644db34cdb136f7d54a.tar.gz
fml8-5150d3e6ee7e529e789ad644db34cdb136f7d54a.tar.bz2
fml8-5150d3e6ee7e529e789ad644db34cdb136f7d54a.zip
implement list_all(), last_modified_time().
remove get_class_list().
-rw-r--r--fml/lib/Mail/Delivery/Queue.pm68
1 files changed, 55 insertions, 13 deletions
diff --git a/fml/lib/Mail/Delivery/Queue.pm b/fml/lib/Mail/Delivery/Queue.pm
index 0b9afe7e..f454a0d0 100644
--- a/fml/lib/Mail/Delivery/Queue.pm
+++ b/fml/lib/Mail/Delivery/Queue.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: Queue.pm,v 1.40 2004/06/29 10:05:29 fukachan Exp $
+# $FML: Queue.pm,v 1.41 2004/08/13 11:50:49 fukachan Exp $
#
package Mail::Delivery::Queue;
@@ -230,6 +230,30 @@ sub list
}
+# Descriptions: return list of all queue irrespective of validity.
+# Arguments: OBJ($self)
+# Side Effects: none
+# Return Value: ARRAY_REF
+sub list_all
+{
+ my ($self) = @_;
+ my (@r) = ();
+ my (%r) = ();
+
+ for my $class (@class_list) {
+ my $ra = $self->list($class);
+ push(@r, @$ra);
+ }
+
+ for my $q (sort @r) {
+ $r{ $q } = 1;
+ }
+
+ @r = keys %r;
+ return \@r;
+}
+
+
=head1 METHODS TO MANIPULATE INFORMATION
=head2 getidinfo($id)
@@ -289,6 +313,36 @@ sub getidinfo
}
+# Descriptions: when last modified.
+# Arguments: OBJ($self) STR($id)
+# Side Effects: none
+# Return Value: NUM(oldest unix time)
+sub last_modified_time
+{
+ my ($self, $id) = @_;
+ my $min_mtime = time;
+
+ # queue id.
+ $id ||= $self->id();
+
+ use File::stat;
+ for my $class (@class_list) {
+ my $fp = sprintf("%s_file_path", $class);
+ my $file = $self->can($fp) ? $self->$fp($id) : undef;
+
+ if (-f $file) {
+ my $st = stat($file);
+ my $mtime = $st->mtime();
+
+ # find oldest file info.
+ $min_mtime = $min_mtime < $mtime ? $min_mtime : $mtime;
+ }
+ }
+
+ return $min_mtime;
+}
+
+
=head1 LOCK
=head2 lock()
@@ -619,18 +673,6 @@ sub is_valid_queue
}
-# Descriptions: return list of queue classes.
-# Arguments: OBJ($self)
-# Side Effects: none
-# Return Value: ARRAY_REF
-sub get_class_list
-{
- my ($self) = @_;
-
- return \@class_list;
-}
-
-
# Descriptions: clear this queue file.
# Arguments: OBJ($self)
# Side Effects: unlink this queue