From 04c4d4ae0d6fdfe9e59a50e79b40047a08feefb7 Mon Sep 17 00:00:00 2001 From: William Heimbigner Date: Wed, 6 Jun 2007 21:30:25 +0000 Subject: Added files --- modules/command.pl | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 modules/command.pl (limited to 'modules/command.pl') 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; -- cgit v1.2.3