2002-03-10 16:28:38 -05:00
|
|
|
# Example how to do redirections, we'll grab the output of /WHOIS:
|
|
|
|
|
2000-02-25 12:03:17 -05:00
|
|
|
# /RN - display real name of nick
|
|
|
|
|
|
|
|
use Irssi;
|
2000-10-18 16:50:12 -04:00
|
|
|
use Irssi::Irc;
|
2001-07-16 16:22:45 -04:00
|
|
|
use strict;
|
2002-03-10 16:28:38 -05:00
|
|
|
use vars qw($VERSION %IRSSI);
|
|
|
|
|
|
|
|
$VERSION = "1.00";
|
|
|
|
%IRSSI = (
|
|
|
|
authors => 'Timo Sirainen',
|
|
|
|
name => 'redirect',
|
|
|
|
description => 'Redirection example',
|
|
|
|
license => 'Public Domain'
|
|
|
|
);
|
2000-02-25 12:03:17 -05:00
|
|
|
|
|
|
|
sub cmd_realname {
|
|
|
|
my ($data, $server, $channel) = @_;
|
|
|
|
|
|
|
|
# ignore all whois replies except "No such nick" or the
|
|
|
|
# first line of the WHOIS reply
|
2002-02-10 06:12:05 -05:00
|
|
|
$server->redirect_event('whois', 1, $data, -1, '', {
|
|
|
|
'event 402' => 'event 402',
|
|
|
|
'event 401' => 'event 401',
|
|
|
|
'event 311' => 'redir whois',
|
|
|
|
'' => 'event empty' });
|
|
|
|
|
|
|
|
$server->send_raw("WHOIS :$data");
|
2000-02-25 12:03:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
sub event_rn_whois {
|
2000-12-06 00:42:13 -05:00
|
|
|
my ($num, $nick, $user, $host, $empty, $realname) = split(/ +/, $_[1], 6);
|
2000-02-25 12:03:17 -05:00
|
|
|
$realname =~ s/^://;
|
|
|
|
|
|
|
|
Irssi::print("%_$nick%_ is $realname");
|
|
|
|
}
|
|
|
|
|
2001-02-13 13:19:59 -05:00
|
|
|
Irssi::command_bind('rn', 'cmd_realname');
|
2000-02-25 12:03:17 -05:00
|
|
|
Irssi::signal_add('redir whois', 'event_rn_whois');
|