/[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 90 by dpavlin, Fri Mar 7 09:50:53 2008 UTC revision 91 by dpavlin, Fri Mar 7 10:13:45 2008 UTC
# Line 897  POE::Session->create( inline_states => { Line 897  POE::Session->create( inline_states => {
897                          $_rss = undef;                          $_rss = undef;
898                          $dbh->do( qq{ update feeds set last_update = now() - delay } );                          $dbh->do( qq{ update feeds set last_update = now() - delay } );
899                          $res = "OK, cleaned RSS cache";                          $res = "OK, cleaned RSS cache";
900                    } elsif ($msg =~ m/^rss-list/) {
901                            my $sth = $dbh->prepare(qq{ select url,name,last_update,active from feeds });
902                            $sth->execute;
903                            while (my @row = $sth->fetchrow_array) {
904                                    $_[KERNEL]->post( $IRC_ALIAS => privmsg => $nick, join(' | ',@row) );
905                            }
906                            $res = '';
907                  } elsif ($msg =~ m!^rss-(add|remove|stop|start)\s+(http://\S+)\s*(.*)!) {                  } elsif ($msg =~ m!^rss-(add|remove|stop|start)\s+(http://\S+)\s*(.*)!) {
908                          my $sql = {                          my $sql = {
909                                  add             => qq{ insert into feeds (url,name) values (?,?) },                                  add             => qq{ insert into feeds (url,name) values (?,?) },
910  #                               remove  => qq{ delete from feeds                                where url = ? and name = ? },  #                               remove  => qq{ delete from feeds                                where url = ? and name = ? },
911                                  start   => qq{ update feeds set active = true   where url = ? -- ? },                                  start   => qq{ update feeds set active = true   where url = ? },
912                                  stop    => qq{ update feeds set active = false  where url = ? -- ? },                                  stop    => qq{ update feeds set active = false  where url = ? },
913                                                                    
914                          };                          };
915                          if (my $q = $sql->{$1} ) {                          if (my $q = $sql->{$1} ) {
916                                  my $sth = $dbh->prepare( $q );                                  my $sth = $dbh->prepare( $q );
917                                  warn "## SQL $q ( $2 | $3 )\n";                                  my @data = ( $2 );
918                                  eval { $sth->execute( $2, $3 ) };                                  push @data, $3 if ( $q =~ s/\?//g == 2 );
919                                    warn "## $1 SQL $q with ",dump( @data ),"\n";
920                                    eval { $sth->execute( @data ) };
921                          }                          }
922    
923                          $res = "OK, RSS $1 : $2 - $3";                          $res = "OK, RSS $1 : $2 - $3";

Legend:
Removed from v.90  
changed lines
  Added in v.91

  ViewVC Help
Powered by ViewVC 1.1.26