X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2FIRC%2FIrc.pl;h=7b962c8ad23e0b9e13c9c1ef6cb2cd54257087ea;hb=69174f9dabbb89bfc95c0bc7aacc5a4ef59d01b7;hp=41d3ce292aa2d131d06fc7e1fd48b5eb382b6f99;hpb=205fbb95264200cf2b1bd36a384ca77ff3e10efb;p=infobot.git diff --git a/src/IRC/Irc.pl b/src/IRC/Irc.pl index 41d3ce2..7b962c8 100644 --- a/src/IRC/Irc.pl +++ b/src/IRC/Irc.pl @@ -19,9 +19,6 @@ use vars qw($notcount $nottime $notsize $msgcount $msgtime $msgsize use vars qw($b_blue $ob); use vars qw(@ircServers); -#use open ':utf8'; -#use open ':std'; - $nickserv = 0; # It's probably closer to 510, but let's be cautious until we calculate it extensively. @@ -111,6 +108,7 @@ sub irc { ); $args{'LocalAddr'} = $param{'ircHost'} if ( $param{'ircHost'} ); $args{'Password'} = $param{'ircPasswd'} if ( $param{'ircPasswd'} ); + $args{'SSL'} = $param{'ircSSL'} if ( $param{'ircSSL'} ); foreach my $mynick ( sort split ',', $param{'ircNick'} ) { if (!defined $conns{$mynick}) { @@ -128,6 +126,14 @@ sub irc { &ERROR('If this is still a problem, please contact the maintainer.'); } if (defined $conns{$mynick}) { + # explicit binmode for socket as "use open" does not seem to work here + #binmode $conns{$mynick}->{_socket}, ":utf8"; + # This will bomb on non-utf8 input + #binmode $conns{$mynick}->{_socket}, ":encoding(UTF-8)"; + # TODO: need to input bytes, but output utf8 + binmode $conns{$mynick}->{_socket}, ":bytes"; + binmode $conns{$mynick}->socket, ":bytes"; + $conns{$mynick}->maxlinelen($maxlinelen); # handler stuff. @@ -882,7 +888,8 @@ sub clearChanVars { } sub clearIRCVars { - undef %channels; + # FIXME: only remove channels for current bot! + #undef %channels; undef %floodjoin; $cache{joinTime} = time(); @@ -901,9 +908,9 @@ sub getJoinChans { # Display 'Chans:' only if more than $show seconds since last display if ( time() - $lastChansTime > $show ) { $lastChansTime = time(); - } - else { - $show = 0; # Don't display since < 15min since last + } else { + # Don't display since < 15min since last + $show = 0; } # can't join any if not connected @@ -926,28 +933,25 @@ sub getJoinChans { $chanconf{$_}{autojoin} = $val; } $skip++ if ( lc $val ne lc $nick ); - } - else { + } else { $skip++; } if ($skip) { push( @skip, $_ ); - } - else { + } else { if ( defined $channels{$_} or exists $channels{$_} ) { push( @in, $_ ); - } - else { + } else { push( @join, $_ ); } } } my $str; - $str .= ' in:' . join( ',', sort @in ) if scalar @in; - $str .= ' skip:' . join( ',', sort @skip ) if scalar @skip; $str .= ' join:' . join( ',', sort @join ) if scalar @join; + $str .= ' in:' . join( ',', sort @in ) if scalar @in; + $str .= ' skip:' . scalar @skip if scalar @skip; &status("Chans: ($nick)$str") if ($show);