/[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 73 by dpavlin, Sun Dec 16 20:06:47 2007 UTC revision 74 by dpavlin, Sun Dec 16 20:17:26 2007 UTC
# Line 507  sub add_tag { Line 507  sub add_tag {
507          }          }
508    
509          if ( @tags ) {          if ( @tags ) {
510                  shift @last_tags if $#last_tags == $last_x_tags;                  pop @last_tags if $#last_tags == $last_x_tags;
511                  push @last_tags, { tags => [ @tags ], %$arg };                  unshift @last_tags, { tags => [ @tags ], %$arg };
512          }          }
513    
514  }  }
# Line 520  Read all tags from database and create i Line 520  Read all tags from database and create i
520  =cut  =cut
521    
522  sub seed_tags {  sub seed_tags {
523          my $sth = $dbh->prepare(qq{ select id,message,nick,me,time from log where message like '%//%' });          my $sth = $dbh->prepare(qq{ select id,message,nick,me,time from log where message like '%//%' order by time asc });
524          $sth->execute;          $sth->execute;
525          while (my $row = $sth->fetchrow_hashref) {          while (my $row = $sth->fetchrow_hashref) {
526                  add_tag( %$row );                  add_tag( %$row );
# Line 979  sub root_handler { Line 979  sub root_handler {
979                  $response->content_type( 'application/' . lc($type) . '+xml' );                  $response->content_type( 'application/' . lc($type) . '+xml' );
980    
981                  my $html = '<!-- error -->';                  my $html = '<!-- error -->';
982                  warn "create $type feed from ",dump( @last_tags );                  #warn "create $type feed from ",dump( @last_tags );
983    
984                  my $feed = XML::Feed->new( $type );                  my $feed = XML::Feed->new( $type );
985    
986                  $feed->title( "last $last_x_tags from $CHANNEL" );                  $feed->title( "last $last_x_tags from $CHANNEL" );
987  #               $feed->link( "http://$http_hostname:$http_port" );                  $feed->link( $url );
988                  $feed->description( "collects messages which have tags// in them" );                  $feed->description( "collects messages which have tags// in them" );
989    
990                  foreach my $m ( @last_tags ) {                  foreach my $m ( @last_tags ) {
# Line 1097  sub root_handler { Line 1097  sub root_handler {
1097          </body></html>};          </body></html>};
1098    
1099          $response->content( $html );          $response->content( $html );
1100          warn "<< ", $request->method, $request->uri, " created ", length($html), " bytes\n";          warn "<< ", $request->method, " ", $request->uri, " created ", length($html), " bytes\n";
1101          return RC_OK;          return RC_OK;
1102  }  }
1103    

Legend:
Removed from v.73  
changed lines
  Added in v.74

  ViewVC Help
Powered by ViewVC 1.1.26