html/noticemove.pl
1 # Prints private notices from people in the channel where they are joined
2 # with you. Useful when you get lots of private notices from some bots.
3 # for irssi 0.7.99 by Timo Sirainen
4
5 # v1.01 - history:
6 # - fixed infinite loop when you weren't connected to server :)
7
8 use Irssi;
9 use vars qw($VERSION %IRSSI);
10 $VERSION = "1.01";
11 %IRSSI = (
12 authors => "Timo Sirainen",
13 contact => "tss\@iki.fi",
14 name => "notice move",
15 description => "Prints private notices from people in the channel where they are joined with you. Useful when you get lots of private notices from some bots.",
16 license => "Public Domain",
17 url => "http://irssi.org/",
18 changed => "2002-03-04T22:47+0100",
19 changes => "v1.01 - fixed infinite loop when you weren't connected to server :)"
20 );
21
22 my $insig = 0;
23
24 sub sig_print_text {
25 my ($dest, $text, $stripped) = @_;
26 my $server = $dest->{server};
27
28 # ignore non-notices and notices in channels
29 return if (!$server ||
30 !($dest->{level} & MSGLEVEL_NOTICES) ||
31 $server->ischannel($dest->{target}));
32
33 return if ($insig);
34 $insig = 1;
35
36 # print the notice in the first channel the sender is joined
37 foreach my $channel ($server->channels()) {
38 if ($channel->nick_find($dest->{target})) {
39 $channel->print($text, MSGLEVEL_NOTICES);
40 Irssi::signal_stop();
41 last;
42 }
43 }
44
45 $insig = 0;
46 }
47
48 Irssi::signal_add('print text', 'sig_print_text');