diff options
| author | 2007-06-06 21:30:25 +0000 | |
|---|---|---|
| committer | 2007-06-06 21:30:25 +0000 | |
| commit | 04c4d4ae0d6fdfe9e59a50e79b40047a08feefb7 (patch) | |
| tree | 3db7aa17c73151e038f08e3cd0c1b2faffc0c482 /modules/command.pl | |
| parent | 110cb874fc58ae4a214889bb8d6545201a57dd2f (diff) | |
Added files
Diffstat (limited to 'modules/command.pl')
| -rw-r--r-- | modules/command.pl | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/modules/command.pl b/modules/command.pl new file mode 100644 index 0000000..87c768f --- /dev/null +++ b/modules/command.pl @@ -0,0 +1,41 @@ +use warnings; +use strict; + +sub do_command +{ + my ($conn, $event) = @_; + my $args = $event->{args}->[0]; + my $from = $event->{from}; + my $cmd = $args; + my $d1; + my $nick = lc $event->{nick}; + foreach my $command ( @{$::commands->{command}} ) + { + if (defined($command->{flag})) { + next unless defined($::xusers->{$nick}); + next unless defined($::xusers->{$nick}->{flags}); + next unless defined(grep {$_ eq $command->{flag}} split('', $::xusers->{$nick}->{flags})); + if ($::xusers->{$nick}->{host} ne 'IDENTIFY') { + next unless leq($::xusers->{$nick}->{host}, $event->{host}); + } + else { + if ( $cmd =~ /$command->{cmd}/ ){ + push (@{$::idqueue{$nick}}, [$cmd, $command, $event]); + $conn->sl("whois $nick $nick"); + next; + } + } + } + if ($cmd=~/$command->{cmd}/) { + print "$event->{from} told me: $cmd \n"; + eval $command->{content}; + warn $@ if $@; + } + } +} + +sub Command::killsub { + undef &do_command; +} + +return 1; |
