X-Git-Url: https://ruin.nu/git/?p=NDIRC.git;a=blobdiff_plain;f=Dispatcher.pm;fp=Dispatcher.pm;h=a11ae53cda91800f387dcd4fae40c874a2a9b045;hp=6705349b8081b4da430edc43ee3e48d12adf0217;hb=468a4e3e07c0d9e6ed66a75c73f0d7ff2921b90a;hpb=cd18307dc7e3886266937935feffbb41b1df422d diff --git a/Dispatcher.pm b/Dispatcher.pm index 6705349..a11ae53 100644 --- a/Dispatcher.pm +++ b/Dispatcher.pm @@ -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; } @@ -101,17 +97,13 @@ sub has_command { 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) = @_;