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"; |