diff options
-rw-r--r-- | scripts/Makefile.am | 1 | ||||
-rw-r--r-- | scripts/clones.pl | 26 |
2 files changed, 27 insertions, 0 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am index f528e4d9..542c4700 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -1,6 +1,7 @@ EXTRA_DIST = \ autoop.pl \ autorejoin.pl \ + clones.pl \ hello.pl \ privmsg.pl \ realname.pl \ diff --git a/scripts/clones.pl b/scripts/clones.pl new file mode 100644 index 00000000..a562b968 --- /dev/null +++ b/scripts/clones.pl @@ -0,0 +1,26 @@ +# /CLONES - display real name of nick + +use Irssi; +use Irssi::Irc; + +sub cmd_clones { + my ($data, $server, $channel) = @_; + my %hostnames, $host, @nicks, $nick; + + @nicks = $channel->nicklist_getnicks(); + + foreach $nick (@nicks) { + $hostnames{$nick->values()->{'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'); |