67 |
use HTML::CalendarMonthSimple; |
use HTML::CalendarMonthSimple; |
68 |
use Getopt::Long; |
use Getopt::Long; |
69 |
use DateTime; |
use DateTime; |
70 |
|
use Data::Dump qw/dump/; |
71 |
|
|
72 |
my $import_dircproxy; |
my $import_dircproxy; |
73 |
GetOptions( |
GetOptions( |
433 |
|
|
434 |
my $SKIPPING = 0; # if skipping, how many we've done |
my $SKIPPING = 0; # if skipping, how many we've done |
435 |
my $SEND_QUEUE; # cache |
my $SEND_QUEUE; # cache |
436 |
|
my $ping; # ping stats |
437 |
|
|
438 |
POE::Component::IRC->new($IRC_ALIAS); |
POE::Component::IRC->new($IRC_ALIAS); |
439 |
|
|
465 |
|
|
466 |
save_message( channel => $channel, me => 1, nick => $nick, msg => $msg); |
save_message( channel => $channel, me => 1, nick => $nick, msg => $msg); |
467 |
}, |
}, |
468 |
|
irc_ping => sub { |
469 |
|
warn "pong ", $_[ARG0], $/; |
470 |
|
$ping->{$_[ARG0]++}; |
471 |
|
}, |
472 |
|
irc_invite => sub { |
473 |
|
my $kernel = $_[KERNEL]; |
474 |
|
my $nick = (split /!/, $_[ARG0])[0]; |
475 |
|
my $channel = $_[ARG1]; |
476 |
|
|
477 |
|
|
478 |
|
warn "invited to $channel by $nick"; |
479 |
|
|
480 |
|
$_[KERNEL]->post( $IRC_ALIAS => privmsg => $nick, "how nice of you to invite me to $channel, I'll be right there..." ); |
481 |
|
$_[KERNEL]->post($IRC_ALIAS => join => $channel); |
482 |
|
|
483 |
|
}, |
484 |
irc_msg => sub { |
irc_msg => sub { |
485 |
my $kernel = $_[KERNEL]; |
my $kernel = $_[KERNEL]; |
486 |
my $nick = (split /!/, $_[ARG0])[0]; |
my $nick = (split /!/, $_[ARG0])[0]; |
567 |
} |
} |
568 |
|
|
569 |
my @nicks; |
my @nicks; |
570 |
foreach my $nick (sort { $stat->{from}->{$a} cmp $stat->{from}->{$b} } keys %{ $stat->{from} }) { |
foreach my $nick (sort { $stat->{from}->{$a} <=> $stat->{from}->{$b} } keys %{ $stat->{from} }) { |
571 |
push @nicks, $nick . $stat->{from}->{$nick} == 1 ? '' : |
push @nicks, $nick . ( $stat->{from}->{$nick} == 1 ? '' : |
572 |
"(" . $stat->{from}->{$nick} . ")"; |
"(" . $stat->{from}->{$nick} . ")" |
573 |
|
); |
574 |
} |
} |
575 |
|
|
576 |
$res = |
$res = |
577 |
"+ " . ( $stat->{vote}->{'+'} || 0 ) . " : " . |
"$what ++ " . ( $stat->{vote}->{'+'} || 0 ) . |
578 |
"- " . ( $stat->{vote}->{'-'} || 0 ) . |
" : " . ( $stat->{vote}->{'-'} || 0 ) . " --" . |
579 |
" from " . ( join(", ", @nicks) || 'nobody' ); |
" from " . ( join(", ", @nicks) || 'nobody' ); |
580 |
|
|
581 |
|
$_[KERNEL]->post( $IRC_ALIAS => notice => $nick, $res ); |
582 |
|
|
583 |
|
} elsif ($msg =~ m/^ping/) { |
584 |
|
$res = "ping = " . dump( $ping ); |
585 |
} |
} |
586 |
|
|
587 |
if ($res) { |
if ($res) { |