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

use Irssi;

$VERSION = '1.00';
%IRSSI = (
    authors	=> q{David O'Rourke},
    contact	=> q{phyber@#irssi},
    name	=> q{vipchatfix},
    description	=> q{redirect op/halfop/voice walls to the proper channel},
    license	=> q{Public Domain},
);

sub check_destination {
	my ($server, $msg, $nick, $addr, $target) = @_;
	if ($target =~ /^[\@|\%|\+]/) {
		my ($prefix, $channel) = ($target =~ /(.)(.*)/);
		$server->channel_find($channel)->printformat(MSGLEVEL_MSGS, 'channel_wall', $nick, $target, $msg);
		Irssi::signal_stop()
	}
}
Irssi::theme_register([
	'channel_wall', '{pubmsgnick {pubnick $[-9]0}{msgchannel $1}}$2',
]);
Irssi::signal_add_first('message public', \&check_destination);