1005 |
|
|
1006 |
my $sql = { |
my $sql = { |
1007 |
add => qq{ insert into feeds (url,name,channel,nick,private) values (?,?,?,?,?) }, |
add => qq{ insert into feeds (url,name,channel,nick,private) values (?,?,?,?,?) }, |
1008 |
# remove => qq{ delete from feeds where url = ? and name = ? }, |
remove => qq{ delete from feeds where url = ? and nick = ? }, |
1009 |
start => qq{ update feeds set active = true where url = ? }, |
start => qq{ update feeds set active = true where url = ? }, |
1010 |
stop => qq{ update feeds set active = false where url = ? }, |
stop => qq{ update feeds set active = false where url = ? }, |
1011 |
clean => qq{ update feeds set last_update = now() - delay where url = ? }, |
clean => qq{ update feeds set last_update = now() - delay where url = ? }, |
1018 |
my @data = ( $url ); |
my @data = ( $url ); |
1019 |
if ( $command eq 'add' ) { |
if ( $command eq 'add' ) { |
1020 |
push @data, ( $arg, $channel, $nick, $sub eq 'private' ? 1 : 0 ); |
push @data, ( $arg, $channel, $nick, $sub eq 'private' ? 1 : 0 ); |
1021 |
|
} elsif ( $command eq 'remove' ) { |
1022 |
|
push @data, $nick; |
1023 |
} |
} |
1024 |
warn "## $command SQL $q with ",dump( @data ),"\n"; |
warn "## $command SQL $q with ",dump( @data ),"\n"; |
1025 |
eval { $sth->execute( @data ) }; |
eval { $sth->execute( @data ) }; |
1026 |
if ($@) { |
if ($@) { |
1027 |
$res = "ERROR: $@"; |
$res = "ERROR: $@"; |
1028 |
} else { |
} else { |
1029 |
$res = "OK, RSS executed $command" . ( $sub ? "-$sub" : '' ) ." on $channel url $url"; |
$res = "OK, RSS executed $command" . |
1030 |
|
( $sub ? "-$sub " : ' ' ) . |
1031 |
|
( $channel ? "on $channel " : '' ) . |
1032 |
|
"url $url"; |
1033 |
if ( $command eq 'clean' ) { |
if ( $command eq 'clean' ) { |
1034 |
my $seen = $_stat->{rss}->{seen} || die "no seen?"; |
my $seen = $_stat->{rss}->{seen} || die "no seen?"; |
1035 |
my $want_link = $_stat->{rss}->{url2link}->{$url} || warn "no url2link($url)"; |
my $want_link = $_stat->{rss}->{url2link}->{$url} || warn "no url2link($url)"; |