/[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 51 by dpavlin, Sun Mar 18 16:03:24 2007 UTC revision 60 by dpavlin, Sat Apr 14 12:45:03 2007 UTC
# Line 75  use Getopt::Long; Line 75  use Getopt::Long;
75  use DateTime;  use DateTime;
76  use Data::Dump qw/dump/;  use Data::Dump qw/dump/;
77    
78    my $use_twitter = 1;
79    eval { require Net::Twitter; };
80    $use_twitter = 0 if ($@);
81    
82  my $import_dircproxy;  my $import_dircproxy;
83  my $log_path;  my $log_path;
84  GetOptions(  GetOptions(
# Line 545  POE::Session->create( inline_states => Line 549  POE::Session->create( inline_states =>
549    
550                  save_message( channel => $channel, me => 1, nick => $nick, msg => $msg);                  save_message( channel => $channel, me => 1, nick => $nick, msg => $msg);
551    
552                  if ( my $twitter = ( $nick, $channel, 'twitter' ) ) {                  if ( $use_twitter ) {
553                          _log("FIXME: send twitter for $nick on $channel [$twitter]");                          if ( my $twitter = meta( $nick, $NICK, 'twitter' ) ) {
554                                    my ($login,$passwd) = split(/\s+/,$twitter,2);
555                                    _log("sending twitter for $nick/$login on $channel ");
556                                    my $bot = Net::Twitter->new( username=>$login, password=>$passwd );
557                                    $bot->update("<${channel}> $msg");
558                            }
559                  }                  }
560    
561      },      },
# Line 593  POE::Session->create( inline_states => Line 602  POE::Session->create( inline_states =>
602    
603                          my $sth = $dbh->prepare(qq{                          my $sth = $dbh->prepare(qq{
604                                  select                                  select
605                                          nick,                                          trim(both '_' from nick) as nick,
606                                          count(*) as count,                                          count(*) as count,
607                                          sum(length(message)) as len                                          sum(length(message)) as len
608                                  from log                                  from log
609                                  group by nick                                  group by trim(both '_' from nick)
610                                  order by len desc,count desc                                  order by len desc,count desc
611                                  limit $nr                                  limit $nr
612                          });                          });
# Line 673  POE::Session->create( inline_states => Line 682  POE::Session->create( inline_states =>
682                          if ( ! defined( $1 ) ) {                          if ( ! defined( $1 ) ) {
683                                  my $sth = $dbh->prepare(qq{ select name,value,changed from meta where nick = ? and channel = ? });                                  my $sth = $dbh->prepare(qq{ select name,value,changed from meta where nick = ? and channel = ? });
684                                  $sth->execute( $nick, $channel );                                  $sth->execute( $nick, $channel );
685                                  $res = "config for $nick ";                                  $res = "config for $nick on $channel";
686                                  while ( my ($n,$v) = $sth->fetchrow_array ) {                                  while ( my ($n,$v) = $sth->fetchrow_array ) {
687                                          $res .= "| $n = $v";                                          $res .= " | $n = $v";
688                                  }                                  }
689                          } elsif ( ! $2 ) {                          } elsif ( ! $2 ) {
690                                  my $val = meta( $nick, $channel, $1 );                                  my $val = meta( $nick, $channel, $1 );
# Line 826  p { margin: 0; padding: 0.1em; } Line 835  p { margin: 0; padding: 0.1em; }
835  .nick { color: #000000; font-size: 80%; padding: 2px; font-family: courier, courier new, monospace ; }  .nick { color: #000000; font-size: 80%; padding: 2px; font-family: courier, courier new, monospace ; }
836  .message { color: #000000; font-size: 100%; }  .message { color: #000000; font-size: 100%; }
837  .search { float: right; }  .search { float: right; }
838    a:link.tag, a:visited.tag { border: 1px dashed #ccc; backgound: #ccc; text-decoration: none }
839    a:hover.tag { border: 1px solid #eee }
840    hr { border: 1px dashed #ccc; height: 1px; clear: both; }
841    /*
842  .col-0 { background: #ffff66 }  .col-0 { background: #ffff66 }
843  .col-1 { background: #a0ffff }  .col-1 { background: #a0ffff }
844  .col-2 { background: #99ff99 }  .col-2 { background: #99ff99 }
845  .col-3 { background: #ff9999 }  .col-3 { background: #ff9999 }
846  .col-4 { background: #ff66ff }  .col-4 { background: #ff66ff }
847  a:link.tag, a:visited.tag { border: 1px dashed #ccc; backgound: #ccc; text-decoration: none }  */
 a:hover.tag { border: 1px solid #eee }  
 hr { border: 1px dashed #ccc; height: 1px; clear: both; }  
848  _END_OF_STYLE_  _END_OF_STYLE_
849    
850  my $max_color = 4;  my $max_color = 4;
851    
852    my @cols = qw(
853            #ffcccc #ccffe6 #ccccff #e6ccff #ffccff #ffcce6 #ff9999 #ffcc99 #ffff99
854            #ccff99 #99ff99 #99ffcc #99ccff #9999ff #cc99ff #ff6666 #ffb366 #ffff66
855            #66ff66 #66ffb3 #66b3ff #6666ff #ff3333 #33ff33 #3399ff #3333ff #ff3399
856            #a0a0a0 #ff0000 #ffff00 #80ff00 #0000ff #8000ff #ff00ff #ff0080 #994d00
857            #999900 #009900 #cc0066 #c0c0c0 #ccff99 #99ff33 #808080 #660033 #ffffff
858    );
859    
860    $max_color = 0;
861    foreach my $c (@cols) {
862            $style .= ".col-${max_color} { background: $c }\n";
863            $max_color++;
864    }
865    warn "defined $max_color colors for users...\n";
866    
867  my %nick_enumerator;  my %nick_enumerator;
868    
869  sub root_handler {  sub root_handler {
# Line 918  sub root_handler { Line 944  sub root_handler {
944                                                  $m =~ s/($escape_re)/$escape{$1}/gs;                                                  $m =~ s/($escape_re)/$escape{$1}/gs;
945                                                  $m =~ s#($RE{URI}{HTTP})#<a href="$1">$1</a>#gs;                                                  $m =~ s#($RE{URI}{HTTP})#<a href="$1">$1</a>#gs;
946                                                  $m =~ s#$tag_regex#<a href="?tag=$1" class="tag">$1</a>#g;                                                  $m =~ s#$tag_regex#<a href="?tag=$1" class="tag">$1</a>#g;
947                                                    $m =~ s#\*(\w+)\*#<b>$1</b>#gs;
948                                                    $m =~ s#_(\w+)_#<u>$1</u>#gs;
949                                                    $m =~ s#\/(\w+)\/#<i>$1</i>#gs;
950                                                  return $m;                                                  return $m;
951                                          },                                          },
952                                          nick => sub {                                          nick => sub {

Legend:
Removed from v.51  
changed lines
  Added in v.60

  ViewVC Help
Powered by ViewVC 1.1.26