# JUST IN CASE. irq was complaining about this.
if ( $lastrun == time() ) {
- &DEBUG("ircloop: hrm... lastrun == time()");
+ &DEBUG('ircloop: hrm... lastrun == time()');
$error++;
sleep 10;
next;
}
if ( !defined $host ) {
- &DEBUG("ircloop: ircServers[x] = NULL.");
+ &DEBUG('ircloop: ircServers[x] = NULL.');
$lastrun = time();
next;
}
$error++;
if ( $error % 3 == 0 and $error != 0 ) {
- &status("IRC: Could not connect.");
- &status("IRC: ");
+ &status('IRC: Could not connect.');
+ &status('IRC: ');
next;
}
if ( $error >= 3 * 2 ) {
- &status("IRC: cannot connect to any IRC servers; stopping.");
+ &status('IRC: cannot connect to any IRC servers; stopping.');
&shutdown();
exit 1;
}
}
- &status("IRC: ok, done one cycle of IRC servers; trying again.");
+ &status('IRC: ok, done one cycle of IRC servers; trying again.');
&loadIRCServers();
goto loop;
$args{'Nick'} = $mynick;
$conns{$mynick} = $irc->newconn(%args);
if ( !defined $conns{$mynick} ) {
- &ERROR("IRC: connection failed.");
+ &ERROR('IRC: connection failed.');
&ERROR(
"add \"set ircHost 0.0.0.0\" to your config. If that does not work"
);
&ERROR(
-"Please check /etc/hosts to see if you have a localhost line like:"
+'Please check /etc/hosts to see if you have a localhost line like:'
);
- &ERROR("127.0.0.1 localhost localhost");
+ &ERROR('127.0.0.1 localhost localhost');
&ERROR(
- "If this is still a problem, please contact the maintainer.");
+ 'If this is still a problem, please contact the maintainer.');
}
$conns{$mynick}->maxlinelen($maxlinelen);
$conns{$mynick}->add_global_handler( 352, \&on_who );
$conns{$mynick}->add_global_handler( 353, \&on_names );
$conns{$mynick}->add_global_handler( 366, \&on_endofnames );
- $conns{$mynick}->add_global_handler( 376, \&on_endofmotd )
+ $conns{$mynick}->add_global_handler( "001", \&on_connected )
; # on_connect.
$conns{$mynick}->add_global_handler( 433, \&on_nick_taken );
$conns{$mynick}->add_global_handler( 439, \&on_targettoofast );
# should likely listen on a tcp port instead
#$irc->addfh(STDIN, \&on_stdin, 'r');
- &status("starting main loop");
+ &status('starting main loop');
$irc->start;
}
}
if ( &getChanConf( 'silent', $talkchannel )
- and not( &IsFlag("s") and &verifyUser( $who, $nuh{ lc $who } ) ) )
+ and not( &IsFlag('s') and &verifyUser( $who, $nuh{ lc $who } ) ) )
{
&DEBUG("say: silent in $talkchannel, not saying $msg");
return;
sub msg {
my ( $nick, $msg ) = @_;
if ( !defined $nick ) {
- &ERROR("msg: nick == NULL.");
+ &ERROR('msg: nick == NULL.');
return;
}
# some say() end up here (eg +help)
if ( &getChanConf( 'silent', $nick )
- and not( &IsFlag("s") and &verifyUser( $who, $nuh{ lc $who } ) ) )
+ and not( &IsFlag('s') and &verifyUser( $who, $nuh{ lc $who } ) ) )
{
&DEBUG("msg: silent in $nick, not saying $msg");
return;
my $mynick = $conn->nick();
my ( $target, $txt ) = @_;
if ( !defined $txt ) {
- &WARN("action: txt == NULL.");
+ &WARN('action: txt == NULL.');
return;
}
if ( &getChanConf( 'silent', $target )
- and not( &IsFlag("s") and &verifyUser( $who, $nuh{ lc $who } ) ) )
+ and not( &IsFlag('s') and &verifyUser( $who, $nuh{ lc $who } ) ) )
{
&DEBUG("action: silent in $target, not doing $txt");
return;
}
if ( length $txt > 480 ) {
- &status("action: txt too long; truncating.");
+ &status('action: txt too long; truncating.');
chop($txt) while ( length $txt > 480 );
}
sub notice {
my ( $target, $txt ) = @_;
if ( !defined $txt ) {
- &WARN("notice: txt == NULL.");
+ &WARN('notice: txt == NULL.');
return;
}
my ($reply) = @_;
if ( !defined $reply or $reply =~ /^\s*$/ ) {
- &DEBUG("performReply: reply == NULL.");
+ &DEBUG('performReply: reply == NULL.');
return;
}
my ( $who, $reply ) = @_;
if ( !defined $reply or $reply =~ /^\s*$/ ) {
- &WARN("dccsay: reply == NULL.");
+ &WARN('dccsay: reply == NULL.');
return;
}
my ( $chan, $key ) = @_;
$key ||= &getChanConf( 'chankey', $chan );
$key ||= '';
+ my $mynick = $conn->nick();
# forgot for about 2 years to implement channel keys when moving
# over to Net::IRC...
}
#} else {
- &status("joining $b_blue$chan $key$ob");
+ &status("$mynick joining $b_blue$chan $key$ob");
return if ( $conn->join( $chan, $key ) );
return if ( &validChan($chan) );
- &DEBUG("joinchan: join failed. trying connect!");
+ &DEBUG('joinchan: join failed. trying connect!');
&clearIRCVars();
$conn->connect();
sub mode {
my ( $chan, @modes ) = @_;
- my $modes = join( " ", @modes );
+ my $modes = join( ' ', @modes );
if ( &validChan($chan) == 0 ) {
&ERROR("mode: invalid chan => '$chan'.");
sub quit {
my ($quitmsg) = @_;
if ( defined $conn ) {
- &status( "QUIT " . $conn->nick() . " has quit IRC ($quitmsg)" );
+ &status( 'QUIT ' . $conn->nick() . " has quit IRC ($quitmsg)" );
$conn->quit($quitmsg);
}
else {
- &WARN("quit: could not quit!");
+ &WARN('quit: could not quit!');
}
}
my $mynick = $conn->nick();
if ( !defined $newnick ) {
- &ERROR("nick: nick == NULL.");
+ &ERROR('nick: nick == NULL.');
return;
}
if ( !defined $mynick ) {
- &WARN("nick: mynick == NULL.");
+ &WARN('nick: mynick == NULL.');
return;
}
if ($bad) {
&WARN( "Nick: not going to try to change from $mynick to $newnick. ["
. scalar(gmtime)
- . "]" );
+ . ']' );
# hrm... over time we lose track of our own nick.
#return;
my $timestr = &Time2String($delta);
# FIXME: @join should be @in instead (hacked to 10)
- #my $rate = sprintf("%.1f", $delta / @in);
- my $rate = sprintf( "%.1f", $delta / 10 );
+ #my $rate = sprintf('%.1f', $delta / @in);
+ my $rate = sprintf( '%.1f', $delta / 10 );
delete $cache{joinTime};
&status("time taken to join all chans: $timestr; rate: $rate sec/join");
$chan =~ tr/A-Z/a-z/; # not lowercase unfortunately.
if ( $chan =~ /^$/ ) {
- &DEBUG("INIC: chan == NULL.");
+ &DEBUG('INIC: chan == NULL.');
return 0;
}
else {
foreach ( keys %channels ) {
next unless (/[A-Z]/);
- &DEBUG("iNIC: hash channels contains mixed cased chan!!!");
+ &DEBUG('iNIC: hash channels contains mixed cased chan!!!');
}
return 0;
}
if ( defined $channels{$chan} or exists $channels{$chan} ) {
if ( $chan =~ /^_?default$/ ) {
- # &WARN("validC: chan cannot be _default! returning 0!");
+ # &WARN('validC: chan cannot be _default! returning 0!');
return 0;
}
my @skip;
my @join;
- # Display "Chans:" only if more than $show seconds since last display
+ # Display 'Chans:' only if more than $show seconds since last display
if ( time() - $lastChansTime > $show ) {
$lastChansTime = time();
}
sub closeDCC {
- # &DEBUG("closeDCC called.");
+ # &DEBUG('closeDCC called.');
my $type;
foreach $type ( keys %dcc ) {