Kick.pm

filter: Statementstmt 45.6% 26 / 57 Branchbran 5.0% 1 / 20 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 42.8% 6 / 14 Podpod 0.0% 0 / 3 totaltotal 31.7% 33 / 104 CC 13 SCAR 22.4
CC
13
Cov
33%
kb
20.0
kbtmp
20.0
__ANON__
12.0
CRAP 9.4
« LimitMan.pm ↑ Summary LckHash.pm »
1 # $Id: Kick.pm,v 1.5 2000-06-30 23:53:02-04 roderick Exp $
2 #
3 # Copyright (c) 1997-2000 Roderick Schertler. All rights reserved.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the same terms as Perl itself.
6  
7 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 package Sirc::Kick;
10  
11 1 ▶use Exporter ();
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Sirc::Chantrack qw(%Chan_op);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Sirc::Util qw(addcmd arg_count_error ban_pattern docommand
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 have_ops optional_channel timer userhost xtell);
15  
16 1 ▶use vars qw($VERSION @ISA @EXPORT_OK $Debug);
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 1 ▶BEGIN {
Subroutine BEGIN: called CC=2 SCAR=7.0
19 1 $VERSION = do{my@r=q$Revision: 1.5 $=~/\d+/g;sprintf '%d.'.'%03d'x$#r,@r};
20 1 ▶ $VERSION .= '-l' if q$Locker: $ =~ /: \S/;
Branch: 1 branch
BranchTrueFalseTotal
if "Locker: " =~ /: \S/ 0 1 1
21  
22 # ban_pattern() is exportable because it used to live here.
23 1 @ISA = qw(Exporter);
24 1 @EXPORT_OK = qw(ban_pattern kb kbtmp);
25 1 $Debug = 0;
26 }
27  
28 0 ▶sub debug {
Subroutine debug: not called CC=2 SCAR=17.9
Pod undocumented
29 0 ▶ xtell 'kick debug ' . join '', @_
Branch: 1 branch
BranchTrueFalseTotal
if $Sirc::Kick::Debug 0 0 0
30 if $Debug;
31 }
32  
33 0 ▶sub kb {
Subroutine kb: not called CC=4 SCAR=30.0
Pod undocumented
34 0 debug "kb @_";
35 0 ▶ unless (@_ == 2 || @_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@_ == 2 or @_ == 3) 0 0 0
Condition0%0/3
@_ == 2 or @_ == 3
l!l&&r!l&&!r
000
MC/DC0%0/2
@_ == 2 or @_ == 3
@_ == 2 @_ == 3
Truth table0%0/3
A or B
A= @_ == 2B= @_ == 3
ABresult
1X1
011
000
36 0 arg_count_error undef, '2 or 3', @_;
37 0 return;
38 }
39 0 my ($channel, $n, $reason) = @_;
40 0 ▶ have_ops $channel or return;
Branch: 1 branch
BranchTrueFalseTotal
have_ops($channel) or return 0 0 0
41 0 ▶ userhost $n, sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
42 0 my $pattern = ban_pattern $::who, $::user, $::host;
43 0 docommand "^alias unban mode $channel -b $pattern";
44 0 docommand "mode $channel -o+b $::who $pattern";
45 0 docommand "kick $channel $::who $reason";
46 0 };
47 }
48 1 docommand "^alias unban /eval Sirc::Util::tell_question 'No previous pattern'";
49  
50 # kickban, /kb [channel] nick reason
51  
52 0 ▶sub main::cmd_kb {
Subroutine cmd_kb: not called CC=2 SCAR=17.9
53 0 debug "cmd_kb $::args";
54 0 ▶ optional_channel or return;
Branch: 1 branch
BranchTrueFalseTotal
optional_channel() or return 0 0 0
55 0 kb split ' ', $::args, 3;
56 }
57 1 addcmd 'kb';
58  
59 # kbtmp channel nick reason
60  
61 0 ▶sub kbtmp {
Subroutine kbtmp: not called CC=4 SCAR=30.0
Pod undocumented
62 0 debug "kbtmp @_";
63 0 ▶ unless (@_ == 2 || @_ == 3) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@_ == 2 or @_ == 3) 0 0 0
Condition0%0/3
@_ == 2 or @_ == 3
l!l&&r!l&&!r
000
MC/DC0%0/2
@_ == 2 or @_ == 3
@_ == 2 @_ == 3
Truth table0%0/3
A or B
A= @_ == 2B= @_ == 3
ABresult
1X1
011
000
64 0 arg_count_error undef, '2 or 3', @_;
65 0 return;
66 }
67 0 my ($channel, $n, $reason) = @_;
68 0 ▶ have_ops $channel or return;
Branch: 1 branch
BranchTrueFalseTotal
have_ops($channel) or return 0 0 0
69 0 ▶ userhost $n, sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
70 0 my $pattern = "$n!*\@*";
71 0 my $op = $Chan_op{$channel}{$n};
72 0 ▶ docommand "mode $channel "
Branch: 2 branches
BranchTrueFalseTotal
$op ? : 0 0 0
$op ? : 0 0 0
73 . ($op ? '-o' : '')
74 . '+b'
75 . ($op ? " $n": '')
76 . " $pattern";
77 0 docommand "kick $channel $n $reason";
78 0 ▶ timer 10, sub { docommand "mode $channel -b $pattern" };
Subroutine __ANON__: not called CC=1 SCAR=6.9
79 0 };
80 }
81  
82 # /k [channel] nick comment
83  
84 0 ▶sub main::cmd_k {
Subroutine cmd_k: not called CC=2 SCAR=17.9
85 0 debug "cmd_k $::args";
86 0 ▶ optional_channel or return;
Branch: 1 branch
BranchTrueFalseTotal
optional_channel() or return 0 0 0
87 0 kbtmp split ' ', $::args, 3;
88 }
89 1 addcmd 'k';
90  
91 1 1;
« LimitMan.pm ↑ Summary LckHash.pm »