/[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 139 by dpavlin, Sat Jun 7 13:10:15 2008 UTC revision 140 by dpavlin, Fri Jul 18 20:29:45 2008 UTC
# Line 255  sub meta { Line 255  sub meta {
255    
256                  eval { $sth->execute( $value, $nick, $channel, $name ) };                  eval { $sth->execute( $value, $nick, $channel, $name ) };
257    
258                  # error or no result                  if ( $@ ) {
259                  if ( $@ || ! $sth->rows ) {                          # error
260                            _log("META ERROR: $@");
261                    } elsif ( ! $sth->rows ) {
262                            # no result -> add new
263                          $sth = $dbh->prepare(qq{ insert into meta (value,nick,channel,name,changed) values (?,?,?,?,now()) });                          $sth = $dbh->prepare(qq{ insert into meta (value,nick,channel,name,changed) values (?,?,?,?,now()) });
264                          $sth->execute( $value, $nick, $channel, $name );                          eval { $sth->execute( $value, $nick, $channel, $name ); };
265                          warn "## created $nick/$channel/$name = $value\n";                          if ( $@ ) {
266                                    _log "META ERROR: $@";
267                            } else {
268                                    _log "META: created $nick/$channel/$name = $value\n";
269                            }
270                  } else {                  } else {
271                          warn "## updated $nick/$channel/$name = $value\n";                          _log "META: updated $nick/$channel/$name = $value\n";
272                  }                  }
273    
274                  return $value;                  return $value;
# Line 556  sub save_message { Line 563  sub save_message {
563                  " " . $a->{message};                  " " . $a->{message};
564    
565          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}); };
566          _log "ERROR: can't archive ", $a->{message} if $@;          if ( $@ ) {
567          $cloud->add_tag( id => $dbh->last_insert_id(undef,undef,"log",undef), %$a );                  _log "ERROR: can't archive ", $a->{message};
568            } else {
569                    $cloud->add_tag( id => $dbh->last_insert_id(undef,undef,"log",undef), %$a );
570            }
571  }  }
572    
573    
# Line 626  sub rss_parse_xml { Line 636  sub rss_parse_xml {
636    
637          warn "## RSS fetch first $send_rss_msgs items from", $args->{url} if $debug;          warn "## RSS fetch first $send_rss_msgs items from", $args->{url} if $debug;
638    
639          my $feed = XML::Feed->parse( \$args->{xml} );          my $feed;
640            eval { $feed = XML::Feed->parse( \$args->{xml} ) };
641          if ( ! $feed ) {          if ( ! $feed ) {
642                  _log "can't fetch RSS ", $args->{url}, XML::Feed->errstr;                  _log "can't fetch RSS ", $args->{url}, XML::Feed->errstr;
643                  return;                  return;
# Line 1283  sub root_handler { Line 1294  sub root_handler {
1294                          $rc = RC_DENY;                          $rc = RC_DENY;
1295                  }                  }
1296    
1297                  $response->content( $feed->as_xml );                  eval { $response->content( $feed->as_xml ); };
1298                    $rc = RC_INTERNAL_SERVER_ERROR if $@;
1299                  return $rc;                  return $rc;
1300          }          }
1301    

Legend:
Removed from v.139  
changed lines
  Added in v.140

  ViewVC Help
Powered by ViewVC 1.1.26