160 |
}, |
}, |
161 |
}; |
}; |
162 |
|
|
163 |
|
# POE IRC |
164 |
|
my $poe_irc = POE::Component::IRC->spawn( %$irc_config ) or |
165 |
|
die "can't start ", dump( $irc_config ), ": $!"; |
166 |
|
|
167 |
|
my $irc = $poe_irc->session_id(); |
168 |
|
_log "IRC session_id $irc"; |
169 |
|
|
170 |
my $dbh = DBI->connect($DSN,"","", { RaiseError => 1, AutoCommit => 1 }) || die $DBI::errstr; |
my $dbh = DBI->connect($DSN,"","", { RaiseError => 1, AutoCommit => 1 }) || die $DBI::errstr; |
171 |
$dbh->do( qq{ set client_encoding = 'UTF-8' } ); |
$dbh->do( qq{ set client_encoding = 'UTF-8' } ); |
172 |
|
|
706 |
} |
} |
707 |
my ( $type, $to ) = ( 'notice', $args->{channel} ); |
my ( $type, $to ) = ( 'notice', $args->{channel} ); |
708 |
( $type, $to ) = ( 'privmsg', $args->{nick} ) if $args->{private}; |
( $type, $to ) = ( 'privmsg', $args->{nick} ) if $args->{private}; |
709 |
_log(">> $type $to |", $msg); |
_log(">> $type $to", $msg); |
710 |
$args->{kernel}->post( irc => $type => $to, $msg ); |
$args->{kernel}->post( $irc => $type => $to, $msg ); |
711 |
$updates++; |
$updates++; |
712 |
} |
} |
713 |
} |
} |
757 |
# seed rss seen cache so we won't send out all items on startup |
# seed rss seen cache so we won't send out all items on startup |
758 |
_log rss_fetch_all; |
_log rss_fetch_all; |
759 |
|
|
|
# |
|
|
# POE handing part |
|
|
# |
|
|
|
|
|
my $poe_irc = POE::Component::IRC->spawn( %$irc_config ) or |
|
|
die "can't start ", dump( $irc_config ), ": $!"; |
|
|
|
|
|
my $irc = $poe_irc->session_id(); |
|
|
_log "session_id $irc"; |
|
|
|
|
760 |
POE::Session->create( inline_states => { |
POE::Session->create( inline_states => { |
761 |
_start => sub { |
_start => sub { |
762 |
$_[KERNEL]->post( $irc => register => 'all' ); |
$_[KERNEL]->post( $irc => register => 'all' ); |
771 |
}, |
}, |
772 |
irc_255 => sub { # server is done blabbing |
irc_255 => sub { # server is done blabbing |
773 |
$_[KERNEL]->post( $irc => join => $CHANNEL); |
$_[KERNEL]->post( $irc => join => $CHANNEL); |
|
$_[KERNEL]->post( $irc => privmsg => 'nickserv', "IDENTIFY $NICK" ); |
|
774 |
}, |
}, |
775 |
irc_public => sub { |
irc_public => sub { |
776 |
my $kernel = $_[KERNEL]; |
my $kernel = $_[KERNEL]; |