#!/usr/bin/perl
#use strict;
#use warnings;
use Irssi;
use Irssi::Irc;

$VERSION = '1.0';
%Irssi = (
        authors => 'Michał Mirosław <mirqus@freebsd.lublin.pl>',
        name => 'novoice',
        description => 'voice remover',
        license => 'GPL'
);

sub cmd_novoice
{
        my ($data, $server, $witem) = @_;
        return if !$server || !$witem || $witem->{type} ne "CHANNEL";

        my @voicelist;
        foreach($witem->nicks) {
                push @voicelist, $_->{nick} if $_->{voice};
        }

        $witem->command(join(' ', 'DEVOICE', @voicelist)) if @voicelist;
}

Irssi::command_bind(novoice => 'cmd_novoice');
