summaryrefslogtreecommitdiffstats
path: root/scripts/whois.pl
blob: e6be9176ee9ae52445c51bd6001adc14f094514a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# whois.pl/Irssi/fahren@bochnia.pl

use Irssi;
use strict;

use vars qw($VERSION %IRSSI);
$VERSION = "1.0";
%IRSSI = (
        authors         => "Maciek \'fahren\' Freudenheim",
        contact         => "fahren\@bochnia.pl",
        name            => "cwhois",
        description     => "Hilights \'@\' in whois channel reply",
        license         => "GNU GPLv2 or later",
        changed         => "Fri Mar 15 15:09:42 CET 2002"
);

Irssi::theme_register([
  'cwhois_channels', '{whois channels %|$1}'
]);
  
sub event_cwhois
{
	my ($server, $data) = @_;

	my ($nick, $chans) = $data =~ /([\S]+)\s:(.*)/;

	my $ret;
	foreach my $chan (split(/ /, $chans)) {
		$ret .= (($chan =~ s/^@//)? "\00316@\003" : "") . $chan . " ";
	}

 	chop $ret;
	$server->printformat($nick, MSGLEVEL_CRAP, 'cwhois_channels', $nick, $ret);
    
	Irssi::signal_stop();
}

Irssi::signal_add('event 319', 'event_cwhois');