18 |
|
|
19 |
## CONFIG |
## CONFIG |
20 |
|
|
21 |
my $NICK = 'irc-logger-dev'; |
my $NICK = 'irc-logger'; |
22 |
my $CONNECT = |
my $CONNECT = |
23 |
{Server => 'irc.freenode.net', |
{Server => 'irc.freenode.net', |
24 |
Nick => $NICK, |
Nick => $NICK, |
44 |
use POE qw(Component::IRC Wheel::FollowTail Component::Server::HTTP); |
use POE qw(Component::IRC Wheel::FollowTail Component::Server::HTTP); |
45 |
use HTTP::Status; |
use HTTP::Status; |
46 |
use DBI; |
use DBI; |
47 |
use Encode qw/from_to/; |
use Encode qw/from_to is_utf8/; |
48 |
use Regexp::Common qw /URI/; |
use Regexp::Common qw /URI/; |
49 |
use CGI::Simple; |
use CGI::Simple; |
50 |
use HTML::TagCloud; |
use HTML::TagCloud; |
290 |
|
|
291 |
print "$channel: <$nick> $msg\n"; |
print "$channel: <$nick> $msg\n"; |
292 |
$sth->execute($channel, 0, $nick, $msg); |
$sth->execute($channel, 0, $nick, $msg); |
293 |
|
add_tag( id => $dbh->last_insert_id(undef,undef,"log",undef), |
294 |
|
message => $msg); |
295 |
}, |
}, |
296 |
irc_ctcp_action => sub { |
irc_ctcp_action => sub { |
297 |
my $kernel = $_[KERNEL]; |
my $kernel = $_[KERNEL]; |
303 |
|
|
304 |
print "$channel ***$nick $msg\n"; |
print "$channel ***$nick $msg\n"; |
305 |
$sth->execute($channel, 1, $nick, $msg); |
$sth->execute($channel, 1, $nick, $msg); |
306 |
|
add_tag( id => $dbh->last_insert_id(undef,undef,"log",undef), |
307 |
|
message => $msg); |
308 |
}, |
}, |
309 |
irc_msg => sub { |
irc_msg => sub { |
310 |
my $kernel = $_[KERNEL]; |
my $kernel = $_[KERNEL]; |
498 |
|
|
499 |
return unless ($arg->{id} && $arg->{message}); |
return unless ($arg->{id} && $arg->{message}); |
500 |
|
|
501 |
while ($arg->{message} =~ s#\b(\S+)//##s) { |
my $m = $arg->{message}; |
502 |
|
from_to('UTF-8', 'iso-8859-2', $m) if (is_utf8($m)); |
503 |
|
|
504 |
|
while ($m =~ s#\b([\w-_]+)//##s) { |
505 |
my $tag = $1; |
my $tag = $1; |
506 |
next if (! $tag || $tag =~ m/https?:/i); |
next if (! $tag || $tag =~ m/https?:/i); |
507 |
push @{ $tags->{$tag} }, $arg->{id}; |
push @{ $tags->{$tag} }, $arg->{id}; |
590 |
get_from_log( |
get_from_log( |
591 |
limit => $q->param('last') || 100, |
limit => $q->param('last') || 100, |
592 |
search => $search || undef, |
search => $search || undef, |
593 |
tag => $q->param('tag'), |
tag => $q->param('tag') || undef, |
594 |
fmt => { |
fmt => { |
595 |
date => '<hr size="1" style="clear: both;"/><div class="date">%s</div> ', |
date => '<hr size="1" style="clear: both;"/><div class="date">%s</div> ', |
596 |
time => '<span class="time">%s</span> ', |
time => '<span class="time">%s</span> ', |