summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2012-01-31 21:27:51 +0000
committerLibravatarWilliam Heimbigner <william.heimbigner@gmail.com>2012-01-31 21:27:51 +0000
commit899a7bcaa4bb34ae81bdcf5b4a0e09d6d563649b (patch)
treed28c6687be0695915296dffa125b326768cdabe1 /modules
parent0c1f2ce44422875b771462f6c58b1ad4844f4a69 (diff)
fixing bad code and a lack of ping replies
Diffstat (limited to 'modules')
-rw-r--r--modules/classes.pl8
-rw-r--r--modules/event.pl12
2 files changed, 15 insertions, 5 deletions
diff --git a/modules/classes.pl b/modules/classes.pl
index 832951d..6896ce7 100644
--- a/modules/classes.pl
+++ b/modules/classes.pl
@@ -79,6 +79,7 @@ sub dnsbl
# hopefully getting rid of this won't cause shit to assplode
# but I'm getting rid of it so it can detect cgi:irc shit
if (defined $rev) {
+ print "Querying $rev$chk->{content}\n" if $::debugx{dnsbl};
my $iaddr = gethostbyname( "$rev$chk->{content}" );
my @dnsbl = unpack( 'C4', $iaddr ) if defined $iaddr;
my $strip;
@@ -164,7 +165,7 @@ sub splitflood {
$cfc = 0;
process_cf();
}
- if ( $#{@{$cf{$id}{$chan}{$text}}}+1 == int($cut[0]) ) {
+ if ( scalar @{$cf{$id}{$chan}{$text}} == int($cut[0]) ) {
$bs{$id}{$text} = time;
return 1;
}
@@ -195,7 +196,7 @@ sub advsplitflood {
$cfc = 0;
process_cf();
}
- if ( $#{@{$cf{$id}{$chan}{$text}}}+1 == int($cut[0]) ) {
+ if ( scalar @{$cf{$id}{$chan}{$text}} == int($cut[0]) ) {
$bs{$id}{$text} = time;
return 1;
}
@@ -279,7 +280,8 @@ sub flood_add
$sfc = 0;
flood_process();
}
- return $#{ @{$sf{$id}{$chan}{$host}}}+1;
+# return $#{ @{$sf{$id}{$chan}{$host}}}+1;
+ return scalar @{$sf{$id}{$chan}{$host}};
}
sub flood_process
diff --git a/modules/event.pl b/modules/event.pl
index e7e7d55..1e1f7a6 100644
--- a/modules/event.pl
+++ b/modules/event.pl
@@ -57,10 +57,20 @@ sub new
$conn->add_handler('cfinger', \&on_ctcp);
$conn->add_handler('354', \&on_whoxreply);
$conn->add_handler('account', \&on_account);
+ $conn->add_handler('ping', \&on_ping);
bless($self);
return $self;
}
+sub on_ping
+{
+ my ($conn, $event) = @_;
+ $conn->sl("PONG " . $event->{args}->[0]);
+ return unless $::debugx{pingpong};
+ print strftime("%F %T ", gmtime) . "Ping? Pong!\n";
+ print Dumper($event);
+}
+
sub on_account
{
my ($conn, $event) = @_;
@@ -78,7 +88,6 @@ sub on_join {
my $nick = lc $event->{nick};
my $chan = lc $event->{to}->[0];
my $rate;
- print Dumper($event) if $::debug;
if ( lc $conn->{_nick} eq lc $nick) {
$::sc{$chan} = {};
mkdir($::settings->{log}->{dir} . $chan);
@@ -363,7 +372,6 @@ sub on_whoxreply
return unless $event->{args}->[1] eq '314';
my ($tgt, $magic, $chan, $user, $host, $nick, $flags, $account, $gecos) = @{$event->{args}};
my ($voice, $op) = (0, 0);
- print Dumper($event) if $::debug;
$op = 1 if ( $flags =~ /\@/ );
$voice = 1 if ($flags =~ /\+/);
$nick = lc $nick; $chan = lc $chan;