/[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 99 by dpavlin, Fri Mar 7 17:13:30 2008 UTC revision 100 by dpavlin, Sat Mar 8 00:14:41 2008 UTC
# Line 339  sub get_from_log { Line 339  sub get_from_log {
339    
340          my @where;          my @where;
341          my @args;          my @args;
342            my $msg;
343    
344          if (my $search = $args->{search}) {          if (my $search = $args->{search}) {
345                  $search =~ s/^\s+//;                  $search =~ s/^\s+//;
346                  $search =~ s/\s+$//;                  $search =~ s/\s+$//;
347                  push @where, 'message ilike ? or nick ilike ?';                  push @where, 'message ilike ? or nick ilike ?';
348                  push @args, ( ( '%' . $search . '%' ) x 2 );                  push @args, ( ( '%' . $search . '%' ) x 2 );
349                  _log "search for '$search'";                  $msg = "Search for '$search'";
350          }          }
351    
352          if ($args->{tag} && $tags->{ $args->{tag} }) {          if ($args->{tag} && $tags->{ $args->{tag} }) {
353                  push @where, 'id in (' . join(',', @{ $tags->{ $args->{tag} } }) . ')';                  push @where, 'id in (' . join(',', @{ $tags->{ $args->{tag} } }) . ')';
354                  _log "search for tags $args->{tag}";                  $msg = "Search for tags $args->{tag}";
355          }          }
356    
357          if (my $date = $args->{date} ) {          if (my $date = $args->{date} ) {
358                  $date = check_date( $date );                  $date = check_date( $date );
359                  push @where, 'date(time) = ?';                  push @where, 'date(time) = ?';
360                  push @args, $date;                  push @args, $date;
361                  _log "search for date $date";                  $msg = "search for date $date";
362          }          }
363    
364          $sql .= " where " . join(" and ", @where) if @where;          $sql .= " where " . join(" and ", @where) if @where;
# Line 371  sub get_from_log { Line 372  sub get_from_log {
372          eval { $sth->execute( @args ) };          eval { $sth->execute( @args ) };
373          return if $@;          return if $@;
374    
375            my $nr_results = $sth->rows;
376    
377          my $last_row = {          my $last_row = {
378                  date => '',                  date => '',
379                  time => '',                  time => '',
# Line 391  sub get_from_log { Line 394  sub get_from_log {
394    
395          return @rows if ($args->{full_rows});          return @rows if ($args->{full_rows});
396    
397          my @msgs = (          $msg .= ' produced ' . (
398                  "Showing " . ($#rows + 1) . " messages..."                  $nr_results == 0 ? 'no results' :
399                    $nr_results == 0 ? 'one result' :
400                            $nr_results . ' results'
401          );          );
402    
403            my @msgs = ( $msg );
404    
405          if ($context) {          if ($context) {
406                  my @ids = @rows;                  my @ids = @rows;
407                  @rows = ();                  @rows = ();
# Line 655  sub rss_fetch { Line 662  sub rss_fetch {
662                  } elsif ( $link !~ m!^http! ) {                  } elsif ( $link !~ m!^http! ) {
663                          $link = $args->{url} . $link;                          $link = $args->{url} . $link;
664                  }                  }
                 $link =~ s!//+!/!g;  
665    
666                  my $msg;                  my $msg;
667                  $msg .= prefix( 'From: ' , $args->{name} || $feed->title );                  $msg .= prefix( 'From: ' , $args->{name} || $feed->title );

Legend:
Removed from v.99  
changed lines
  Added in v.100

  ViewVC Help
Powered by ViewVC 1.1.26