All patches and comments are welcome. Please squash your changes to logical
commits before using git-format-patch and git-send-email to
patches@git.madduck.net.
If you'd read over the Git project's submission guidelines and adhered to them,
I'd be especially grateful.
4 use vars qw($VERSION %IRSSI);
9 contact=> 'bd@bc-bd.org',
11 description=> 'Hide duplicate lines',
13 url=> 'https://bc-bd.org/svn/repos/irssi/repeat',
16 # repeal.pl: ignore repeated messages
18 # for irssi 0.8.5 by bd@bc-bd.org
24 # This script hides repeated lines from:
26 # dude> Plz Help me!!!
27 # dude> Plz Help me!!!
28 # dude> Plz Help me!!!
33 # dude> Plz Help me!!!
36 # Or with 'repeat_show' set to ON:
38 # dude> Plz Help me!!!
39 # Irssi: Message repeated 3 times
46 # /set repeat_show <ON|OFF>
47 # * ON : show info line: 'Message repeated N times'
48 # * OFF : don't show it.
50 # /set repeat_count <N>
51 # N : Display a message N times, then ignore it.
59 # - fix: also check before own message (by Wouter Coekaerts)
62 # - removed stray debug message (duh!)
75 my ($server, $msg, $nick, $address, $target) = @_;
77 my $maxcount = Irssi::settings_get_int('repeat_count');
79 my $window = $server->window_find_item($target);
80 my $refnum = $window->{refnum};
82 my $this = $refnum.$nick.$msg;
84 my $last = $said{$refnum};
85 my $i = $count{$refnum};
87 # $window->print("'$this' '$last' $i");
88 if ($last eq $this and not $nick eq $server->{nick}) {
89 $count{$refnum} = $i +1;
91 if ($i >= $maxcount) {
95 if ($i > $maxcount && Irssi::settings_get_bool('repeat_show')) {
96 $window->print("Message repeated ".($i-1)." times");
100 $said{$refnum} = $this;
105 my ($server, $msg, $target) = @_;
106 sig_public ($server, $msg, $server->{nick}, "", $target);
112 delete($count{$num});
117 my ($window,$old) = @_;
118 my $refnum = $window->{refnum};
120 $count{$refnum} = $count{old};
121 $said{$refnum} = $count{old};
128 remove_window($window->{refnum});
131 Irssi::signal_add('message public', 'sig_public');
132 Irssi::signal_add('message own_public', 'sig_own_public');
133 Irssi::signal_add_last('window refnum changed', 'sig_refnum');
134 Irssi::signal_add_last('window destroyed', 'sig_destroyed');
136 Irssi::settings_add_int('misc', 'repeat_count', 1);
137 Irssi::settings_add_bool('misc', 'repeat_show', 1);