line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bot::Cobalt::Plugin::Silly::AutoOpAll; |
2
|
|
|
|
|
|
|
$Bot::Cobalt::Plugin::Silly::AutoOpAll::VERSION = '0.031002'; |
3
|
1
|
|
|
1
|
|
911
|
use strictures 2; |
|
1
|
|
|
|
|
1141
|
|
|
1
|
|
|
|
|
31
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
530
|
use Object::Pluggable::Constants ':ALL'; |
|
1
|
|
|
|
|
256
|
|
|
1
|
|
|
|
|
108
|
|
6
|
1
|
|
|
1
|
|
516
|
use IRC::Utils 'lc_irc'; |
|
1
|
|
|
|
|
14555
|
|
|
1
|
|
|
|
|
429
|
|
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
0
|
317
|
sub new { bless +{}, shift } |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub Cobalt_register { |
11
|
0
|
|
|
0
|
0
|
|
my ($self, $core) = splice @_, 0, 2; |
12
|
|
|
|
|
|
|
|
13
|
0
|
|
|
|
|
|
$core->plugin_register( $self, SERVER => |
14
|
|
|
|
|
|
|
'user_joined', |
15
|
|
|
|
|
|
|
'public_cmd_aopall', |
16
|
|
|
|
|
|
|
); |
17
|
|
|
|
|
|
|
|
18
|
0
|
|
|
|
|
|
$core->log->info("Loaded"); |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
PLUGIN_EAT_NONE |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub Cobalt_unregister { |
24
|
0
|
|
|
0
|
0
|
|
my ($self, $core) = splice @_, 0, 2; |
25
|
0
|
|
|
|
|
|
$core->log->info("Unloaded"); |
26
|
0
|
|
|
|
|
|
PLUGIN_EAT_NONE |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
sub Bot_public_cmd_aopall { |
31
|
0
|
|
|
0
|
0
|
|
my ($self, $core) = splice @_, 0, 2; |
32
|
0
|
|
|
|
|
|
my $msg = ${ $_[0] }; |
|
0
|
|
|
|
|
|
|
33
|
0
|
|
|
|
|
|
my $context = $msg->context; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
## !aopall #chan |
36
|
|
|
|
|
|
|
## !aopall -#chan |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $nick = $msg->src_nick; |
39
|
0
|
|
|
|
|
|
my $lev = $core->auth->level($context, $nick); |
40
|
0
|
0
|
|
|
|
|
return PLUGIN_EAT_ALL unless $lev >= 3; |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
0
|
|
|
|
my $casemap = $core->get_irc_casemap($context) || 'rfc1459' ; |
43
|
0
|
|
|
|
|
|
my $chan = $msg->message_array->[0]; |
44
|
0
|
|
|
|
|
|
$chan = lc_irc($chan, $casemap); |
45
|
|
|
|
|
|
|
|
46
|
0
|
0
|
|
|
|
|
if ( index($chan, '-') == 0 ) { |
47
|
|
|
|
|
|
|
# Deletion |
48
|
0
|
|
|
|
|
|
$chan = substr($chan, 1); |
49
|
0
|
|
|
|
|
|
my $resp; |
50
|
0
|
0
|
|
|
|
|
if (delete $self->{$context}->{$chan}) { |
51
|
0
|
|
|
|
|
|
$resp = "No longer autoopping on $chan"; |
52
|
|
|
|
|
|
|
} else { |
53
|
0
|
|
|
|
|
|
$resp = "No such chan ($chan) found"; |
54
|
|
|
|
|
|
|
} |
55
|
0
|
|
|
|
|
|
$core->send_event( notice => $context, $nick, $resp ); |
56
|
|
|
|
|
|
|
} else { |
57
|
0
|
|
|
|
|
|
$self->{$context}->{$chan} = 1; |
58
|
0
|
|
|
|
|
|
$core->send_event( notice => $context, $nick, |
59
|
|
|
|
|
|
|
"AutoOpping all on $chan" |
60
|
|
|
|
|
|
|
); |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
PLUGIN_EAT_ALL |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
sub Bot_user_joined { |
67
|
0
|
|
|
0
|
0
|
|
my ($self, $core) = splice @_, 0, 2; |
68
|
0
|
|
|
|
|
|
my $joined = ${ $_[0] }; |
|
0
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my $context = $joined->context; |
71
|
0
|
|
|
|
|
|
my $chan = $joined->channel; |
72
|
0
|
|
|
|
|
|
my $nick = $joined->src_nick; |
73
|
|
|
|
|
|
|
|
74
|
0
|
|
0
|
|
|
|
my $casemap = $core->get_irc_casemap($context) || 'rfc1459' ; |
75
|
0
|
|
|
|
|
|
$chan = lc_irc($chan, $casemap); |
76
|
|
|
|
|
|
|
|
77
|
0
|
0
|
|
|
|
|
if (exists $self->{$context}->{$chan}) { |
78
|
0
|
|
|
|
|
|
$core->send_event( mode => $context, $chan, "+o $nick" ); |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
PLUGIN_EAT_NONE |
82
|
0
|
|
|
|
|
|
} |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
1; |
85
|
|
|
|
|
|
|
__END__ |