Henrybk

BusMsg

Aug 11th, 2017
167
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Perl 0.67 KB | None | 0 0
  1. package eventMacro::Condition::BusMsg;
  2.  
  3. use strict;
  4. use Globals;
  5. use Utils;
  6.  
  7. use base 'eventMacro::Condition::BaseMsg';
  8.  
  9. sub _hooks {
  10.     my ( $self ) = @_;
  11.     my $hooks = $self->SUPER::_hooks;
  12.     my @other_hooks = ('bus_received');
  13.     push(@{$hooks}, @other_hooks);
  14.     return $hooks;
  15. }
  16.  
  17. sub validate_condition {
  18.     my ( $self, $callback_type, $callback_name, $args ) = @_;
  19.     if ($callback_type eq 'hook') {
  20.         $self->{message} = $args->{message};
  21.         if (exists $args->{sender}) {
  22.             $self->{source} = $args->{sender};
  23.         } else {
  24.             $self->{source} = undef;
  25.         }
  26.     }
  27.     return $self->SUPER::validate_condition( $callback_type, $callback_name, $args );
  28. }
  29.  
  30. sub usable {
  31.     1;
  32. }
  33.  
  34. 1;
Advertisement
Add Comment
Please, Sign In to add comment