/[irc-logger]/trunk/bin/irc-logger.pl
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/bin/irc-logger.pl

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 42 by dpavlin, Fri Feb 2 21:37:52 2007 UTC revision 43 by dpavlin, Fri Feb 2 22:27:36 2007 UTC
# Line 67  use POSIX qw/strftime/; Line 67  use POSIX qw/strftime/;
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(
# Line 432  if ($import_dircproxy) { Line 433  if ($import_dircproxy) {
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    
# Line 463  POE::Session->create( inline_states => Line 465  POE::Session->create( inline_states =>
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];
# Line 549  POE::Session->create( inline_states => Line 567  POE::Session->create( inline_states =>
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) {

Legend:
Removed from v.42  
changed lines
  Added in v.43

  ViewVC Help
Powered by ViewVC 1.1.26