#!/usr/bin/perl
use strict;
use Irssi;
use Time::localtime;
use vars qw($VERSION %IRSSI);
$VERSION = "0.5";
%IRSSI = (
authors => "Leszek Matok, David O\'Rourke",
contact => "lam\@lac.pl, phyber\@#irssi",
name => "idlesince",
description => "Adds 'idle since' line to whois replies.",
license => "GPL",
url => "",
changed => "22.09.2005",
);
sub idle_whois_handler {
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 );
}
sub whois_handler {
my ($server, $data, $snick, $sender) = @_;
my $numeric = $server->parse_special('$H');
if ($numeric eq '317') { &idle_whois_handler }
}
Irssi::theme_register([
'whois_idlesince' => '{whois idlesince %|$1}'
]);
Irssi::signal_add_last('whois default event', 'whois_handler');
###############
## ChangeLog ##
###############
## 22.09.2005
# Change to work with latest irssi versions (CVS/SVN)