summaryrefslogtreecommitdiffstats
path: root/scripts/noticemove.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/noticemove.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/noticemove.pl')
-rw-r--r--scripts/noticemove.pl49
1 files changed, 49 insertions, 0 deletions
diff --git a/scripts/noticemove.pl b/scripts/noticemove.pl
new file mode 100644
index 0000000..781d42d
--- /dev/null
+++ b/scripts/noticemove.pl
@@ -0,0 +1,49 @@
+# 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.
+# for irssi 0.7.99 by Timo Sirainen
+
+# v1.01 - history:
+# - fixed infinite loop when you weren't connected to server :)
+
+use strict;
+use Irssi;
+use vars qw($VERSION %IRSSI);
+$VERSION = "1.01";
+%IRSSI = (
+ authors => "Timo Sirainen",
+ contact => "tss\@iki.fi",
+ name => "notice move",
+ 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.",
+ license => "Public Domain",
+ url => "http://irssi.org/",
+ changed => "2002-03-04T22:47+0100",
+ changes => "v1.01 - fixed infinite loop when you weren't connected to server :)"
+);
+
+my $insig = 0;
+
+sub sig_print_text {
+ my ($dest, $text, $stripped) = @_;
+ my $server = $dest->{server};
+
+ # ignore non-notices and notices in channels
+ return if (!$server ||
+ !($dest->{level} & MSGLEVEL_NOTICES) ||
+ $server->ischannel($dest->{target}));
+
+ return if ($insig);
+ $insig = 1;
+
+ # print the notice in the first channel the sender is joined
+ foreach my $channel ($server->channels()) {
+ if ($channel->nick_find($dest->{target})) {
+ $channel->print($text, MSGLEVEL_NOTICES);
+ Irssi::signal_stop();
+ last;
+ }
+ }
+
+ $insig = 0;
+}
+
+Irssi::signal_add('print text', 'sig_print_text');