+ my $name = shift || $self->{name};
+ my $sort = shift || $self->{sort};
+ my $flag = shift || "";
+ my @out;
+ $name =~ s/.pl$//;
+
+ push @out, join(' ', $name , ':', $sort, $flag);
+ my $filter;
+ my $key;
+ foreach $key (sort $self->getfilkeys) {
+ my $filter = $self->{$key};
+ if (exists $filter->{reject} && exists $filter->{reject}->{user}) {
+ push @out, ' ' . join(' ', $key, 'reject', $filter->{reject}->{user});
+ }
+ if (exists $filter->{accept} && exists $filter->{accept}->{user}) {
+ push @out, ' ' . join(' ', $key, 'accept', $filter->{accept}->{user});
+ }
+ }
+ return @out;
+}
+
+sub install
+{
+ my $self = shift;
+ my $remove = shift;
+ my $name = uc $self->{name};
+ my $sort = $self->{sort};
+ my $in = "";
+ $in = "in" if $name =~ s/^IN_//;
+ $name =~ s/.PL$//;
+
+ my $dxchan;
+ my @dxchan;
+ if ($name eq 'NODE_DEFAULT') {
+ @dxchan = DXChannel::get_all_nodes();
+ } elsif ($name eq 'USER_DEFAULT') {
+ @dxchan = DXChannel::get_all_users();
+ } else {
+ $dxchan = DXChannel->get($name);
+ push @dxchan, $dxchan if $dxchan;
+ }
+ foreach $dxchan (@dxchan) {
+ my $n = "$in$sort" . "filter";
+ my $i = $in ? 'IN_' : '';
+ my $ref = $dxchan->$n();
+ if (!$ref || ($ref && uc $ref->{name} eq "$i$name.PL")) {
+ $dxchan->$n($remove ? undef : $self);
+ }
+ }
+}
+
+sub delete
+{
+ my ($sort, $call, $flag, $fno) = @_;
+
+ # look for the file
+ my $fn = getfn($sort, $call, $flag);
+ my $filter = read_in($sort, $call, $flag);
+ if ($filter) {
+ if ($fno eq 'all') {
+ my $key;
+ foreach $key ($filter->getfilkeys) {
+ delete $filter->{$key};
+ }
+ } elsif (exists $filter->{"filter$fno"}) {
+ delete $filter->{"filter$fno"};
+ }
+
+ # get rid
+ if ($filter->{hops} || $filter->getfilkeys) {
+ $filter->install;
+ $filter->write;
+ } else {
+ $filter->install(1);
+ unlink $fn;
+ }
+ }