/[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 142 by dpavlin, Fri Feb 6 14:17:44 2009 UTC revision 150 by dpavlin, Sat Oct 8 18:43:21 2011 UTC
# Line 18  use Carp qw/confess/; Line 18  use Carp qw/confess/;
18  use XML::Feed;  use XML::Feed;
19  use DateTime::Format::Flexible;  use DateTime::Format::Flexible;
20  use Encode;  use Encode;
21    #use Redis 2.0;
22    
23  =head1 NAME  =head1 NAME
24    
# Line 564  sub save_message { Line 565  sub save_message {
565                  " " . $a->{message};                  " " . $a->{message};
566    
567          eval { $sth_insert_log->execute($a->{channel}, $a->{me}, $a->{nick}, $a->{message}, $a->{time}); };          eval { $sth_insert_log->execute($a->{channel}, $a->{me}, $a->{nick}, $a->{message}, $a->{time}); };
568    
569            eval {
570            my @channel = ( 'channel' , $a->{channel}, $a->{nick} );
571            push @channel, 'me' if $a->{me};
572    #       my $redis = Redis->new( server => '192.168.1.61:6379' );
573    #       $redis->publish( join(' ',@channel), $a->{message} );
574            };
575    
576          if ( $@ ) {          if ( $@ ) {
577                  _log "ERROR: can't archive ", $a->{message};                  _log "ERROR: can't archive ", $a->{message};
578          } else {          } else {
# Line 573  sub save_message { Line 582  sub save_message {
582    
583    
584  if ($import_dircproxy) {  if ($import_dircproxy) {
585            my ( $from_time, $date_time ) = $dbh->selectrow_array(qq{
586                    select date_part('epoch',max(time)),max(time) from log
587            });
588    
589            warn "IMPORT $date_time [$from_time]\n";
590    
591          open(my $l, $import_dircproxy) || die "can't open $import_dircproxy: $!";          open(my $l, $import_dircproxy) || die "can't open $import_dircproxy: $!";
592          warn "importing $import_dircproxy...\n";          warn "importing $import_dircproxy...\n";
593          my $tz_offset = 1 * 60 * 60;    # TZ GMT+2          my $tz_offset = 1 * 60 * 60;    # TZ GMT+2
# Line 581  if ($import_dircproxy) { Line 596  if ($import_dircproxy) {
596                  if (/^@(\d+)\s(\S+)\s(.+)$/) {                  if (/^@(\d+)\s(\S+)\s(.+)$/) {
597                          my ($time, $nick, $msg) = ($1,$2,$3);                          my ($time, $nick, $msg) = ($1,$2,$3);
598    
599                            next if $time <= $from_time;
600    
601                          my $dt = DateTime->from_epoch( epoch => $time + $tz_offset );                          my $dt = DateTime->from_epoch( epoch => $time + $tz_offset );
602    
603                          my $me = 0;                          my $me = 0;
# Line 1173  sub root_handler { Line 1190  sub root_handler {
1190    
1191          return RC_OK if $request->uri =~ m/favicon.ico$/;          return RC_OK if $request->uri =~ m/favicon.ico$/;
1192    
1193            if ( $request->uri =~ m/robots.txt$/ ) {
1194                    $response->content_type( 'text/plain' );
1195                    $response->content( qq{
1196    
1197    User-Agent: *
1198    Disallow: /
1199    
1200                    });
1201                    return RC_OK;
1202            }
1203    
1204          my $q;          my $q;
1205    
1206          if ( $request->method eq 'POST' ) {          if ( $request->method eq 'POST' ) {
# Line 1309  sub root_handler { Line 1337  sub root_handler {
1337          my $html =          my $html =
1338                  qq{<html><head><title>$NICK</title><style type="text/css">$style}                  qq{<html><head><title>$NICK</title><style type="text/css">$style}
1339                  . $cloud->css                  . $cloud->css
1340                  . qq{</style></head><body>}                  . qq{</style>
1341                    <meta name="google-site-verification" content="oe-LvUiNiQRPpc_uB-3rY4MWvFifkmLf276WzAvTL5U" />  
1342                    </head><body>}
1343                  . qq{                  . qq{
1344                  <form method="post" class="search" action="/">                  <form method="post" class="search" action="/">
1345                  <input type="text" name="search" value="$search" size="10">                  <input type="text" name="search" value="$search" size="10">

Legend:
Removed from v.142  
changed lines
  Added in v.150

  ViewVC Help
Powered by ViewVC 1.1.26