summaryrefslogtreecommitdiff
path: root/fml
diff options
context:
space:
mode:
authorfukachan <fukachan>2005-08-31 03:47:47 +0000
committerfukachan <fukachan>2005-08-31 03:47:47 +0000
commit23105209cdb62d4c7bdfe6d96fe3b3a7e3d84d53 (patch)
tree34df02826754ed5f3d81a59a875152a697dd211e /fml
parent49289c6aadb16a56ef0e02023b966751884e6470 (diff)
downloadfml8-23105209cdb62d4c7bdfe6d96fe3b3a7e3d84d53.tar.gz
fml8-23105209cdb62d4c7bdfe6d96fe3b3a7e3d84d53.tar.bz2
fml8-23105209cdb62d4c7bdfe6d96fe3b3a7e3d84d53.zip
implement find_head_key().
add() updates article_summary database, too.
Diffstat (limited to 'fml')
-rw-r--r--fml/lib/Mail/Message/DB.pm32
1 files changed, 30 insertions, 2 deletions
diff --git a/fml/lib/Mail/Message/DB.pm b/fml/lib/Mail/Message/DB.pm
index e24264cf..e4e2a0d6 100644
--- a/fml/lib/Mail/Message/DB.pm
+++ b/fml/lib/Mail/Message/DB.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: DB.pm,v 1.25 2005/08/25 13:15:31 fukachan Exp $
+# $FML: DB.pm,v 1.26 2005/08/27 14:47:00 fukachan Exp $
#
package Mail::Message::DB;
@@ -21,7 +21,7 @@ use vars qw(@ISA @EXPORT @EXPORT_OK $AUTOLOAD
use Carp;
use File::Spec;
-my $version = q$FML: DB.pm,v 1.25 2005/08/25 13:15:31 fukachan Exp $;
+my $version = q$FML: DB.pm,v 1.26 2005/08/27 14:47:00 fukachan Exp $;
if ($version =~ /,v\s+([\d\.]+)\s+/) { $version = $1;}
# special value
@@ -463,6 +463,12 @@ sub _analyze_thread
else {
_PRINT_DEBUG("no prev thread link (key=$current_key)");
}
+
+ # IV. cache additional information for convenience.
+ my $summary = $msg->one_line_summary() || '';
+ if ($summary) {
+ $self->_db_set($db, 'article_summary', $id, $summary);
+ }
}
@@ -1304,6 +1310,28 @@ sub get_key
}
+# Descriptions: find the head id/key of the thread which contains $id.
+# Arguments: OBJ($self) NUM($id)
+# Side Effects: none
+# Return Value: none
+sub find_head_key
+{
+ my ($self, $id) = @_;
+ my $db = $self->_db_open();
+ my $count = 0;
+ my $max = 64;
+ my $prev = $id;
+
+ SEARCH:
+ while ($count++ < $max) {
+ last SEARCH unless $self->_db_get($db, 'prev_key', $prev);
+ $prev = $self->_db_get($db, 'prev_key', $prev);
+ }
+
+ return $prev;
+}
+
+
=head1 HANDLE TABLE
=cut