1 # /AUTOOP <*|#channel> [<nickmasks>]
6 my (%opnicks, %temp_opped);
10 my ($channel, $masks) = split(" ", $data, 2);
14 Irssi::print("Usage: /AUTOOP <*|#channel> [<nickmasks>]");
15 Irssi::print("No-one's being auto-opped currently.");
19 Irssi::print("Currently auto-opping in channels:");
20 foreach $channel (keys %opnicks) {
21 $masks = $opnicks{$channel};
23 if ($channel eq "*") {
24 Irssi::print("All channels: $masks");
26 Irssi::print("$channel: $masks");
34 delete $opnicks{$channel};
36 $opnicks{$channel} = $masks;
38 if ($channel eq "*") {
39 Irssi::print("Now auto-opping in all channels: $masks");
41 Irssi::print("$channel: Now auto-opping: $masks");
46 my ($channel, $masks, @nicks) = @_;
47 my ($server, $nickrec);
49 $server = $channel->{server};
50 foreach $nickrec (@nicks) {
51 my $nick = $nickrec->{nick};
52 my $host = $nickrec->{host};
54 if (!$temp_opped{$nick} &&
55 $server->masks_match($masks, $nick, $host)) {
56 $channel->command("/op $nick");
57 $temp_opped{$nick} = 1;
63 my ($channel, $nicks_list) = @_;
64 my @nicks = @{$nicks_list};
66 return if (!$channel->{chanop});
71 my $masks = $opnicks{$channel->{name}};
72 autoop($channel, $masks, @nicks) if ($masks);
75 $masks = $opnicks{"*"};
76 autoop($channel, $masks, @nicks) if ($masks);
79 Irssi::command_bind('autoop', 'cmd_autoop');
80 Irssi::signal_add_last('massjoin', 'event_massjoin');