summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authortomaw2014-06-26 20:51:19 +0100
committertomaw2014-06-26 20:51:19 +0100
commitc4ba83db357996adc7ccca1dee6918ba09207f98 (patch)
treefe9500c0d576b2e40c3bf860bbd8f64188372227 /scripts
parent525b2128888f1e3ca2088a54cc086b102dbfe690 (diff)
parente8207bfa448758ab3e7c27cb83398e1336749edb (diff)
downloadscripts.irssi.org-c4ba83db357996adc7ccca1dee6918ba09207f98.tar.bz2
Merge pull request #18 from crshd/smartfilter
Add smartfilter.pl
Diffstat (limited to 'scripts')
-rw-r--r--scripts/smartfilter.pl36
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/smartfilter.pl b/scripts/smartfilter.pl
new file mode 100644
index 0000000..f82ebb1
--- /dev/null
+++ b/scripts/smartfilter.pl
@@ -0,0 +1,36 @@
+use strict;
+use Irssi;
+use vars qw($VERSION %IRSSI);
+
+$VERSION = "0.1";
+
+%IRSSI = (
+ authors => 'Christian Brassat',
+ contact => 'crshd@mail.com',
+ name => 'smartfilter.pl',
+ description => 'This script hides join/part messages.',
+ license => 'BSD',
+ url => 'http://crshd.github.io',
+ changed => '2012-10-02',
+);
+
+our $lastmsg = {};
+
+sub smartfilter {
+ my ($channel, $nick, $address, $reason) = @_;
+ if ($lastmsg->{$nick} <= time() - Irssi::settings_get_int('smartfilter_delay')) {
+ Irssi::signal_stop();
+ }
+};
+
+sub log {
+ my ($server, $msg, $nick, $address, $target) = @_;
+ $lastmsg->{$nick} = time();
+}
+
+Irssi::signal_add('message public', 'log');
+Irssi::signal_add('message join', 'smartfilter');
+Irssi::signal_add('message part', 'smartfilter');
+Irssi::signal_add('message quit', 'smartfilter');
+
+Irssi::settings_add_int('smartfilter', 'smartfilter_delay', 300);