# Notice-Spam - IRSSi-Plugin use strict; use Irssi; use vars qw($VERSION %IRSSI); $VERSION = "2.0.23"; %IRSSI = ( authors => 'APic@IRCNet, based on „noticelogic“ by Ben Klein, based on „noticemove“ by Timo Sirainen', contact => 'IRSSi@APic.Name', name => "Notice-Spam", description => "Spam private Notices to active Window, Query (if one exists), and all Channels where the Sender resides.", license => "Public Domina", url => "http://irssi.apic.name/", ); my $insig = 0; sub sig_print_text { my ($dest, $text, $stripped) = @_; my $server = $dest->{server}; my $active = Irssi::active_win()->{active}; # Ignore non-Notices return if (!$server || ($dest->{level} & MSGLEVEL_NOHILIGHT) || !($dest->{level} & MSGLEVEL_NOTICES)); return if $insig; $insig = 1; # Print the Notice in Query with the Sender, if one exists, # except the active one. foreach my $query ($server->queries()) { next if $active->{type} eq "QUERY" && $active->{name} eq $query->{name}; if ($query->{name} eq $dest->{target}) { $query->print($text, $dest->{level}); } } # Print the Notice in all Channels the Sender is joined, # except the active one. foreach my $channel ($server->channels()) { next if $active->{type} eq "CHANNEL" && $active->{name} eq $channel->{name}; if ($channel->nick_find($dest->{target}) || $channel->{name} eq $dest->{target}) { $channel->print($text, $dest->{level}); } } # Now finally print the Notice in the active Window. Irssi::active_win()->print($text, $dest->{level}); Irssi::signal_stop(); $insig = 0; } Irssi::signal_add('print text', 'sig_print_text');