blob: 9c8100200321737239e50d1fe8cf19e60bb68a33 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# By Stefan 'tommie' Tomanek
use strict;
use vars qw($VERSION %IRSSI);
$VERSION = "2022112701";
%IRSSI = (
authors => "Stefan 'tommie' Tomanek",
contact => "stefan\@pico.ruhr.de",
name => "CRAPbuster",
description => "Removes CRAP or CLIENTCRAP messages from your buffer",
license => "GPLv2",
changed => "$VERSION",
commands => "crapbuster"
);
# /scrollback levelclear -level crap,clientcrap
use Irssi;
use Irssi::TextUI;
sub cmd_crapbuster ($$$) {
my ($args, $server, $witem) = @_;
my $limit = $args =~ /^\d+$/ ? $args : -1;
my $win = ref $witem ? $witem->window() : Irssi::active_win();
my $view = $win->view;
my $line = $view->get_lines;
$line = $line->next while defined $line->next;
while (defined $line->prev){
last if $limit == 0;
my $level = $line->{info}{level};
my $copy = $line;
$line = $line->prev;
foreach (split / /, Irssi::settings_get_str('crapbuster_levels')) {
next unless (($level & Irssi::level2bits($_)) != 0 );
$view->remove_line($copy);
last;
}
$limit-- if $limit;
}
$view->redraw();
}
Irssi::command_bind('crapbuster', \&cmd_crapbuster);
Irssi::settings_add_str($IRSSI{name}, 'crapbuster_levels', 'CLIENTCRAP CRAP');
|