# amsg filter script which strips duplicate messages originating from /amsg
# (C) 2006 Georg Lukas <georg@boerde.de>

# was: 
#    Print hilighted messages & private messages to window named "hilight"
#    for irssi 0.7.99 by Timo Sirainen
use Irssi;

my $last_msg, $last_nick, $last_target;

sub amsgfilter {
	my ($server, $msg, $nick, $address, $target) = @_;

	if (($msg eq $last_msg) and ($nick eq $last_nick) and ($target ne $last_target)) {
		#Irssi::print("amsg from $nick to $target");
		Irssi::signal_stop();
	}
	#$last_server = $server;
	$last_msg = $msg;
	$last_nick = $nick;
	$last_target = $target;
}

Irssi::signal_add('message public', 'amsgfilter');
