]> ruin.nu Git - NDIRC.git/blobdiff - Dispatcher.pm
Universal scan parsing
[NDIRC.git] / Dispatcher.pm
index 7dce09838c4f28e954babec1e81ac32c6796f960..a11ae53cda91800f387dcd4fae40c874a2a9b045 100644 (file)
@@ -46,11 +46,6 @@ has channels => (
        default => sub{ {} },
 );
 
-has targets => (
-       is => 'ro',
-       isa => 'HashRef[Str]',
-       default => sub{ {} },
-);
 
 my $DISP;
 
@@ -92,6 +87,7 @@ sub add_channel {
        my ($self,$channel,$types) = @_;
 
        $types = Set::Object->new(@{$types});
+       $types->insert('universal');
        $self->channels->{lc $channel} = $types;
 }
 
@@ -99,18 +95,15 @@ sub has_command {
        my ($self,$command,$channel) = @_;
        $channel = lc $channel;
 
+       return 0 unless defined $command && defined $channel;
        return 0 unless exists $self->commands->{$command};
+       $command = $self->commands->{$command};
+       return 1 if $command->type eq 'universal';
        return 0 unless exists $self->channels->{$channel};
 
-       $command = $self->commands->{$command};
        return $self->channels->{$channel}->has($command->type);
 }
 
-sub set_target {
-       my ($self,$label,$target) = @_;
-       $self->targets->{$label} = $target;
-}
-
 sub run_command {
        my ($self,$c,$command,$args) = @_;