about summary refs log tree commit homepage
path: root/lib/PublicInbox/SearchThread.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/PublicInbox/SearchThread.pm')
-rw-r--r--lib/PublicInbox/SearchThread.pm10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/PublicInbox/SearchThread.pm b/lib/PublicInbox/SearchThread.pm
index 24a56d2d..fe70406b 100644
--- a/lib/PublicInbox/SearchThread.pm
+++ b/lib/PublicInbox/SearchThread.pm
@@ -98,6 +98,16 @@ sub new {
         }, $_[0];
 }
 
+sub topmost {
+        my ($self) = @_;
+        my @q = ($self);
+        while (my $cont = shift @q) {
+                return $cont if $cont->{smsg};
+                push @q, values %{$cont->{children}};
+        }
+        undef;
+}
+
 sub add_child {
         my ($self, $child) = @_;
         croak "Cowardly refusing to become my own parent: $self"