mirror of
https://github.com/irssi/irssi.git
synced 2024-12-04 14:46:39 -05:00
Updated to ignore the ident, and added optional parameter to specify the
minimum number of clones to show from host. git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2250 dbcabf3a-b0e7-0310-adc4-f8d773084564
This commit is contained in:
parent
68883efd3e
commit
5e65d39261
@ -1,10 +1,11 @@
|
|||||||
# /CLONES - Display clones in the active channel
|
# /CLONES - Display clones in the active channel
|
||||||
|
# Modified by Roi Dayan. dejavo@punkass.com
|
||||||
|
|
||||||
use Irssi;
|
|
||||||
use strict;
|
use strict;
|
||||||
|
|
||||||
sub cmd_clones {
|
sub cmd_clones {
|
||||||
my ($data, $server, $channel) = @_;
|
my ($data, $server, $channel) = @_;
|
||||||
|
my $min_show_count = ($data =~ /^[0-9]+$/) ? $data : 2;
|
||||||
|
|
||||||
if (!$channel || $channel->{type} ne "CHANNEL") {
|
if (!$channel || $channel->{type} ne "CHANNEL") {
|
||||||
Irssi::print("No active channel in window");
|
Irssi::print("No active channel in window");
|
||||||
@ -12,16 +13,26 @@ sub cmd_clones {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my %hostnames = {};
|
my %hostnames = {};
|
||||||
|
my %hostnicks = {};
|
||||||
|
my @hosttmp = {};
|
||||||
foreach my $nick ($channel->nicks()) {
|
foreach my $nick ($channel->nicks()) {
|
||||||
$hostnames{$nick->{host}}++;
|
my @hosttmp = split(/\@/,$nick->{host});
|
||||||
|
$hostnames{$hosttmp[1]}++;
|
||||||
|
$hostnicks{$hosttmp[1]} = $hostnicks{$hosttmp[1]}.$hostnames{$hosttmp[1]}.". ".$nick->{nick}."!".$nick->{host}."\n";
|
||||||
|
$hostnicks{$hosttmp[1]} =~ s/^,//;
|
||||||
|
# $hostnicks{$hosttmp[1]} =~ s/\n$//;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach my $nick (keys %hostnicks) {
|
||||||
|
$hostnicks{$nick} =~ s/\n$//;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $count = 0;
|
my $count = 0;
|
||||||
foreach my $host (keys %hostnames) {
|
foreach my $host (keys %hostnames) {
|
||||||
my $clones = $hostnames{$host};
|
my $clones = $hostnames{$host};
|
||||||
if ($clones >= 2) {
|
if ($clones >= $min_show_count) {
|
||||||
$channel->print("Clones:") if ($count == 0);
|
$channel->print("Clones:") if ($count == 0);
|
||||||
$channel->print("$host: $clones");
|
$channel->print("$host: $clones $hostnicks{$host}");
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user