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; |
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 |
|
|
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; |
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 |
|
|
1362 |
} else { |
} else { |
1363 |
$html .= join("</p><p>", |
$html .= join("</p><p>", |
1364 |
get_from_log( |
get_from_log( |
1365 |
limit => ( $q->param('last') || $q->param('date') ) ? undef : 100, |
limit => ( $q->param('date') ? undef : $q->param('last') || 100 ), |
1366 |
search => $search || undef, |
search => $search || undef, |
1367 |
tag => $q->param('tag') || undef, |
tag => $q->param('tag') || undef, |
1368 |
date => $q->param('date') || undef, |
date => $q->param('date') || undef, |
1387 |
<p>See <a href="/history">history</a> of all messages.</p> |
<p>See <a href="/history">history</a> of all messages.</p> |
1388 |
</body></html>}; |
</body></html>}; |
1389 |
|
|
1390 |
$response->content( decode('utf-8',$html) ); |
$response->content( $html ); |
1391 |
warn "<< ", $request->method, " ", $request->uri, " created ", length($html), " bytes\n"; |
warn "<< ", $request->method, " ", $request->uri, " created ", length($html), " bytes\n"; |
1392 |
return RC_OK; |
return RC_OK; |
1393 |
} |
} |
1427 |
} |
} |
1428 |
|
|
1429 |
my $html = qq{<div id="htmltagcloud">}; |
my $html = qq{<div id="htmltagcloud">}; |
1430 |
foreach my $tag (@tags) { |
foreach my $tag ( sort { lc($a->{name}) cmp lc($b->{name}) } @tags) { |
1431 |
$html .= sprintf(qq{<span class="tag tagcloud%d"><a href="%s" title="%s">%s</a></span>\n}, |
$html .= sprintf(qq{<span class="tag tagcloud%d"><a href="%s" title="%s">%s</a></span>\n}, |
1432 |
$tag->{level}, $tag->{url}, $tag->{count}, $tag->{name} |
$tag->{level}, $tag->{url}, $tag->{count}, $tag->{name} |
1433 |
); |
); |