From a7c364addbc1f8d04229adaad5b8dcd8308348ba Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 19 Oct 2000 19:41:05 +0000 Subject: [PATCH] Added /CLONES script git-svn-id: http://svn.irssi.org/repos/irssi/trunk@776 dbcabf3a-b0e7-0310-adc4-f8d773084564 --- scripts/Makefile.am | 1 + scripts/clones.pl | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 scripts/clones.pl 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');