summaryrefslogtreecommitdiff
path: root/scripts/clones.pl
blob: 27b5a1b145366245e6fec5442ee8b5c45b713428 (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
# /CLONES - display real name of nick

use Irssi;

sub cmd_clones {
	my ($data, $server, $channel) = @_;
	my %hostnames, $host, @nicks, $nick;

	@nicks = $channel->nicks();

	foreach $nick (@nicks) {
		$hostnames{$nick->{host}}++;
	}

	$channel->print("Clones:");
	foreach $host (keys %hostnames) {
		my $clones = $hostnames{$host};
		if ($clones >= 2) {
			$channel->print("$host: $clones");
		}
	}
	return 1;
}

Irssi::command_bind('clones', 'cmd_clones');