summaryrefslogtreecommitdiffstats
path: root/scripts/crapbuster.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/crapbuster.pl')
-rw-r--r--scripts/crapbuster.pl45
1 files changed, 45 insertions, 0 deletions
diff --git a/scripts/crapbuster.pl b/scripts/crapbuster.pl
new file mode 100644
index 0000000..9c81002
--- /dev/null
+++ b/scripts/crapbuster.pl
@@ -0,0 +1,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');