summaryrefslogtreecommitdiff
path: root/scripts/clones.pl
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2001-12-15 13:22:38 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2001-12-15 13:22:38 +0000
commit5e65d392615266b673bec938cbba02e4c8931026 (patch)
tree0144fe91ac8e875f41842ff985cacd5465277c3c /scripts/clones.pl
parent68883efd3e2b15558ed878c67a7555f871ab5715 (diff)
downloadirssi-5e65d392615266b673bec938cbba02e4c8931026.zip
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
Diffstat (limited to 'scripts/clones.pl')
-rw-r--r--scripts/clones.pl19
1 files changed, 15 insertions, 4 deletions
diff --git a/scripts/clones.pl b/scripts/clones.pl
index 45fa2033..59c22c3f 100644
--- a/scripts/clones.pl
+++ b/scripts/clones.pl
@@ -1,10 +1,11 @@
# /CLONES - Display clones in the active channel
+# Modified by Roi Dayan. dejavo@punkass.com
-use Irssi;
use strict;
sub cmd_clones {
my ($data, $server, $channel) = @_;
+ my $min_show_count = ($data =~ /^[0-9]+$/) ? $data : 2;
if (!$channel || $channel->{type} ne "CHANNEL") {
Irssi::print("No active channel in window");
@@ -12,16 +13,26 @@ sub cmd_clones {
}
my %hostnames = {};
+ my %hostnicks = {};
+ my @hosttmp = {};
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;
foreach my $host (keys %hostnames) {
my $clones = $hostnames{$host};
- if ($clones >= 2) {
+ if ($clones >= $min_show_count) {
$channel->print("Clones:") if ($count == 0);
- $channel->print("$host: $clones");
+ $channel->print("$host: $clones $hostnicks{$host}");
$count++;
}
}