mirror of
https://github.com/irssi/irssi.git
synced 2024-09-01 04:14:16 -04:00
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@1729 dbcabf3a-b0e7-0310-adc4-f8d773084564
33 lines
692 B
Perl
33 lines
692 B
Perl
# /CLONES - Display clones in the active channel
|
|
|
|
use Irssi;
|
|
use strict;
|
|
|
|
sub cmd_clones {
|
|
my ($data, $server, $channel) = @_;
|
|
|
|
if (!$channel || $channel->{type} ne "CHANNEL") {
|
|
Irssi::print("No active channel in window");
|
|
return;
|
|
}
|
|
|
|
my %hostnames = {};
|
|
foreach my $nick ($channel->nicks()) {
|
|
$hostnames{$nick->{host}}++;
|
|
}
|
|
|
|
my $count = 0;
|
|
foreach my $host (keys %hostnames) {
|
|
my $clones = $hostnames{$host};
|
|
if ($clones >= 2) {
|
|
$channel->print("Clones:") if ($count == 0);
|
|
$channel->print("$host: $clones");
|
|
$count++;
|
|
}
|
|
}
|
|
|
|
$channel->print("No clones in channel") if ($count == 0);
|
|
}
|
|
|
|
Irssi::command_bind('clones', 'cmd_clones');
|