#!/usr/bin/perl
# (c) 2002 by Rhonda D'Vine <rhonda@deb.at>

use Irssi qw(signal_add signal_stop);
use strict;
use vars qw($VERSION %IRSSI);

$VERSION = '0.8.1';

%IRSSI = (
  'authors'     => "Rhonda D'Vine",
  'contact'     => 'rhonda@deb.at',
  'name'        => 'mute',
  'description' => 'mutes +v people in a channel',
  'url'         => 'http://rhonda.deb.at/projects/irssi/scripts/mute.pl',
  'license'     => 'GNU GPL v2',
  'changed'     => '2002-04-04'
);

# mutes +v people in a channel.  In some channel annoying people are set +v
#     Lot of thanks goes to cras from #irssi on opn

my $statusfile = "$ENV{'HOME'}/.irssi/mute.rc";

my @channels;

sub startup {
   open STATUS, "<$statusfile" || die "$0: can't read $statusfile: $!\n";
   while (<STATUS>) {
      chomp;
      my ($ircnet, $channel) = split /:/;
      push @channels, $channel;
   }
   close STATUS;
}


sub sig_public {
	my ($server, $msg, $nick, $address, $target) = @_;
   signal_stop()
      if $server->channel_find($target)->nick_find($nick)->{voice} &&
         $target eq "#debian.de";
}


startup;

signal_add('message public', 'sig_public');
