summaryrefslogtreecommitdiffstats
path: root/scripts/idlesince.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/idlesince.pl')
-rw-r--r--scripts/idlesince.pl32
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/idlesince.pl b/scripts/idlesince.pl
new file mode 100644
index 0000000..5e4b112
--- /dev/null
+++ b/scripts/idlesince.pl
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+
+use strict;
+use Irssi;
+use Time::localtime;
+
+use vars qw($VERSION %IRSSI);
+
+$VERSION = "0.1";
+%IRSSI = (
+ authors => "Leszek Matok",
+ contact => "lam\@lac.pl",
+ name => "idlesince",
+ description => "Adds 'idle since' line to whois replies.",
+ license => "GPL",
+ url => "",
+ changed => "17.9.2002",
+);
+
+sub event_server_event {
+ my ($server, $text, $sname) = @_;
+ my @items = split(/ /,$text);
+
+ my $idlesince = ctime(time()-$items[2]);
+ $server->printformat($items[1], MSGLEVEL_CRAP, 'whois_idlesince',
+ $items[1], $idlesince );
+}
+
+Irssi::theme_register([
+ 'whois_idlesince' => '{whois idlesince %|$1}'
+]);
+Irssi::signal_add_last('event 317', 'event_server_event');