| 1 | # You may distribute under the terms of the GNU General Public License | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # | ||||||||||||||||||||||||||||||||||||||||||
| 3 | # (C) Paul Evans, 2008-2013 -- leonerd@leonerd.org.uk | ||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||
| 5 | package Circle::Net::IRC::Channel; | ||||||||||||||||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 4 | ▶ | use 5.010; # // | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 4 | ▶ | use base qw( Circle::Net::IRC::Target ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 4 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | 4 | ▶ | use Circle::TaggedString; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||
| 16 | 4 | ▶ | use Circle::Widget::Box; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 4 | ▶ | use Circle::Widget::Entry; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 4 | ▶ | use Circle::Widget::Label; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 4 | ▶ | use POSIX qw( strftime ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 4 | ▶ | use constant STATE_UNJOINED => 0; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 4 | ▶ | use constant STATE_JOINING => 1; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 4 | ▶ | use constant STATE_JOINED => 2; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | 4 | ▶ | use constant STATE_PARTING => 3; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | sub new | ||||||||||||||||||||||||||||||||||||||||||
| 28 | { | ||||||||||||||||||||||||||||||||||||||||||
| 29 | 0 | ▶ | my $class = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 30 | 0 | my $self = $class->SUPER::new( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | $self->{state} = STATE_UNJOINED; | |||||||||||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | sub init_prop_occupant_summary | ||||||||||||||||||||||||||||||||||||||||||
| 38 | { | ||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | return { total => 0 }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
init_prop_occupant_summary: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | sub on_connected | ||||||||||||||||||||||||||||||||||||||||||
| 43 | { | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_connected: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | $self->SUPER::on_connected; | |||||||||||||||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | if( $self->{autojoin} || $self->{rejoin_on_connect} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"autojoin"} or $self->{"rejoin_on_connect"}
MC/DC0%0/2
$self->{"autojoin"} or $self->{"rejoin_on_connect"}
$self->{"autojoin"}
$self->{"rejoin_on_connect"}
Truth table0%0/3
A or B
A= $self->{"autojoin"}B= $self->{"rejoin_on_connect"}
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | $self->join( | ||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | on_joined => sub { undef $self->{rejoin_on_connect} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | # TODO: something about errors | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||
| 53 | } | ||||||||||||||||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||||||||||||||||
| 55 | sub on_disconnected | ||||||||||||||||||||||||||||||||||||||||||
| 56 | { | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_disconnected: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 0 | $self->SUPER::on_disconnected( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||
| 60 | 0 | ▶ | $self->{rejoin_on_connect} = 1 if $self->{state} == STATE_JOINED; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | $self->{state} = STATE_UNJOINED; | |||||||||||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||||||||||||
| 65 | sub join | ||||||||||||||||||||||||||||||||||||||||||
| 66 | { | ||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
join: not called CC=5 SCAR=34.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||
| 70 | 0 | my $on_joined = $args{on_joined}; | |||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | ref $on_joined eq "CODE" or croak "Expected 'on_joined' as CODE ref"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | $self->{state} == STATE_UNJOINED or | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | croak "Cannot join except in UNJOINED state"; | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | 0 | $self->{state} = STATE_JOINING; | |||||||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | ▶ | my $key = $args{key} // $self->{key}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$args{"key"} // $self->{"key"}
MC/DC0%0/2
$args{"key"} // $self->{"key"}
$args{"key"}
$self->{"key"}
Truth table0%0/3
A // B
A= $args{"key"}B= $self->{"key"}
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | my $irc = $self->{irc}; | |||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | $irc->send_message( "JOIN", undef, $self->get_prop_name, defined $key ? ( $key ) : () ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | $self->{on_joined} = $on_joined; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | $self->{on_join_error} = $args{on_join_error}; | |||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | sub kick | ||||||||||||||||||||||||||||||||||||||||||
| 88 | { | ||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
kick: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | my ( $nick, $message ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | my $irc = $self->{irc}; | |||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | $irc->send_message( "KICK", undef, $self->get_prop_name, $nick, $message ); | |||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | sub mode | ||||||||||||||||||||||||||||||||||||||||||
| 97 | { | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mode: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | my ( $modestr, @args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | my $irc = $self->{irc}; | |||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | $irc->send_message( "MODE", undef, $self->get_prop_name, $modestr, @args ); | |||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | sub method_mode | ||||||||||||||||||||||||||||||||||||||||||
| 106 | { | ||||||||||||||||||||||||||||||||||||||||||
| 107 | 0 | ▶ | my $self = shift; my $ctx = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_mode: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 108 | 0 | my ( $modestr, $argsarray ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | $self->mode( $modestr, @$argsarray ); | |||||||||||||||||||||||||||||||||||||||||
| 110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||||||||||||
| 112 | sub part | ||||||||||||||||||||||||||||||||||||||||||
| 113 | { | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
part: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | my %args = @_; | |||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | my $on_parted = $args{on_parted}; | |||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | ref $on_parted eq "CODE" or croak "Expected 'on_parted' as CODE ref"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | ▶ | $self->{state} == STATE_JOINED or | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 121 | croak "Cannot part except in JOINED state"; | ||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | $self->{state} = STATE_PARTING; | |||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my $irc = $self->{irc}; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | $irc->send_message( "PART", undef, $self->get_prop_name, defined $args{message} ? $args{message} : ( "" ) ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | $self->{on_parted} = $on_parted; | |||||||||||||||||||||||||||||||||||||||||
| 129 | } | ||||||||||||||||||||||||||||||||||||||||||
| 130 | |||||||||||||||||||||||||||||||||||||||||||
| 131 | sub topic | ||||||||||||||||||||||||||||||||||||||||||
| 132 | { | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
topic: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | my ( $topic ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||
| 136 | 0 | my $irc = $self->{irc}; | |||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | $irc->send_message( "TOPIC", undef, $self->get_prop_name, $topic ); | |||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | sub method_topic | ||||||||||||||||||||||||||||||||||||||||||
| 141 | { | ||||||||||||||||||||||||||||||||||||||||||
| 142 | 0 | ▶ | my $self = shift; my $ctx = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
method_topic: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | $self->topic( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 144 | } | ||||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | sub user_leave | ||||||||||||||||||||||||||||||||||||||||||
| 147 | { | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
user_leave: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my ( $nick_folded ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | $self->del_prop_occupants( $nick_folded ); | |||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $self->post_update_occupants; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | |||||||||||||||||||||||||||||||||||||||||||
| 155 | sub gen_modestr | ||||||||||||||||||||||||||||||||||||||||||
| 156 | { | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gen_modestr: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | # This is a dynamic property | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | my $mode = $self->get_prop_mode; | |||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||
| 163 | # Order the mode as the server declares | ||||||||||||||||||||||||||||||||||||||||||
| 164 | |||||||||||||||||||||||||||||||||||||||||||
| 165 | 0 | my $irc = $self->{irc}; | |||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | my $channelmodes = $irc->server_info( "channelmodes" ); | |||||||||||||||||||||||||||||||||||||||||
| 167 | |||||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my @modes = sort { index( $channelmodes, $a ) <=> index( $channelmodes, $b ) } keys %$mode; | |||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | my $str = "+"; | |||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | my @args; | |||||||||||||||||||||||||||||||||||||||||
| 172 | |||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | foreach my $modechar ( @modes ) { | |||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | $str .= $modechar; | |||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | ▶ | push @args, $mode->{$modechar} if length $mode->{$modechar}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | } | ||||||||||||||||||||||||||||||||||||||||||
| 177 | |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | return CORE::join( " ", $str, @args ); | |||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | sub apply_modes | ||||||||||||||||||||||||||||||||||||||||||
| 182 | { | ||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
apply_modes: not called CC=19 SCAR=59.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | my ( $modes ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 185 | |||||||||||||||||||||||||||||||||||||||||||
| 186 | 0 | my @mode_added; | |||||||||||||||||||||||||||||||||||||||||
| 187 | my @mode_deleted; | ||||||||||||||||||||||||||||||||||||||||||
| 188 | |||||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | my $irc = $self->{irc}; | |||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my $PREFIX_FLAGS = $irc->isupport( "prefix_flags" ); | |||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | foreach my $m ( @$modes ) { | |||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | my ( $type, $sense, $mode ) = @{$m}{qw( type sense mode )}; | |||||||||||||||||||||||||||||||||||||||||
| 194 | |||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | ▶ | my $pm = $sense > 0 ? "+" : | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 196 | $sense < 0 ? "-" : | ||||||||||||||||||||||||||||||||||||||||||
| 197 | ""; | ||||||||||||||||||||||||||||||||||||||||||
| 198 | |||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | ▶ | if( !defined $type ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 200 | 0 | print STDERR "TODO: Undefined type for chanmode $mode\n"; | |||||||||||||||||||||||||||||||||||||||||
| 201 | } | ||||||||||||||||||||||||||||||||||||||||||
| 202 | elsif( $type eq 'list' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | print STDERR "TODO: A list chanmode $pm$mode $m->{value}\n"; | |||||||||||||||||||||||||||||||||||||||||
| 204 | } | ||||||||||||||||||||||||||||||||||||||||||
| 205 | elsif( $type eq 'occupant' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | my $flag = $m->{flag}; | |||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | my $nick_folded = $m->{nick_folded}; | |||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | my $occupant = $self->get_prop_occupants->{$nick_folded}; | |||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | if( $sense > 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | my $flags = $occupant->{flag} . $flag; | |||||||||||||||||||||||||||||||||||||||||
| 213 | # Now sort by PREFIX_FLAGS order | ||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | $flags = CORE::join( "", sort { index( $PREFIX_FLAGS, $a ) <=> index( $PREFIX_FLAGS, $b ) } split( m//, $flags ) ); | |||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | $occupant->{flag} = $flags; | |||||||||||||||||||||||||||||||||||||||||
| 216 | } | ||||||||||||||||||||||||||||||||||||||||||
| 217 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | $occupant->{flag} =~ s/\Q$flag//g; | |||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||
| 221 | # We're not adding it, we're changing it | ||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | $self->add_prop_occupants( $nick_folded => $occupant ); | |||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | $self->post_update_occupants; | |||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 225 | elsif( $type eq 'value' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | if( $sense > 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | push @mode_added, [ $mode, $m->{value} ]; | |||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||
| 229 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | push @mode_deleted, $mode; | |||||||||||||||||||||||||||||||||||||||||
| 231 | } | ||||||||||||||||||||||||||||||||||||||||||
| 232 | } | ||||||||||||||||||||||||||||||||||||||||||
| 233 | elsif( $type eq 'bool' ) { | ||||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | ▶ | if( $sense > 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | push @mode_added, [ $mode, "" ]; | |||||||||||||||||||||||||||||||||||||||||
| 236 | } | ||||||||||||||||||||||||||||||||||||||||||
| 237 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | push @mode_deleted, $mode; | |||||||||||||||||||||||||||||||||||||||||
| 239 | } | ||||||||||||||||||||||||||||||||||||||||||
| 240 | } | ||||||||||||||||||||||||||||||||||||||||||
| 241 | } | ||||||||||||||||||||||||||||||||||||||||||
| 242 | |||||||||||||||||||||||||||||||||||||||||||
| 243 | 0 | ▶ | if( @mode_added ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 244 | # TODO: Allow CHANGE_ADD messages to add multiple key/value pairs | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | foreach my $m ( @mode_added ) { | |||||||||||||||||||||||||||||||||||||||||
| 246 | 0 | $self->add_prop_mode( $m->[0] => $m->[1] ); | |||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | 0 | ▶ | if( @mode_deleted ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | $self->del_prop_mode( $_ ) for @mode_deleted; | |||||||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | if( @mode_added or @mode_deleted or !defined $self->get_prop_modestr ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
@mode_added or @mode_deleted or not defined $self->get_prop_modestr
@mode_added or @mode_deleted
MC/DC0%0/3
@mode_added or @mode_deleted or not defined $self->get_prop_modestr
@mode_added
@mode_deleted
not defined $self->get_prop_modestr
Truth table0%0/4
A or B or not(C)
A= @mode_addedB= @mode_deletedC= not defined $self->get_prop_modestr
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | $self->set_prop_modestr( $self->gen_modestr ); | |||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||
| 257 | } | ||||||||||||||||||||||||||||||||||||||||||
| 258 | |||||||||||||||||||||||||||||||||||||||||||
| 259 | sub post_update_occupants | ||||||||||||||||||||||||||||||||||||||||||
| 260 | { | ||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
post_update_occupants: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | my $irc = $self->{irc}; | |||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | 0 | my %count = map { $_ => 0 } "total", "", split( m//, $irc->isupport( "prefix_flags" ) ); | |||||||||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | my $myflag; | |||||||||||||||||||||||||||||||||||||||||
| 268 | |||||||||||||||||||||||||||||||||||||||||||
| 269 | 0 | foreach my $occ ( values %{ $self->get_prop_occupants } ) { | |||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | unless( defined $occ->{nick} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | 0 | warn "Have an undefined nick in $occ in $self\n"; | |||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 273 | } | ||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | unless( defined $occ->{flag} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | 0 | warn "Have an undefined flag for nick $occ->{nick} in $occ in $self\n"; | |||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | next; | |||||||||||||||||||||||||||||||||||||||||
| 277 | } | ||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | 0 | ▶ | my $flag = $occ->{flag} =~ m/^(.)/ ? $1 : ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||||||||
| 281 | 0 | $count{total}++; | |||||||||||||||||||||||||||||||||||||||||
| 282 | 0 | $count{$flag}++; | |||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | ▶ | $myflag = $flag if $irc->is_nick_me( $occ->{nick} ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 285 | } | ||||||||||||||||||||||||||||||||||||||||||
| 286 | |||||||||||||||||||||||||||||||||||||||||||
| 287 | 0 | $self->set_prop_occupant_summary( \%count ); | |||||||||||||||||||||||||||||||||||||||||
| 288 | |||||||||||||||||||||||||||||||||||||||||||
| 289 | # Efficient application of property change | ||||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | my $old_myflag = $self->get_prop_my_flag; | |||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | 0 | ▶ | $self->set_prop_my_flag( $myflag ) if !defined $old_myflag or $old_myflag ne $myflag; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not defined $old_myflag or $old_myflag ne $myflag
MC/DC0%0/2
not defined $old_myflag or $old_myflag ne $myflag
not defined $old_myflag
$old_myflag ne $myflag
Truth table0%0/3
not(A) or B
A= not defined $old_myflagB= $old_myflag ne $myflag
| |||||||||||||||||||||||||||||||||||||||||||
| 293 | } | ||||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | sub on_message_JOIN | ||||||||||||||||||||||||||||||||||||||||||
| 296 | { | ||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_message_JOIN: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||||||||
| 300 | 0 | my $nick = $hints->{prefix_nick}; | |||||||||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | my $userhost = "$hints->{prefix_user}\@$hints->{prefix_host}"; | |||||||||||||||||||||||||||||||||||||||||
| 303 | |||||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | ▶ | if( $hints->{prefix_is_me} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 305 | 0 | ▶ | if( $self->{state} != STATE_JOINING ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | print STDERR "Received spurious self JOIN notification when wasn't expecting it\n"; | |||||||||||||||||||||||||||||||||||||||||
| 307 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | $self->{state} = STATE_JOINED; | |||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | $self->{on_joined}->( $self ); | |||||||||||||||||||||||||||||||||||||||||
| 312 | |||||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $self->fire_event( "self_joined" ); | |||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | $self->push_displayevent( "irc.join", { channel => $self->get_prop_name, nick => $nick, userhost => $userhost } ); | |||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | $self->bump_level( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 316 | |||||||||||||||||||||||||||||||||||||||||||
| 317 | # Request the initial mode | ||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | my $irc = $self->{irc}; | |||||||||||||||||||||||||||||||||||||||||
| 319 | 0 | $irc->send_message( "MODE", undef, $self->get_prop_name ); | |||||||||||||||||||||||||||||||||||||||||
| 320 | } | ||||||||||||||||||||||||||||||||||||||||||
| 321 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | $self->fire_event( "join", $nick ); | |||||||||||||||||||||||||||||||||||||||||
| 323 | 0 | $self->push_displayevent( "irc.join", { channel => $self->get_prop_name, nick => $nick, userhost => $userhost } ); | |||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | $self->bump_level( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 325 | |||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | my $nick_folded = $hints->{prefix_nick_folded}; | |||||||||||||||||||||||||||||||||||||||||
| 327 | 0 | my $newocc = { nick => $nick, flag => "" }; | |||||||||||||||||||||||||||||||||||||||||
| 328 | |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | $self->add_prop_occupants( $nick_folded => $newocc ); | |||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | $self->post_update_occupants; | |||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 334 | } | ||||||||||||||||||||||||||||||||||||||||||
| 335 | |||||||||||||||||||||||||||||||||||||||||||
| 336 | sub on_message_KICK | ||||||||||||||||||||||||||||||||||||||||||
| 337 | { | ||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_message_KICK: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | 0 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | my $kicker = $hints->{kicker_nick}; | |||||||||||||||||||||||||||||||||||||||||
| 342 | 0 | my $kicked = $hints->{kicked_nick}; | |||||||||||||||||||||||||||||||||||||||||
| 343 | 0 | my $kickmsg = $hints->{text}; | |||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | 0 | ▶ | defined $kickmsg or $kickmsg = ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 346 | |||||||||||||||||||||||||||||||||||||||||||
| 347 | 0 | my $net = $self->{net}; | |||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | my $kickmsg_formatted = $net->format_text( $kickmsg ); | |||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | my $irc = $self->{irc}; | |||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | if( $irc->is_nick_me( $kicked ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | 0 | $self->{state} = STATE_UNJOINED; | |||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | $self->fire_event( "self_parted" ); | |||||||||||||||||||||||||||||||||||||||||
| 355 | 0 | $self->push_displayevent( "irc.kick", { channel => $self->get_prop_name, kicker => $kicker, kicked => $kicked, kickmsg => $kickmsg_formatted } ); | |||||||||||||||||||||||||||||||||||||||||
| 356 | 0 | $self->bump_level( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 357 | } | ||||||||||||||||||||||||||||||||||||||||||
| 358 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | $self->fire_event( "kick", $kicker, $kicked, $kickmsg ); | |||||||||||||||||||||||||||||||||||||||||
| 360 | 0 | $self->push_displayevent( "irc.kick", { channel => $self->get_prop_name, kicker => $kicker, kicked => $kicked, kickmsg => $kickmsg_formatted } ); | |||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | $self->bump_level( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | $self->user_leave( $hints->{kicked_nick_folded} ); | |||||||||||||||||||||||||||||||||||||||||
| 364 | } | ||||||||||||||||||||||||||||||||||||||||||
| 365 | |||||||||||||||||||||||||||||||||||||||||||
| 366 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 367 | } | ||||||||||||||||||||||||||||||||||||||||||
| 368 | |||||||||||||||||||||||||||||||||||||||||||
| 369 | sub on_message_MODE | ||||||||||||||||||||||||||||||||||||||||||
| 370 | { | ||||||||||||||||||||||||||||||||||||||||||
| 371 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_message_MODE: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 372 | 0 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 373 | |||||||||||||||||||||||||||||||||||||||||||
| 374 | 0 | my $modes = $hints->{modes}; | |||||||||||||||||||||||||||||||||||||||||
| 375 | |||||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | my $nick; | |||||||||||||||||||||||||||||||||||||||||
| 377 | my $userhost; | ||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | if( defined $hints->{prefix_nick} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | $nick = $hints->{prefix_nick}; | |||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | $userhost = "$hints->{prefix_user}\@$hints->{prefix_host}"; | |||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 384 | 0 | $nick = $userhost = $hints->{prefix_host}; | |||||||||||||||||||||||||||||||||||||||||
| 385 | } | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | $self->apply_modes( $hints->{modes} ); | |||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | 0 | my $modestr = CORE::join( " ", $hints->{modechars}, @{ $hints->{modeargs} } ); | |||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||
| 391 | # 'nick' for legacy purposes, 'moder' for new | ||||||||||||||||||||||||||||||||||||||||||
| 392 | 0 | $self->push_displayevent( "irc.mode", { | |||||||||||||||||||||||||||||||||||||||||
| 393 | channel => $self->get_prop_name, | ||||||||||||||||||||||||||||||||||||||||||
| 394 | nick => $nick, moder => $nick, | ||||||||||||||||||||||||||||||||||||||||||
| 395 | userhost => $userhost, | ||||||||||||||||||||||||||||||||||||||||||
| 396 | mode => $modestr, | ||||||||||||||||||||||||||||||||||||||||||
| 397 | } ); | ||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | $self->bump_level( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 401 | } | ||||||||||||||||||||||||||||||||||||||||||
| 402 | |||||||||||||||||||||||||||||||||||||||||||
| 403 | sub on_message_NICK | ||||||||||||||||||||||||||||||||||||||||||
| 404 | { | ||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_message_NICK: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 406 | 0 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 407 | |||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | my $oldnick_folded = $hints->{old_nick_folded}; | |||||||||||||||||||||||||||||||||||||||||
| 409 | |||||||||||||||||||||||||||||||||||||||||||
| 410 | 0 | ▶ | return 0 unless my $occ = $self->get_prop_occupants->{$oldnick_folded}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||
| 412 | 0 | my $oldnick = $hints->{old_nick}; | |||||||||||||||||||||||||||||||||||||||||
| 413 | 0 | my $newnick = $hints->{new_nick}; | |||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | $self->push_displayevent( "irc.nick", { channel => $self->get_prop_name, oldnick => $oldnick, newnick => $newnick } ); | |||||||||||||||||||||||||||||||||||||||||
| 416 | 0 | $self->bump_level( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 417 | |||||||||||||||||||||||||||||||||||||||||||
| 418 | 0 | my $newnick_folded = $hints->{new_nick_folded}; | |||||||||||||||||||||||||||||||||||||||||
| 419 | |||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | $self->del_prop_occupants( $oldnick_folded ); | |||||||||||||||||||||||||||||||||||||||||
| 421 | |||||||||||||||||||||||||||||||||||||||||||
| 422 | 0 | $occ->{nick} = $newnick; | |||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | $self->add_prop_occupants( $newnick_folded => $occ ); | |||||||||||||||||||||||||||||||||||||||||
| 424 | |||||||||||||||||||||||||||||||||||||||||||
| 425 | 0 | $self->post_update_occupants; | |||||||||||||||||||||||||||||||||||||||||
| 426 | |||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 428 | } | ||||||||||||||||||||||||||||||||||||||||||
| 429 | |||||||||||||||||||||||||||||||||||||||||||
| 430 | sub on_message_PART | ||||||||||||||||||||||||||||||||||||||||||
| 431 | { | ||||||||||||||||||||||||||||||||||||||||||
| 432 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_message_PART: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 433 | 0 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 434 | |||||||||||||||||||||||||||||||||||||||||||
| 435 | 0 | my $nick = $hints->{prefix_nick}; | |||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | my $partmsg = $hints->{text}; | |||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | 0 | ▶ | defined $partmsg or $partmsg = ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 439 | |||||||||||||||||||||||||||||||||||||||||||
| 440 | 0 | my $net = $self->{net}; | |||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | my $partmsg_formatted = $net->format_text( $partmsg ); | |||||||||||||||||||||||||||||||||||||||||
| 442 | |||||||||||||||||||||||||||||||||||||||||||
| 443 | 0 | my $userhost = "$hints->{prefix_user}\@$hints->{prefix_host}"; | |||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | ▶ | if( $hints->{prefix_is_me} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | ▶ | if( $self->{state} != STATE_PARTING ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 447 | 0 | print STDERR "Received spurious self PART notification when wasn't expecting it\n"; | |||||||||||||||||||||||||||||||||||||||||
| 448 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 449 | } | ||||||||||||||||||||||||||||||||||||||||||
| 450 | |||||||||||||||||||||||||||||||||||||||||||
| 451 | 0 | $self->{state} = STATE_UNJOINED; | |||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | 0 | $self->fire_event( "self_parted" ); | |||||||||||||||||||||||||||||||||||||||||
| 454 | 0 | $self->push_displayevent( "irc.part", { channel => $self->get_prop_name, nick => $nick, userhost => $userhost, partmsg => $partmsg_formatted } ); | |||||||||||||||||||||||||||||||||||||||||
| 455 | 0 | $self->bump_level( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 456 | |||||||||||||||||||||||||||||||||||||||||||
| 457 | 0 | $self->{on_parted}->( $self ); | |||||||||||||||||||||||||||||||||||||||||
| 458 | } | ||||||||||||||||||||||||||||||||||||||||||
| 459 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 460 | 0 | $self->fire_event( "part", $nick, $partmsg ); | |||||||||||||||||||||||||||||||||||||||||
| 461 | 0 | $self->push_displayevent( "irc.part", { channel => $self->get_prop_name, nick => $nick, userhost => $userhost, partmsg => $partmsg_formatted } ); | |||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | $self->bump_level( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 463 | |||||||||||||||||||||||||||||||||||||||||||
| 464 | 0 | $self->user_leave( $hints->{prefix_nick_folded} ); | |||||||||||||||||||||||||||||||||||||||||
| 465 | } | ||||||||||||||||||||||||||||||||||||||||||
| 466 | |||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||||||||||||
| 469 | |||||||||||||||||||||||||||||||||||||||||||
| 470 | sub on_message_QUIT | ||||||||||||||||||||||||||||||||||||||||||
| 471 | { | ||||||||||||||||||||||||||||||||||||||||||
| 472 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_message_QUIT: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 473 | 0 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 474 | |||||||||||||||||||||||||||||||||||||||||||
| 475 | 0 | my $nick_folded = $hints->{prefix_nick_folded}; | |||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | ▶ | return 0 unless $self->get_prop_occupants->{$nick_folded}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | my $nick = $hints->{prefix_nick}; | |||||||||||||||||||||||||||||||||||||||||
| 480 | 0 | my $quitmsg = $hints->{text}; | |||||||||||||||||||||||||||||||||||||||||
| 481 | |||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | ▶ | defined $quitmsg or $quitmsg = ""; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 483 | |||||||||||||||||||||||||||||||||||||||||||
| 484 | 0 | my $net = $self->{net}; | |||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | my $quitmsg_formatted = $net->format_text( $quitmsg ); | |||||||||||||||||||||||||||||||||||||||||
| 486 | |||||||||||||||||||||||||||||||||||||||||||
| 487 | 0 | my $userhost = "$hints->{prefix_user}\@$hints->{prefix_host}"; | |||||||||||||||||||||||||||||||||||||||||
| 488 | |||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | $self->push_displayevent( "irc.quit", { channel => $self->get_prop_name, nick => $nick, userhost => $userhost, quitmsg => $quitmsg_formatted } ); | |||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | $self->bump_level( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 491 | |||||||||||||||||||||||||||||||||||||||||||
| 492 | 0 | $self->user_leave( $nick_folded ); | |||||||||||||||||||||||||||||||||||||||||
| 493 | |||||||||||||||||||||||||||||||||||||||||||
| 494 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 495 | } | ||||||||||||||||||||||||||||||||||||||||||
| 496 | |||||||||||||||||||||||||||||||||||||||||||
| 497 | sub on_message_TOPIC | ||||||||||||||||||||||||||||||||||||||||||
| 498 | { | ||||||||||||||||||||||||||||||||||||||||||
| 499 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_message_TOPIC: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 501 | |||||||||||||||||||||||||||||||||||||||||||
| 502 | 0 | my $topic = $hints->{text}; | |||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | $self->set_prop_topic( $topic ); | |||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||
| 506 | 0 | my $nick = $hints->{prefix_name}; | |||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||
| 508 | 0 | my $userhost = "$hints->{prefix_user}\@$hints->{prefix_host}"; | |||||||||||||||||||||||||||||||||||||||||
| 509 | |||||||||||||||||||||||||||||||||||||||||||
| 510 | 0 | $self->fire_event( "topic", $nick, $topic ); | |||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | $self->push_displayevent( "irc.topic", { channel => $self->get_prop_name, nick => $nick, userhost => $userhost, topic => $topic } ); | |||||||||||||||||||||||||||||||||||||||||
| 512 | 0 | $self->bump_level( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 513 | |||||||||||||||||||||||||||||||||||||||||||
| 514 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 515 | } | ||||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||
| 517 | sub on_message_RPL_CHANNELMODEIS | ||||||||||||||||||||||||||||||||||||||||||
| 518 | { | ||||||||||||||||||||||||||||||||||||||||||
| 519 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_message_RPL_CHANNELMODEIS: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | $self->apply_modes( $hints->{modes} ); | |||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||
| 524 | 0 | my $modestr = CORE::join( " ", $hints->{modechars}, @{ $hints->{modeargs} } ); | |||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | $self->push_displayevent( "irc.mode_is", { channel => $self->get_prop_name, mode => $modestr } ); | |||||||||||||||||||||||||||||||||||||||||
| 527 | 0 | $self->bump_level( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 528 | |||||||||||||||||||||||||||||||||||||||||||
| 529 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 530 | } | ||||||||||||||||||||||||||||||||||||||||||
| 531 | |||||||||||||||||||||||||||||||||||||||||||
| 532 | sub on_message_RPL_NOTOPIC | ||||||||||||||||||||||||||||||||||||||||||
| 533 | { | ||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_message_RPL_NOTOPIC: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 536 | |||||||||||||||||||||||||||||||||||||||||||
| 537 | 0 | $self->set_prop_topic( "" ); | |||||||||||||||||||||||||||||||||||||||||
| 538 | |||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 540 | } | ||||||||||||||||||||||||||||||||||||||||||
| 541 | |||||||||||||||||||||||||||||||||||||||||||
| 542 | sub on_message_RPL_TOPIC | ||||||||||||||||||||||||||||||||||||||||||
| 543 | { | ||||||||||||||||||||||||||||||||||||||||||
| 544 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_message_RPL_TOPIC: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||
| 547 | 0 | my $topic = $hints->{text}; | |||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||
| 549 | 0 | $self->set_prop_topic( $topic ); | |||||||||||||||||||||||||||||||||||||||||
| 550 | |||||||||||||||||||||||||||||||||||||||||||
| 551 | 0 | $self->fire_event( "topic", undef, $topic ); | |||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | $self->push_displayevent( "irc.topic_is", { channel => $self->get_prop_name, topic => $topic } ); | |||||||||||||||||||||||||||||||||||||||||
| 553 | 0 | $self->bump_level( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 554 | |||||||||||||||||||||||||||||||||||||||||||
| 555 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 556 | } | ||||||||||||||||||||||||||||||||||||||||||
| 557 | |||||||||||||||||||||||||||||||||||||||||||
| 558 | sub on_message_RPL_TOPICWHOTIME | ||||||||||||||||||||||||||||||||||||||||||
| 559 | { | ||||||||||||||||||||||||||||||||||||||||||
| 560 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_message_RPL_TOPICWHOTIME: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 561 | 0 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 562 | |||||||||||||||||||||||||||||||||||||||||||
| 563 | 0 | my $timestr = strftime "%Y/%m/%d %H:%M:%S", localtime $hints->{timestamp}; | |||||||||||||||||||||||||||||||||||||||||
| 564 | |||||||||||||||||||||||||||||||||||||||||||
| 565 | 0 | $self->push_displayevent( "irc.topic_by", { channel => $self->get_prop_name, topic_by => $hints->{topic_nick}, timestamp => $timestr } ); | |||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | $self->bump_level( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 569 | } | ||||||||||||||||||||||||||||||||||||||||||
| 570 | |||||||||||||||||||||||||||||||||||||||||||
| 571 | sub on_message_RPL_CHANNEL_URL | ||||||||||||||||||||||||||||||||||||||||||
| 572 | { | ||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_message_RPL_CHANNEL_URL: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 575 | |||||||||||||||||||||||||||||||||||||||||||
| 576 | 0 | $self->push_displayevent( "irc.text", { server => $hints->{prefix_host}, text => "URL: $hints->{text}" } ); | |||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | $self->bump_level( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 578 | |||||||||||||||||||||||||||||||||||||||||||
| 579 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 580 | } | ||||||||||||||||||||||||||||||||||||||||||
| 581 | |||||||||||||||||||||||||||||||||||||||||||
| 582 | sub on_message_RPL_CHANNELCREATED | ||||||||||||||||||||||||||||||||||||||||||
| 583 | { | ||||||||||||||||||||||||||||||||||||||||||
| 584 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_message_RPL_CHANNELCREATED: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 585 | 0 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 586 | |||||||||||||||||||||||||||||||||||||||||||
| 587 | 0 | my $timestr = strftime "%Y/%m/%d %H:%M:%S", localtime $hints->{timestamp}; | |||||||||||||||||||||||||||||||||||||||||
| 588 | |||||||||||||||||||||||||||||||||||||||||||
| 589 | 0 | $self->push_displayevent( "irc.text", { server => $hints->{prefix_host}, text => "Channel created $timestr" } ); | |||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | $self->bump_level( 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 591 | |||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 593 | } | ||||||||||||||||||||||||||||||||||||||||||
| 594 | |||||||||||||||||||||||||||||||||||||||||||
| 595 | sub on_message_names | ||||||||||||||||||||||||||||||||||||||||||
| 596 | { | ||||||||||||||||||||||||||||||||||||||||||
| 597 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
on_message_names: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 598 | 0 | my ( $message, $hints ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 599 | |||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | $self->set_prop_occupants( $hints->{names} ); | |||||||||||||||||||||||||||||||||||||||||
| 601 | 0 | $self->post_update_occupants; | |||||||||||||||||||||||||||||||||||||||||
| 602 | |||||||||||||||||||||||||||||||||||||||||||
| 603 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||
| 606 | sub command_part | ||||||||||||||||||||||||||||||||||||||||||
| 607 | : Command_description("Part the channel") | ||||||||||||||||||||||||||||||||||||||||||
| 608 | : Command_arg('message?', eatall => 1) | ||||||||||||||||||||||||||||||||||||||||||
| 609 | { | ||||||||||||||||||||||||||||||||||||||||||
| 610 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
command_part: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | my ( $message, $cinv ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||
| 613 | $self->part( | ||||||||||||||||||||||||||||||||||||||||||
| 614 | message => $message, | ||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||
| 616 | on_parted => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 617 | 0 | ▶ | $cinv->respond( "Parted", level => 1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 618 | 0 | $self->destroy; | |||||||||||||||||||||||||||||||||||||||||
| 619 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 620 | on_part_error => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 621 | 0 | ▶ | $cinv->responderr( "Cannot part - $_[0]", level => 3 ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 622 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 623 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||
| 625 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 626 | 4 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 627 | |||||||||||||||||||||||||||||||||||||||||||
| 628 | sub command_mode | ||||||||||||||||||||||||||||||||||||||||||
| 629 | : Command_description("Change a MODE") | ||||||||||||||||||||||||||||||||||||||||||
| 630 | : Command_arg('mode') | ||||||||||||||||||||||||||||||||||||||||||
| 631 | : Command_arg('args', collect => 1) | ||||||||||||||||||||||||||||||||||||||||||
| 632 | { | ||||||||||||||||||||||||||||||||||||||||||
| 633 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
command_mode: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 634 | 0 | my ( $mode, $args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 635 | |||||||||||||||||||||||||||||||||||||||||||
| 636 | 0 | $self->mode( $mode, @$args ); | |||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||
| 638 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 639 | 4 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 640 | |||||||||||||||||||||||||||||||||||||||||||
| 641 | sub command_topic | ||||||||||||||||||||||||||||||||||||||||||
| 642 | : Command_description("Change the TOPIC") | ||||||||||||||||||||||||||||||||||||||||||
| 643 | : Command_arg('topic?', eatall => 1) | ||||||||||||||||||||||||||||||||||||||||||
| 644 | { | ||||||||||||||||||||||||||||||||||||||||||
| 645 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
command_topic: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 646 | 0 | my ( $topic ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 647 | |||||||||||||||||||||||||||||||||||||||||||
| 648 | 0 | ▶ | if( length $topic ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 649 | 0 | $self->topic( $topic ); | |||||||||||||||||||||||||||||||||||||||||
| 650 | } | ||||||||||||||||||||||||||||||||||||||||||
| 651 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 652 | 0 | $self->push_displayevent( "irc.topic_is", { channel => $self->get_prop_name, topic => $self->get_prop_topic } ); | |||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||
| 655 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 656 | 4 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 657 | |||||||||||||||||||||||||||||||||||||||||||
| 658 | sub command_names | ||||||||||||||||||||||||||||||||||||||||||
| 659 | : Command_description("Print a list of users in the channel") | ||||||||||||||||||||||||||||||||||||||||||
| 660 | : Command_opt('flat=+', desc => "all types of users in one flat list") | ||||||||||||||||||||||||||||||||||||||||||
| 661 | { | ||||||||||||||||||||||||||||||||||||||||||
| 662 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
command_names: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 663 | 0 | my ( $opts, $cinv ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 664 | |||||||||||||||||||||||||||||||||||||||||||
| 665 | 0 | my $occ = $self->get_prop_occupants; | |||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||
| 667 | 0 | ▶ | if( $opts->{flat} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 668 | 0 | my @names = map { "$occ->{$_}{flag}$occ->{$_}{nick}" } sort keys %$occ; | |||||||||||||||||||||||||||||||||||||||||
| 669 | |||||||||||||||||||||||||||||||||||||||||||
| 670 | 0 | $cinv->respond( "Names: " . CORE::join( " ", @names ) ); | |||||||||||||||||||||||||||||||||||||||||
| 671 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 672 | } | ||||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||
| 674 | # Split into groups per flag | ||||||||||||||||||||||||||||||||||||||||||
| 675 | 0 | my %occgroups; | |||||||||||||||||||||||||||||||||||||||||
| 676 | 0 | for my $nick_folded ( keys %$occ ) { | |||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | my $flag = substr( $occ->{$nick_folded}{flag}, 0, 1 ); # In case user has several | |||||||||||||||||||||||||||||||||||||||||
| 678 | 0 | push @{ $occgroups{ $flag } }, $nick_folded; | |||||||||||||||||||||||||||||||||||||||||
| 679 | } | ||||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||
| 681 | # TODO: Ought to obtain this from somewhere - NaIRC maybe? | ||||||||||||||||||||||||||||||||||||||||||
| 682 | 0 | my %flag_to_desc = ( | |||||||||||||||||||||||||||||||||||||||||
| 683 | '~' => "Founder", | ||||||||||||||||||||||||||||||||||||||||||
| 684 | '&' => "Admin", | ||||||||||||||||||||||||||||||||||||||||||
| 685 | '@' => "Operator", | ||||||||||||||||||||||||||||||||||||||||||
| 686 | '%' => "Halfop", | ||||||||||||||||||||||||||||||||||||||||||
| 687 | '+' => "Voice", | ||||||||||||||||||||||||||||||||||||||||||
| 688 | '' => "User", | ||||||||||||||||||||||||||||||||||||||||||
| 689 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||
| 691 | 0 | my $irc = $self->{irc}; | |||||||||||||||||||||||||||||||||||||||||
| 692 | 0 | foreach my $flag ( sort { $irc->cmp_prefix_flags( $b, $a ) } keys %occgroups ) { | |||||||||||||||||||||||||||||||||||||||||
| 693 | 0 | my @names = map { "$flag$occ->{$_}{nick}" } sort @{ $occgroups{$flag} }; | |||||||||||||||||||||||||||||||||||||||||
| 694 | |||||||||||||||||||||||||||||||||||||||||||
| 695 | 0 | my $text = Circle::TaggedString->new( $flag_to_desc{$flag} . ": " ); | |||||||||||||||||||||||||||||||||||||||||
| 696 | 0 | $text->append_tagged( CORE::join( " ", @names ), indent => 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 697 | |||||||||||||||||||||||||||||||||||||||||||
| 698 | 0 | $cinv->respond( $text ); | |||||||||||||||||||||||||||||||||||||||||
| 699 | } | ||||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||
| 701 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 702 | 4 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||
| 704 | sub command_op | ||||||||||||||||||||||||||||||||||||||||||
| 705 | : Command_description("Give channel operator status to users") | ||||||||||||||||||||||||||||||||||||||||||
| 706 | : Command_arg('users', collect => 1) | ||||||||||||||||||||||||||||||||||||||||||
| 707 | { | ||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
command_op: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | my ( $users ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | my @users = @$users; | |||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | $self->mode( "+".("o"x@users), @users ); | |||||||||||||||||||||||||||||||||||||||||
| 713 | |||||||||||||||||||||||||||||||||||||||||||
| 714 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 715 | 4 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 716 | |||||||||||||||||||||||||||||||||||||||||||
| 717 | sub command_deop | ||||||||||||||||||||||||||||||||||||||||||
| 718 | : Command_description("Remove channel operator status from users") | ||||||||||||||||||||||||||||||||||||||||||
| 719 | : Command_arg('users', collect => 1) | ||||||||||||||||||||||||||||||||||||||||||
| 720 | { | ||||||||||||||||||||||||||||||||||||||||||
| 721 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
command_deop: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | my ( $users ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 723 | |||||||||||||||||||||||||||||||||||||||||||
| 724 | 0 | my @users = @$users; | |||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | $self->mode( "-".("o"x@users), @users ); | |||||||||||||||||||||||||||||||||||||||||
| 726 | |||||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 728 | 4 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||
| 730 | sub command_halfop | ||||||||||||||||||||||||||||||||||||||||||
| 731 | : Command_description("Give channel half-operator status to users") | ||||||||||||||||||||||||||||||||||||||||||
| 732 | : Command_arg('users', collect => 1) | ||||||||||||||||||||||||||||||||||||||||||
| 733 | { | ||||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
command_halfop: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 735 | 0 | my ( $users ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | my @users = @$users; | |||||||||||||||||||||||||||||||||||||||||
| 738 | 0 | $self->mode( "+".("h"x@users), @users ); | |||||||||||||||||||||||||||||||||||||||||
| 739 | |||||||||||||||||||||||||||||||||||||||||||
| 740 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 741 | 4 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 742 | |||||||||||||||||||||||||||||||||||||||||||
| 743 | sub command_dehalfop | ||||||||||||||||||||||||||||||||||||||||||
| 744 | : Command_description("Remove channel half-operator status from users") | ||||||||||||||||||||||||||||||||||||||||||
| 745 | : Command_arg('users', collect => 1) | ||||||||||||||||||||||||||||||||||||||||||
| 746 | { | ||||||||||||||||||||||||||||||||||||||||||
| 747 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
command_dehalfop: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | my ( $users ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 749 | |||||||||||||||||||||||||||||||||||||||||||
| 750 | 0 | my @users = @$users; | |||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | $self->mode( "-".("h"x@users), @users ); | |||||||||||||||||||||||||||||||||||||||||
| 752 | |||||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 754 | 4 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||||||||||||||||
| 756 | sub command_voice | ||||||||||||||||||||||||||||||||||||||||||
| 757 | : Command_description("Give channel voice status to users") | ||||||||||||||||||||||||||||||||||||||||||
| 758 | : Command_arg('users', collect => 1) | ||||||||||||||||||||||||||||||||||||||||||
| 759 | { | ||||||||||||||||||||||||||||||||||||||||||
| 760 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
command_voice: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 761 | 0 | my ( $users ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | my @users = @$users; | |||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | $self->mode( "+".("v"x@users), @users ); | |||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||
| 766 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 767 | 4 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 768 | |||||||||||||||||||||||||||||||||||||||||||
| 769 | sub command_devoice | ||||||||||||||||||||||||||||||||||||||||||
| 770 | : Command_description("Remove channel voice status from users") | ||||||||||||||||||||||||||||||||||||||||||
| 771 | : Command_arg('users', collect => 1) | ||||||||||||||||||||||||||||||||||||||||||
| 772 | { | ||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
command_devoice: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 774 | 0 | my ( $users ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 775 | |||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | my @users = @$users; | |||||||||||||||||||||||||||||||||||||||||
| 777 | 0 | $self->mode( "-".("v"x@users), @users ); | |||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||
| 779 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 780 | 4 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 781 | |||||||||||||||||||||||||||||||||||||||||||
| 782 | sub command_kick | ||||||||||||||||||||||||||||||||||||||||||
| 783 | : Command_description("Kick a user from the channel") | ||||||||||||||||||||||||||||||||||||||||||
| 784 | : Command_arg('user') | ||||||||||||||||||||||||||||||||||||||||||
| 785 | : Command_arg('message?', eatall => 1 ) | ||||||||||||||||||||||||||||||||||||||||||
| 786 | { | ||||||||||||||||||||||||||||||||||||||||||
| 787 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
command_kick: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 788 | 0 | my ( $nick, $message ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 789 | |||||||||||||||||||||||||||||||||||||||||||
| 790 | 0 | ▶ | $message = "" if !defined $message; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||
| 792 | 0 | $self->kick( $nick, $message ); | |||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||
| 794 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 795 | 4 | ▶ | } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||
| 797 | ### | ||||||||||||||||||||||||||||||||||||||||||
| 798 | # Widget tree | ||||||||||||||||||||||||||||||||||||||||||
| 799 | ### | ||||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||
| 801 | sub get_widget_statusbar | ||||||||||||||||||||||||||||||||||||||||||
| 802 | { | ||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_widget_statusbar: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 804 | |||||||||||||||||||||||||||||||||||||||||||
| 805 | 0 | my $registry = $self->{registry}; | |||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | my $net = $self->{net}; | |||||||||||||||||||||||||||||||||||||||||
| 807 | |||||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | my $statusbar = $registry->construct( | |||||||||||||||||||||||||||||||||||||||||
| 809 | "Circle::Widget::Box", | ||||||||||||||||||||||||||||||||||||||||||
| 810 | classes => [qw( status )], | ||||||||||||||||||||||||||||||||||||||||||
| 811 | orientation => "horizontal", | ||||||||||||||||||||||||||||||||||||||||||
| 812 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 813 | |||||||||||||||||||||||||||||||||||||||||||
| 814 | 0 | $statusbar->add( $net->get_widget_netname ); | |||||||||||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | my $nicklabel = $registry->construct( | |||||||||||||||||||||||||||||||||||||||||
| 817 | "Circle::Widget::Label", | ||||||||||||||||||||||||||||||||||||||||||
| 818 | classes => [qw( nick )], | ||||||||||||||||||||||||||||||||||||||||||
| 819 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 820 | |||||||||||||||||||||||||||||||||||||||||||
| 821 | # TODO: This is hideous... | ||||||||||||||||||||||||||||||||||||||||||
| 822 | 0 | ▶ | my $nick = $net->get_prop_nick || $net->{configured_nick}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$net->get_prop_nick || $net->{'configured_nick'}
MC/DC0%0/2
$net->get_prop_nick || $net->{'configured_nick'}
$net->get_prop_nick
$net->{'configured_nick'}
Truth table0%0/3
A || B
A= $net->get_prop_nickB= $net->{'configured_nick'}
| |||||||||||||||||||||||||||||||||||||||||||
| 823 | 0 | my $my_flag = ""; | |||||||||||||||||||||||||||||||||||||||||
| 824 | 0 | ▶ | my $updatenicklabel = sub { $nicklabel->set_prop_text( $my_flag . $nick ) }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 825 | $net->watch_property( "nick", | ||||||||||||||||||||||||||||||||||||||||||
| 826 | 0 | ▶ | on_set => sub { $nick = $_[1]; goto &$updatenicklabel } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 827 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 828 | $self->watch_property( "my_flag", | ||||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | ▶ | on_set => sub { $my_flag = $_[1]; goto &$updatenicklabel } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 830 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | $updatenicklabel->(); | |||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||
| 833 | 0 | $statusbar->add( $nicklabel ); | |||||||||||||||||||||||||||||||||||||||||
| 834 | |||||||||||||||||||||||||||||||||||||||||||
| 835 | 0 | my $modestrlabel = $registry->construct( | |||||||||||||||||||||||||||||||||||||||||
| 836 | "Circle::Widget::Label", | ||||||||||||||||||||||||||||||||||||||||||
| 837 | classes => [qw( mode )], | ||||||||||||||||||||||||||||||||||||||||||
| 838 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 839 | $self->watch_property( "modestr", | ||||||||||||||||||||||||||||||||||||||||||
| 840 | 0 | ▶ | on_updated => sub { $modestrlabel->set_prop_text( $_[1] || "" ) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Condition0%0/2
$_[1] || ''
MC/DC0%0/1
$_[1] || ''
$_[1]
Truth table0%0/2
A
A= $_[1]
| |||||||||||||||||||||||||||||||||||||||||||
| 841 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 842 | |||||||||||||||||||||||||||||||||||||||||||
| 843 | 0 | $statusbar->add( $modestrlabel ); | |||||||||||||||||||||||||||||||||||||||||
| 844 | |||||||||||||||||||||||||||||||||||||||||||
| 845 | 0 | $statusbar->add_spacer( expand => 1 ); | |||||||||||||||||||||||||||||||||||||||||
| 846 | |||||||||||||||||||||||||||||||||||||||||||
| 847 | 0 | my $countlabel = $registry->construct( | |||||||||||||||||||||||||||||||||||||||||
| 848 | "Circle::Widget::Label", | ||||||||||||||||||||||||||||||||||||||||||
| 849 | classes => [qw( occupants )], | ||||||||||||||||||||||||||||||||||||||||||
| 850 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 851 | $self->watch_property( "occupant_summary", | ||||||||||||||||||||||||||||||||||||||||||
| 852 | on_updated => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 853 | 0 | ▶ | my ( $self, $summary ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 854 | |||||||||||||||||||||||||||||||||||||||||||
| 855 | 0 | my $irc = $self->{irc}; | |||||||||||||||||||||||||||||||||||||||||
| 856 | 0 | ▶ | my $PREFIX_FLAGS = $irc->isupport( "prefix_flags" ) || ""; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$irc->isupport('prefix_flags') || ''
MC/DC0%0/1
$irc->isupport('prefix_flags') || ''
$irc->isupport('prefix_flags')
Truth table0%0/2
A
A= $irc->isupport('prefix_flags')
| |||||||||||||||||||||||||||||||||||||||||||
| 857 | |||||||||||||||||||||||||||||||||||||||||||
| 858 | my $str = "$summary->{total} users [" . | ||||||||||||||||||||||||||||||||||||||||||
| 859 | 0 | ▶ | CORE::join( " ", map { "$_$summary->{$_}" } grep { $summary->{$_}||0 > 0 } split( m//, $PREFIX_FLAGS ), "" ) . | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 860 | "]"; | ||||||||||||||||||||||||||||||||||||||||||
| 861 | |||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | $countlabel->set_prop_text( $str ); | |||||||||||||||||||||||||||||||||||||||||
| 863 | } | ||||||||||||||||||||||||||||||||||||||||||
| 864 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 865 | |||||||||||||||||||||||||||||||||||||||||||
| 866 | 0 | $statusbar->add( $countlabel ); | |||||||||||||||||||||||||||||||||||||||||
| 867 | |||||||||||||||||||||||||||||||||||||||||||
| 868 | 0 | return $statusbar; | |||||||||||||||||||||||||||||||||||||||||
| 869 | } | ||||||||||||||||||||||||||||||||||||||||||
| 870 | |||||||||||||||||||||||||||||||||||||||||||
| 871 | sub get_widget_occupants_completegroup | ||||||||||||||||||||||||||||||||||||||||||
| 872 | { | ||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_widget_occupants_completegroup: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 874 | |||||||||||||||||||||||||||||||||||||||||||
| 875 | 0 | ▶ | return $self->{widget_occupants_completegroup} ||= do { | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{"widget_occupants_completegroup"} ||= do {
my $registry = $self->{"registry"};
my $widget = $registry->construct("Circle::Widget::Entry::CompleteGroup", "suffix_sol", ": ");
my %key_to_nick;
$self->watch_property("occupants", "on_set", sub {
my(undef, $occupants) = @_;
$widget->set(map({$key_to_nick{$_} = $occupants->{$_}{"nick"};} keys %$occupants));
}
, "on_add", sub {
my(undef, $key, $occ) = @_;
$widget->add($key_to_nick{$key} = $occ->{"nick"});
}
, "on_del", sub {
my(undef, $key) = @_;
$widget->remove(delete $key_to_nick{$key});
}
);
my $occupants = $self->get_prop_occupants;
$widget->set(map({$key_to_nick{$_} = $occupants->{$_}{"nick"};} keys %$occupants));
$widget
}
MC/DC0%0/2
$self->{"widget_occupants_completegroup"} ||= do {
my $registry = $self->{"registry"};
my $widget = $registry->construct("Circle::Widget::Entry::CompleteGroup", "suffix_sol", ": ");
my %key_to_nick;
$self->watch_property("occupants", "on_set", sub {
my(undef, $occupants) = @_;
$widget->set(map({$key_to_nick{$_} = $occupants->{$_}{"nick"};} keys %$occupants));
}
, "on_add", sub {
my(undef, $key, $occ) = @_;
$widget->add($key_to_nick{$key} = $occ->{"nick"});
}
, "on_del", sub {
my(undef, $key) = @_;
$widget->remove(delete $key_to_nick{$key});
}
);
my $occupants = $self->get_prop_occupants;
$widget->set(map({$key_to_nick{$_} = $occupants->{$_}{"nick"};} keys %$occupants));
$widget
}
$self->{"widget_occupants_completegroup"}
do {
my $registry = $self->{"registry"};
my $widget = $registry->construct("Circle::Widget::Entry::CompleteGroup", "suffix_sol", ": ");
my %key_to_nick;
$self->watch_property("occupants", "on_set", sub {
my(undef, $occupants) = @_;
$widget->set(map({$key_to_nick{$_} = $occupants->{$_}{"nick"};} keys %$occupants));
}
, "on_add", sub {
my(undef, $key, $occ) = @_;
$widget->add($key_to_nick{$key} = $occ->{"nick"});
}
, "on_del", sub {
my(undef, $key) = @_;
$widget->remove(delete $key_to_nick{$key});
}
);
my $occupants = $self->get_prop_occupants;
$widget->set(map({$key_to_nick{$_} = $occupants->{$_}{"nick"};} keys %$occupants));
$widget
}
Truth table0%0/3
A ||= B
A= $self->{"widget_occupants_completegroup"}B= do {
my $registry = $self->{"registry"};
my $widget = $registry->construct("Circle::Widget::Entry::CompleteGroup", "suffix_sol", ": ");
my %key_to_nick;
$self->watch_property("occupants", "on_set", sub {
my(undef, $occupants) = @_;
$widget->set(map({$key_to_nick{$_} = $occupants->{$_}{"nick"};} keys %$occupants));
}
, "on_add", sub {
my(undef, $key, $occ) = @_;
$widget->add($key_to_nick{$key} = $occ->{"nick"});
}
, "on_del", sub {
my(undef, $key) = @_;
$widget->remove(delete $key_to_nick{$key});
}
);
my $occupants = $self->get_prop_occupants;
$widget->set(map({$key_to_nick{$_} = $occupants->{$_}{"nick"};} keys %$occupants));
$widget
}
| |||||||||||||||||||||||||||||||||||||||||||
| 876 | 0 | my $registry = $self->{registry}; | |||||||||||||||||||||||||||||||||||||||||
| 877 | |||||||||||||||||||||||||||||||||||||||||||
| 878 | 0 | my $widget = $registry->construct( | |||||||||||||||||||||||||||||||||||||||||
| 879 | "Circle::Widget::Entry::CompleteGroup", | ||||||||||||||||||||||||||||||||||||||||||
| 880 | suffix_sol => ": ", | ||||||||||||||||||||||||||||||||||||||||||
| 881 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 882 | |||||||||||||||||||||||||||||||||||||||||||
| 883 | 0 | my %key_to_nick; | |||||||||||||||||||||||||||||||||||||||||
| 884 | $self->watch_property( "occupants", | ||||||||||||||||||||||||||||||||||||||||||
| 885 | on_set => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | ▶ | my ( undef, $occupants ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 887 | 0 | $widget->set( map { $key_to_nick{$_} = $occupants->{$_}{nick} } keys %$occupants ); | |||||||||||||||||||||||||||||||||||||||||
| 888 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 889 | on_add => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | ▶ | my ( undef, $key, $occ ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 891 | 0 | $widget->add( $key_to_nick{$key} = $occ->{nick} ); | |||||||||||||||||||||||||||||||||||||||||
| 892 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 893 | on_del => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 894 | 0 | ▶ | my ( undef, $key ) = @_; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 895 | 0 | $widget->remove( delete $key_to_nick{$key} ); | |||||||||||||||||||||||||||||||||||||||||
| 896 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 897 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 898 | |||||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | my $occupants = $self->get_prop_occupants; | |||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | $widget->set( map { $key_to_nick{$_} = $occupants->{$_}{nick} } keys %$occupants ); | |||||||||||||||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | $widget; | |||||||||||||||||||||||||||||||||||||||||
| 903 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 904 | } | ||||||||||||||||||||||||||||||||||||||||||
| 905 | |||||||||||||||||||||||||||||||||||||||||||
| 906 | sub get_widget_commandentry | ||||||||||||||||||||||||||||||||||||||||||
| 907 | { | ||||||||||||||||||||||||||||||||||||||||||
| 908 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_widget_commandentry: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 909 | 0 | my $widget = $self->SUPER::get_widget_commandentry; | |||||||||||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | $widget->add_prop_completions( $self->get_widget_occupants_completegroup ); | |||||||||||||||||||||||||||||||||||||||||
| 912 | |||||||||||||||||||||||||||||||||||||||||||
| 913 | 0 | return $widget; | |||||||||||||||||||||||||||||||||||||||||
| 914 | } | ||||||||||||||||||||||||||||||||||||||||||
| 915 | |||||||||||||||||||||||||||||||||||||||||||
| 916 | sub make_widget_pre_scroller | ||||||||||||||||||||||||||||||||||||||||||
| 917 | { | ||||||||||||||||||||||||||||||||||||||||||
| 918 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
make_widget_pre_scroller: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 919 | 0 | my ( $box ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 920 | |||||||||||||||||||||||||||||||||||||||||||
| 921 | 0 | my $registry = $self->{registry}; | |||||||||||||||||||||||||||||||||||||||||
| 922 | |||||||||||||||||||||||||||||||||||||||||||
| 923 | my $topicentry = $registry->construct( | ||||||||||||||||||||||||||||||||||||||||||
| 924 | "Circle::Widget::Entry", | ||||||||||||||||||||||||||||||||||||||||||
| 925 | classes => [qw( topic )], | ||||||||||||||||||||||||||||||||||||||||||
| 926 | 0 | ▶ | on_enter => sub { $self->topic( $_[0] ) }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 927 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 928 | $self->watch_property( "topic", | ||||||||||||||||||||||||||||||||||||||||||
| 929 | 0 | ▶ | on_updated => sub { $topicentry->set_prop_text( $_[1] ) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 930 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||||||||||||||||
| 932 | 0 | $box->add( $topicentry ); | |||||||||||||||||||||||||||||||||||||||||
| 933 | } | ||||||||||||||||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||||||||||||||||
| 935 | 4 | 0x55AA; | |||||||||||||||||||||||||||||||||||||||||