| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package POE::Component::Server::IRC::Plugin::OperServ; |
|
2
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:BINGOS'; |
|
3
|
|
|
|
|
|
|
$POE::Component::Server::IRC::Plugin::OperServ::VERSION = '1.61'; # TRIAL |
|
4
|
2
|
|
|
2
|
|
3614
|
use strict; |
|
|
2
|
|
|
|
|
5
|
|
|
|
2
|
|
|
|
|
71
|
|
|
5
|
2
|
|
|
2
|
|
11
|
use warnings; |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
72
|
|
|
6
|
2
|
|
|
2
|
|
12
|
use POE::Component::Server::IRC::Plugin qw(:ALL); |
|
|
2
|
|
|
|
|
4
|
|
|
|
2
|
|
|
|
|
1466
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub new { |
|
9
|
1
|
|
|
1
|
1
|
22
|
my ($package, %args) = @_; |
|
10
|
1
|
|
|
|
|
17
|
return bless \%args, $package; |
|
11
|
|
|
|
|
|
|
} |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub PCSI_register { |
|
14
|
1
|
|
|
1
|
0
|
133
|
my ($self, $ircd) = splice @_, 0, 2; |
|
15
|
|
|
|
|
|
|
|
|
16
|
1
|
|
|
|
|
12
|
$ircd->plugin_register($self, 'SERVER', qw(daemon_privmsg daemon_join)); |
|
17
|
1
|
|
|
|
|
90
|
$ircd->yield( |
|
18
|
|
|
|
|
|
|
'add_spoofed_nick', |
|
19
|
|
|
|
|
|
|
{ |
|
20
|
|
|
|
|
|
|
nick => 'OperServ', |
|
21
|
|
|
|
|
|
|
umode => 'Doi', |
|
22
|
|
|
|
|
|
|
ircname => 'The OperServ bot', |
|
23
|
|
|
|
|
|
|
}, |
|
24
|
|
|
|
|
|
|
); |
|
25
|
1
|
|
|
|
|
134
|
return 1; |
|
26
|
|
|
|
|
|
|
} |
|
27
|
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub PCSI_unregister { |
|
29
|
1
|
|
|
1
|
0
|
338
|
return 1; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub IRCD_daemon_privmsg { |
|
33
|
2
|
|
|
2
|
0
|
108
|
my ($self, $ircd) = splice @_, 0, 2; |
|
34
|
2
|
|
|
|
|
6
|
my $nick = (split /!/, ${ $_[0] })[0]; |
|
|
2
|
|
|
|
|
12
|
|
|
35
|
|
|
|
|
|
|
|
|
36
|
2
|
50
|
|
|
|
24
|
return PCSI_EAT_NONE if !$ircd->state_user_is_operator($nick); |
|
37
|
2
|
|
|
|
|
5
|
my $request = ${ $_[2] }; |
|
|
2
|
|
|
|
|
5
|
|
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
SWITCH: { |
|
40
|
2
|
100
|
|
|
|
4
|
if (my ($chan) = $request =~ /^clear\s+(#.+)\s*$/i) { |
|
|
2
|
|
|
|
|
21
|
|
|
41
|
1
|
50
|
|
|
|
7
|
last SWITCH if !$ircd->state_chan_exists($chan); |
|
42
|
1
|
|
|
|
|
18
|
$ircd->yield('daemon_cmd_sjoin', 'OperServ', $chan); |
|
43
|
1
|
|
|
|
|
121
|
last SWITCH; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
1
|
50
|
|
|
|
16
|
if (my ($chan) = $request =~ /^join\s+(#.+)\s*$/i) { |
|
46
|
1
|
50
|
|
|
|
7
|
last SWITCH if !$ircd->state_chan_exists($chan); |
|
47
|
1
|
|
|
|
|
7
|
$ircd->yield('daemon_cmd_join', 'OperServ', $chan); |
|
48
|
1
|
|
|
|
|
108
|
last SWITCH; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
0
|
0
|
|
|
|
0
|
if (my ($chan) = $request =~ /^part\s+(#.+)\s*$/i) { |
|
51
|
0
|
0
|
|
|
|
0
|
last SWITCH unless $ircd->state_chan_exists($chan); |
|
52
|
0
|
|
|
|
|
0
|
$ircd->yield('daemon_cmd_part', 'OperServ', $chan); |
|
53
|
0
|
|
|
|
|
0
|
last SWITCH; |
|
54
|
|
|
|
|
|
|
} |
|
55
|
0
|
0
|
|
|
|
0
|
if (my ($chan, $mode) = $request =~ /^mode\s+(#.+)\s+(.+)\s*$/i) { |
|
56
|
0
|
0
|
|
|
|
0
|
last SWITCH if !$ircd->state_chan_exists($chan); |
|
57
|
0
|
|
|
|
|
0
|
$ircd->yield('daemon_cmd_mode', 'OperServ', $chan, $mode); |
|
58
|
0
|
|
|
|
|
0
|
last SWITCH; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
0
|
0
|
|
|
|
0
|
if (my ($chan, $target) = $request =~ /^op\s+(#.+)\s+(.+)\s*$/i) { |
|
61
|
0
|
0
|
|
|
|
0
|
last SWITCH unless $ircd->state_chan_exists($chan); |
|
62
|
0
|
|
|
|
|
0
|
$ircd->daemon_server_mode($chan, '+o', $target); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
} |
|
65
|
|
|
|
|
|
|
|
|
66
|
2
|
|
|
|
|
9
|
return PCSI_EAT_NONE; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
sub IRCD_daemon_join { |
|
70
|
5
|
|
|
5
|
0
|
288
|
my ($self, $ircd) = splice @_, 0, 2; |
|
71
|
5
|
|
|
|
|
14
|
my $nick = (split /!/, ${ $_[0] })[0]; |
|
|
5
|
|
|
|
|
33
|
|
|
72
|
5
|
100
|
66
|
|
|
30
|
if (!$ircd->state_user_is_operator($nick) || $nick eq 'OperServ') { |
|
73
|
3
|
|
|
|
|
14
|
return PCSI_EAT_NONE; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
2
|
|
|
|
|
4
|
my $channel = ${ $_[1] }; |
|
|
2
|
|
|
|
|
6
|
|
|
76
|
2
|
50
|
|
|
|
14
|
return PCSI_EAT_NONE if $ircd->state_is_chan_op($nick, $channel); |
|
77
|
0
|
|
|
|
|
|
$ircd->daemon_server_mode($channel, '+o', $nick); |
|
78
|
0
|
|
|
|
|
|
return PCSI_EAT_NONE; |
|
79
|
|
|
|
|
|
|
} |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
1; |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=encoding utf8 |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 NAME |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
POE::Component::Server::IRC::Plugin::OperServ - An OperServ plugin for POE::Component::Server::IRC |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
use POE::Component::Server::IRC::Plugin::OperServ; |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
$ircd->plugin_add( |
|
94
|
|
|
|
|
|
|
'OperServ', |
|
95
|
|
|
|
|
|
|
POE::Component::Server::IRC::Plugin::OperServ->new(), |
|
96
|
|
|
|
|
|
|
); |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
POE::Component::Server::IRC::Plugin::OperServ is a |
|
101
|
|
|
|
|
|
|
L plugin which |
|
102
|
|
|
|
|
|
|
provides simple operator services. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This plugin provides a server user called OperServ. OperServ accepts |
|
105
|
|
|
|
|
|
|
PRIVMSG commands from operators. |
|
106
|
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
/msg OperServ |
|
108
|
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
=head1 METHODS |
|
110
|
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=head2 C |
|
112
|
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
Returns a plugin object suitable for feeding to |
|
114
|
|
|
|
|
|
|
L's C |
|
115
|
|
|
|
|
|
|
method. |
|
116
|
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 COMMANDS |
|
118
|
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
The following commands are accepted: |
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head2 clear CHANNEL |
|
122
|
|
|
|
|
|
|
|
|
123
|
|
|
|
|
|
|
The OperServ will remove all channel modes on the indicated channel, |
|
124
|
|
|
|
|
|
|
including all users' +ov flags. The timestamp of the channel will be reset |
|
125
|
|
|
|
|
|
|
and the OperServ will join that channel with +o. |
|
126
|
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 join CHANNEL |
|
128
|
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
The OperServ will simply join the channel you specify with +o. |
|
130
|
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head2 part CHANNEL |
|
132
|
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
The OperServ will part (leave) the channel specified. |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
=head2 mode CHANNEL MODE |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
The OperServ will set the channel mode you tell it to. You can also remove |
|
138
|
|
|
|
|
|
|
the channel mode by prefixing the mode with a '-' (minus) sign. |
|
139
|
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 op CHANNEL USER |
|
141
|
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
The OperServ will give +o to any user on a channel you specify. OperServ |
|
143
|
|
|
|
|
|
|
does not need to be in that channel (as this is mostly a server hack). |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Whenever the OperServ joins a channel (which you specify with the join |
|
146
|
|
|
|
|
|
|
command) it will automatically gain +o. |
|
147
|
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 AUTHOR |
|
149
|
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
Chris 'BinGOs' Williams |
|
151
|
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=head1 LICENSE |
|
153
|
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
Copyright C<(c)> Chris Williams |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
This module may be used, modified, and distributed under the same terms as |
|
157
|
|
|
|
|
|
|
Perl itself. Please see the license that came with your Perl distribution |
|
158
|
|
|
|
|
|
|
for details. |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
L |
|
163
|
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=cut |