- my @subselects = split /\s+/,$selection;
- my %search_parameters;
- my %users;
- for my $subselect (@subselects) {
- my ($key,$value) = split /:/, $subselect, 2;
- next unless $key;
- if (exists $valid_keys{$key}) {
- push @{$search_parameters{$valid_keys{$key}}},
- $value if $value;
- } elsif ($key =~/users?$/) {
- $users{$value} = 1 if $value;
- }
- }
- my %usertags;
- for my $user (keys %users) {
- my $ut = $soap->get_usertag($user)->result();
- next unless defined $ut and $ut ne "";
- for my $tag (keys %{$ut}) {
- push @{$usertags{$tag}},
- @{$ut->{$tag}};
- }
- }
- my $bugs = $soap->get_bugs(%search_parameters,
- (keys %usertags)?(usertags=>\%usertags):()
- )->result();
- push @bugs,@{$bugs} if defined $bugs and @{$bugs};
+ my $archived_bugs = "unarchived";
+ if ($selection =~ /archive:(\S+)/ and $1) {
+ $archived_bugs = "archived";
+ }
+ my @subselects = split /\s+/,$selection;
+ my %search_parameters;
+ my %users;
+ for my $subselect (@subselects) {
+ my ($key,$value) = split /:/, $subselect, 2;
+ next unless $key;
+ if (exists $valid_keys{$key}) {
+ push @{$search_parameters{$valid_keys{$key}}},
+ $value if $value;
+ } elsif ($key =~/users?$/) {
+ $users{$value} = 1 if $value;
+ }
+ }
+ my %usertags;
+ for my $user (keys %users) {
+ my $ut = $soap->get_usertag($user)->result();
+ next unless defined $ut and $ut ne "";
+ for my $tag (keys %{$ut}) {
+ push @{$usertags{$tag}},
+ @{$ut->{$tag}};
+ }
+ }
+ my $bugs = $soap->get_bugs(%search_parameters,
+ (keys %usertags)?(usertags=>\%usertags):()
+ )->result();
+ if (defined $bugs and @{$bugs}) {
+ $bugs{$archived_bugs}{$_} = 1 for @{$bugs};
+ }
+ }
+ for my $bug (@bugs) {
+ $bugs{archived}{$bug} = 1;
+ $bugs{unarchived}{$bug} = 1;