+my $n = 0;
+
+# select candidates
+my @all = grep {!$_->private || !($self->priv < 5 && $_->to ne $self->call && $_->from ne $self->call)} (DXMsg::get_all());
+@all = grep {!$_->delete || ($self->priv >= 5 && $_->delete)} @all;
+
+return (1, $self->msg('dir1')) unless @all;
+my $sel = 0;
+my $from = 0;
+my $to = $all[@all-1]->msgno;