+ # tidy up the user string (why I have to stick in an if statement when I have initialised it I have no idea! 5.28 bug?
+ if ($user) {
+ $user =~ s/\)\s*\(/ and /g;
+ $user =~ s/\&\&/ and /g;
+ $user =~ s/\|\|/ or /g;
+ $user =~ s/\!/ not /g;
+ $user =~ s/\s+/ /g;
+ $user =~ s/\{(.*?)\}/'{'. pack('H*', $1) . '}'/eg;
+ $user =~ s/^\s+//;
+ dbg("filter parse: user '$user'") if isdbg('filter');
+ }
+
+ if ($s) {
+ $s =~ s/\)\s*\(/ && /g;
+ dbg("filter parse: s '$s'") if isdbg('filter');
+ }
+
+
+ return (0, $filter, $fno, $user, $s);
+}
+
+# a filter accept/reject command
+sub cmd
+{
+ my ($self, $dxchan, $sort, $type, $line) = @_;
+ return $dxchan->msg('filter5') unless $line;
+
+ my ($r, $filter, $fno, $user, $s) = $self->parse($dxchan, $sort, $line);
+ return (1, $filter) if $r;
+
+ my $u = DXUser::get_current($user);
+ return (1, $dxchan->msg('isow', $user)) if $u && $u->isolate;
+
+ my $fn = "filter$fno";
+
+ $filter->{$fn} = {} unless exists $filter->{$fn};
+ $filter->{$fn}->{$type} = {} unless exists $filter->{$fn}->{$type};
+
+ $filter->{$fn}->{$type}->{user} = $user;
+ $filter->{$fn}->{$type}->{asc} = $s;
+ $r = $filter->compile($fn, $type);
+ return (1,$r) if $r;