use strict; use vars qw($VERSION %IRSSI); use Irssi; use Irssi qw(signal_add_last signal_stop); $VERSION = '0.1'; %IRSSI = ( authors => 'PraXXa', contact => 'daniel.lindholm@praxxa.com, daniel.ylitalo@praxxa.com', name => 'phpBNC simple parser', description => 'For phpBNC offline history', license => 'Public Domain', ); sub phpbnc_check { my ($server, $msg, $nick, $address, $target) = @_; if ($msg =~ /^PHPBNC_SAVE_*/) { my $time = substr($msg, 12, 10); my ($sec, $min, $hour, $day, $month, $year) = (localtime($time))[0,1,2,3,4,5,6]; my $newmsg = substr($msg, 23); $sec = "0".$sec if $sec < 10; $min = "0".$min if $min < 10; $hour = "0".$hour if $hour < 10; $target = $nick if $target eq ""; $nick = $server->{'nick'} if $address eq ""; $server->window_item_find($target)->print($hour.":".$min.":".$sec." <".$nick."> ".$newmsg, MSGLEVEL_MSGS); signal_stop(); } } signal_add_last('message public', 'phpbnc_check');