use strict;
use Irssi;
use vars qw($VERSION %IRSSI);

$VERSION = "0.0.1";
%IRSSI = (
	authors     => "Tom Wesley",
	contact     => "tom\@tomaw.net",
	name        => "Prints incoming messages and remove the",
	description => "",
	license     => "Public Domain"
);

sub event_pubmsg {
	my ($server, $data, $nick, $mask, $target) = @_;

	my %chans = split ' ', Irssi::settings_get_str('print_incoming_channels');
	return if ! exists $chans{$target};

	Irssi::signal_stop();
	Irssi::window_find_item($target)->print($data, MSGLEVEL_NEVER);
}

Irssi::settings_add_str("misc", "print_incoming_channels", 1);
Irssi::signal_add('message public', 'event_pubmsg');
