--- trunk/irc-logger.pl 2007/02/02 21:37:52 42 +++ trunk/irc-logger.pl 2007/02/02 22:27:36 43 @@ -67,6 +67,7 @@ use HTML::CalendarMonthSimple; use Getopt::Long; use DateTime; +use Data::Dump qw/dump/; my $import_dircproxy; GetOptions( @@ -432,6 +433,7 @@ my $SKIPPING = 0; # if skipping, how many we've done my $SEND_QUEUE; # cache +my $ping; # ping stats POE::Component::IRC->new($IRC_ALIAS); @@ -463,6 +465,22 @@ save_message( channel => $channel, me => 1, nick => $nick, msg => $msg); }, + irc_ping => sub { + warn "pong ", $_[ARG0], $/; + $ping->{$_[ARG0]++}; + }, + irc_invite => sub { + my $kernel = $_[KERNEL]; + my $nick = (split /!/, $_[ARG0])[0]; + my $channel = $_[ARG1]; + + + warn "invited to $channel by $nick"; + + $_[KERNEL]->post( $IRC_ALIAS => privmsg => $nick, "how nice of you to invite me to $channel, I'll be right there..." ); + $_[KERNEL]->post($IRC_ALIAS => join => $channel); + + }, irc_msg => sub { my $kernel = $_[KERNEL]; my $nick = (split /!/, $_[ARG0])[0]; @@ -549,16 +567,21 @@ } my @nicks; - foreach my $nick (sort { $stat->{from}->{$a} cmp $stat->{from}->{$b} } keys %{ $stat->{from} }) { - push @nicks, $nick . $stat->{from}->{$nick} == 1 ? '' : - "(" . $stat->{from}->{$nick} . ")"; + foreach my $nick (sort { $stat->{from}->{$a} <=> $stat->{from}->{$b} } keys %{ $stat->{from} }) { + push @nicks, $nick . ( $stat->{from}->{$nick} == 1 ? '' : + "(" . $stat->{from}->{$nick} . ")" + ); } $res = - "+ " . ( $stat->{vote}->{'+'} || 0 ) . " : " . - "- " . ( $stat->{vote}->{'-'} || 0 ) . + "$what ++ " . ( $stat->{vote}->{'+'} || 0 ) . + " : " . ( $stat->{vote}->{'-'} || 0 ) . " --" . " from " . ( join(", ", @nicks) || 'nobody' ); + $_[KERNEL]->post( $IRC_ALIAS => notice => $nick, $res ); + + } elsif ($msg =~ m/^ping/) { + $res = "ping = " . dump( $ping ); } if ($res) {