summaryrefslogtreecommitdiffstats
path: root/scripts/crapbuster.pl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:19:02 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 20:19:02 +0000
commit03929dac2a29664878d2c971648a4fe1fb698462 (patch)
tree02c5e2b3e006234aa29545f7a93a1ce01b291a8b /scripts/crapbuster.pl
parentInitial commit. (diff)
downloadirssi-scripts-03929dac2a29664878d2c971648a4fe1fb698462.tar.xz
irssi-scripts-03929dac2a29664878d2c971648a4fe1fb698462.zip
Adding upstream version 20231031.upstream/20231031upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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');