]> git.donarmstrong.com Git - infobot.git/commitdiff
more lame "s
authortimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Fri, 18 Apr 2008 23:32:26 +0000 (23:32 +0000)
committertimriker <timriker@c11ca15a-4712-0410-83d8-924469b57eb5>
Fri, 18 Apr 2008 23:32:26 +0000 (23:32 +0000)
git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@1770 c11ca15a-4712-0410-83d8-924469b57eb5

src/CommandStubs.pl
src/Files.pl
src/Misc.pl
src/core.pl

index 2fe133493ae509735d0f81c1f32dd704ceabb2a8..7363a1ff22a13db2e7748187624164a858f295fa 100644 (file)
@@ -315,7 +315,7 @@ sub uptime {
     my $count = 1;
     &msg( $who, "- Uptime for $ident -" );
     &msg( $who,
-        "Now: " . &Time2String( &uptimeNow() ) . " running $bot_version" );
+        'Now: ' . &Time2String( &uptimeNow() ) . " running $bot_version" );
 
     foreach ( &uptimeGetInfo() ) {
         /^(\d+)\.\d+ (.*)/;
@@ -629,13 +629,13 @@ sub do_verstats {
 
             my %sorted;
             my $unknown = $total - $vtotal;
-            my $perc = sprintf( "%.1f", $unknown * 100 / $total );
+            my $perc = sprintf( '%.1f', $unknown * 100 / $total );
             $perc =~ s/.0$//;
             $sorted{$perc}{'unknown/cloak'} = "$unknown ($perc%)" if ($unknown);
 
             foreach ( keys %ver ) {
                 my $count = scalar keys %{ $ver{$_} };
-                $perc = sprintf( "%.01f", $count * 100 / $total );
+                $perc = sprintf( '%.01f', $count * 100 / $total );
                 $perc =~ s/.0$//;    # lame compression.
 
                 $sorted{$perc}{$_} = "$count ($perc%)";
@@ -718,7 +718,7 @@ sub do_text_counters {
         my $tp = 0;
         foreach $i ( sort { $b <=> $a } keys %hash ) {
             foreach ( keys %{ $hash{$i} } ) {
-                my $p = sprintf( "%.01f", 100 * $i / $sum );
+                my $p = sprintf( '%.01f', 100 * $i / $sum );
                 $tp += $p;
                 push( @top, "\002$_\002 -- $i ($p%)" );
             }
@@ -762,12 +762,12 @@ sub do_text_counters {
 
         my $xtra;
         if ( $total and $rank ) {
-            my $pct = sprintf( "%.01f", 100 * ($rank) / $total );
+            my $pct = sprintf( '%.01f', 100 * ($rank) / $total );
             $xtra =
               ", ranked $rank\002/\002$total (percentile: \002$pct\002 %)";
         }
 
-        my $pct1 = sprintf( "%.01f", 100 * $x / $sum );
+        my $pct1 = sprintf( '%.01f', 100 * $x / $sum );
         &performStrictReply(
 "\002$arg\002 has said \037$type\037 \002$x\002 times (\002$pct1\002 %)$xtra"
         );
index e3e10b0cc64a30adc9d8de1d9fcd10398aa0ec16..3a294aae063c628a2fd3fb8c1c7eb23690cbf99a 100644 (file)
@@ -53,7 +53,7 @@ sub loadLang {
 
 # File: Irc Servers list.
 sub loadIRCServers {
-    my ($file) = $bot_config_dir . "/infobot.servers";
+    my ($file) = $bot_config_dir . '/infobot.servers';
     @ircServers = ();
     %ircPort    = ();
 
@@ -78,7 +78,7 @@ sub loadIRCServers {
     close FILE;
 
     $file =~ s/^.*\///;
-    &status( "Loaded $file (" . scalar(@ircServers) . " servers)" );
+    &status( "Loaded $file (" . scalar(@ircServers) . ' servers)' );
 }
 
 1;
index b7f9e1fd692469492092a84c9a628a6d87f80716..e999a2fdcd1978b57c940b09bacd83c28b977dcf 100644 (file)
@@ -13,7 +13,7 @@ use vars qw($msgType $who $bot_pid $nuh $shm $force_public_reply
 
 sub help {
     my $topic = shift;
-    my $file  = $bot_data_dir . "/infobot.help";
+    my $file  = $bot_data_dir . '/infobot.help';
     my %help  = ();
 
     # crude hack for performStrictReply() to work as expected.
@@ -54,7 +54,7 @@ sub help {
         foreach ( sort keys %help ) {
             push( @array, $_ );
             $reply =
-              scalar(@array) . " topics: " . join( "\002,\002 ", @array );
+              scalar(@array) . ' topics: ' . join( "\002,\002 ", @array );
             $i++;
 
             if ( length $reply > 400 or $count == $i ) {
@@ -89,7 +89,7 @@ sub getPath {
         return $1;
     }
     else {
-        return ".";
+        return '.';
     }
 }
 
@@ -130,7 +130,7 @@ sub formListReply {
     $maxlen -= 30;
 
     # no results.
-    return $prefix . "returned no results." unless ($total);
+    return $prefix . 'returned no results.' unless ($total);
 
     # random.
     if ($rand) {
@@ -147,7 +147,7 @@ sub formListReply {
         }
     }
     elsif ( $total > $maxshow ) {
-        &status("formListReply: truncating list.");
+        &status('formListReply: truncating list.');
 
         @list = @list[ 0 .. $maxshow - 1 ];
     }
@@ -157,7 +157,7 @@ sub formListReply {
     while () {
         $reply = $prefix . "(\002" . scalar(@list) . "\002";
         $reply .= " of \002$total\002" if ( $total != scalar @list );
-        $reply .= "): " . join( " \002;;\002 ", @list ) . ".";
+        $reply .= '): ' . join( " \002;;\002 ", @list ) . '.';
 
         last if ( length($reply) < $maxlen and scalar(@list) <= $maxshow );
         last if ( scalar(@list) == 1 );
@@ -194,7 +194,7 @@ sub Time2String {
 
     if ( $time < 0 ) {
         $time   = -$time;
-        $prefix = "- ";
+        $prefix = '- ';
     }
 
     $t[0] = int($time) % 60;
@@ -237,7 +237,7 @@ sub fixFileList {
 
         if ( scalar @keys > 3 ) {
             pop @keys while ( scalar @keys > 3 );
-            push( @keys, "..." );
+            push( @keys, '...' );
         }
 
         if ( $i > 1 ) {
@@ -257,7 +257,7 @@ sub fixFileList {
 sub fixString {
     my ( $str, $level ) = @_;
     if ( !defined $str ) {
-        &WARN("fixString: str == NULL.");
+        &WARN('fixString: str == NULL.');
         return '';
     }
 
@@ -268,7 +268,7 @@ sub fixString {
 
         next unless ( defined $level );
         if (s/[\cA-\c_]//ig) {    # remove control characters.
-            &DEBUG("stripped control chars");
+            &DEBUG('stripped control chars');
         }
     }
 
@@ -280,12 +280,12 @@ sub fixPlural {
     my ( $str, $int ) = @_;
 
     if ( !defined $str ) {
-        &WARN("fixPlural: str == NULL.");
+        &WARN('fixPlural: str == NULL.');
         return;
     }
 
     if ( !defined $int or $int =~ /^\D+$/ ) {
-        &WARN("fixPlural: int != defined or int");
+        &WARN('fixPlural: int != defined or int');
         return $str;
     }
 
@@ -334,7 +334,7 @@ sub getRandomLineFromFile {
     close IN;
 
     if ( !scalar @lines ) {
-        &ERROR("GRLF: nothing loaded?");
+        &ERROR('GRLF: nothing loaded?');
         return;
     }
 
@@ -362,7 +362,7 @@ sub getLineFromFile {
         close IN;
 
         if ( $lineno > scalar @lines ) {
-            &ERROR("getLineFromFile: lineno exceeds line count from file.");
+            &ERROR('getLineFromFile: lineno exceeds line count from file.');
             return 0;
         }
 
@@ -384,13 +384,13 @@ sub getRandom {
     return $array[ int( rand( scalar @array ) ) ];
 }
 
-# Usage: &getRandomInt("30-60"); &getRandomInt(5);
-# Desc : Returns a randomn integer between "X-Y" or 1 and the value passed
+# Usage: &getRandomInt('30-60'); &getRandomInt(5);
+# Desc : Returns a randomn integer between 'X-Y' or 1 and the value passed
 sub getRandomInt {
     my $str = shift;
 
     if ( !defined $str ) {
-        &WARN("getRandomInt: str == NULL.");
+        &WARN('getRandomInt: str == NULL.');
         return undef;
     }
 
@@ -439,7 +439,7 @@ sub IsHostMatch {
     }
 
     if ( !defined $thisnuh ) {
-        &WARN("IHM: thisnuh == NULL.");
+        &WARN('IHM: thisnuh == NULL.');
         return 0;
     }
     elsif ( $thisnuh =~ /^(\S+)!(\S+)@(\S+)/ ) {
@@ -469,12 +469,12 @@ sub isStale {
     my ( $file, $age ) = @_;
 
     if ( !defined $age ) {
-        &WARN("isStale: age == NULL.");
+        &WARN('isStale: age == NULL.');
         return 1;
     }
 
     if ( !defined $file ) {
-        &WARN("isStale: file == NULL.");
+        &WARN('isStale: file == NULL.');
         return 1;
     }
 
@@ -483,7 +483,7 @@ sub isStale {
     return 1 unless ( -f $file );
     if ( $file =~ /idx/ ) {
         my $age2 = time() - ( stat($file) )[9];
-        &VERB( "stale: $age2. (" . &Time2String($age2) . ")", 2 );
+        &VERB( "stale: $age2. (" . &Time2String($age2) . ')', 2 );
     }
     $age *= 60 * 60 * 24 if ( $age >= 0 and $age < 30 );
 
@@ -529,7 +529,7 @@ sub makeHostMask {
 
     my @array = split( /\./, $host );
     return $nu . $host if ( scalar @array <= 3 );
-    return $nu . "*." . join( '.', @{array}[ 1 .. $#array ] );
+    return $nu . '*.' . join( '.', @{array}[ 1 .. $#array ] );
 }
 
 # Usage: &makeRandom(int);
@@ -627,7 +627,7 @@ sub Forker {
     my $pid;
 
     &shmFlush();
-    &VERB( "double fork detected; not forking.", 2 ) if ( $$ != $bot_pid );
+    &VERB( 'double fork detected; not forking.', 2 ) if ( $$ != $bot_pid );
 
     if ( &IsParam('forking') and $$ == $bot_pid ) {
         return unless &addForked($label);
@@ -650,7 +650,7 @@ sub Forker {
     ### TODO: use AUTOLOAD
     ### very lame hack.
     if ( $label !~ /-/ and !&loadMyModule($label) ) {
-        &DEBUG("Forker: failed?");
+        &DEBUG('Forker: failed?');
         &delForked($label);
     }
 
@@ -658,7 +658,7 @@ sub Forker {
         $code->();    # weird, hey?
     }
     else {
-        &WARN("Forker: code not defined!");
+        &WARN('Forker: code not defined!');
     }
 
     &delForked($label);
index 9572950450d90f601a8f2269116fc1fb3815cd1d..3983f435e41d297006f69d4827e84ef1c779be6d 100644 (file)
@@ -49,7 +49,7 @@ $SIG{'__WARN__'} = 'doWarn';
 $last{buflen}    = 0;
 $last{say}       = '';
 $last{msg}       = '';
-$userHandle      = "_default";
+$userHandle      = '_default';
 $wingaterun      = time();
 $firsttime       = 1;
 $utime_userfile  = 0;
@@ -83,7 +83,7 @@ $notcount   = 0;
 ###
 
 open( VERSION, '<VERSION' );
-$bot_release = <VERSION> || "(unknown version)";
+$bot_release = <VERSION> || '(unknown version)';
 chomp($bot_release);
 close(VERSION);
 $bot_version = "infobot $bot_release -- $^O";
@@ -106,7 +106,7 @@ sub doExit {
     my ($sig) = @_;
 
     if ( defined $flag_quit ) {
-        &WARN("doExit: quit already called.");
+        &WARN('doExit: quit already called.');
         return;
     }
     $flag_quit = 1;
@@ -117,7 +117,7 @@ sub doExit {
     elsif ( $bot_pid == $$ ) {    # parent.
         &status("parent caught SIG$sig (pid $$).") if ( defined $sig );
 
-        &status("--- Start of quit.");
+        &status('--- Start of quit.');
         $ident ||= 'infobot';     # lame hack.
 
         &status("Memory Usage: $memusage KiB");
@@ -145,7 +145,7 @@ sub doExit {
         &closeLog();
         &closeSQLDebug() if ( &IsParam('SQLDebug') );
 
-        &status("--- QUIT.");
+        &status('--- QUIT.');
     }
     else {    # child.
         &status("child caught SIG$sig (pid $$).");
@@ -207,12 +207,12 @@ sub getChanConfList {
         my $chan = $_;
         my @array = grep /^$param$/, keys %{ $chanconf{$chan} };
 
-#&DEBUG("gCCL param => $param, chan => $chan, keys => " . join(':',keys %{ $chanconf{$chan} }) . " array => " . join(':', @array)) if ($param eq 'whatever');
+#&DEBUG("gCCL param => $param, chan => $chan, keys => " . join(':',keys %{ $chanconf{$chan} }) . ' array => ' . join(':', @array)) if ($param eq 'whatever');
 
         next unless ( scalar @array );
 
         if ( scalar @array > 1 ) {
-            &WARN("multiple items found?");
+            &WARN('multiple items found?');
         }
 
         if ( $chanconf{$chan}{$param} eq '0' ) {
@@ -237,7 +237,7 @@ sub IsChanConf {
     my $debug = 0;    # 1 if ($param eq 'whatever');
 
     if ( !defined $param ) {
-        &WARN("IsChanConf: param == NULL.");
+        &WARN('IsChanConf: param == NULL.');
         return 0;
     }
 
@@ -248,7 +248,7 @@ sub IsChanConf {
         return 1;
     }
 
-    $chan ||= "_default";
+    $chan ||= '_default';
 
     my $old = $chan;
     if ( $chan =~ tr/A-Z/a-z/ ) {
@@ -314,18 +314,18 @@ sub getChanConf {
     my ( $param, $c ) = @_;
 
     if ( !defined $param ) {
-        &WARN("gCC: param == NULL.");
+        &WARN('gCC: param == NULL.');
         return 0;
     }
 
     # this looks evil...
     if ( 0 and !defined $chan ) {
-        &DEBUG("gCC: ok !chan... doing _default instead.");
+        &DEBUG('gCC: ok !chan... doing _default instead.');
     }
 
     $c ||= $chan;
-    $c ||= "_default";
-    $c = "_default" if ( $c eq "*" );    # FIXME
+    $c ||= '_default';
+    $c = '_default' if ( $c eq '*' );    # FIXME
     my @c = grep /^\Q$c\E$/i, keys %chanconf;
 
     if (@c) {
@@ -339,13 +339,13 @@ sub getChanConf {
         return $chanconf{ $c[0] }{$param};
     }
 
-    #&DEBUG("gCC: returning _default... " . $chanconf{"_default"}{$param});
-    return $chanconf{"_default"}{$param};
+    #&DEBUG('gCC: returning _default... ' . $chanconf{'_default'}{$param});
+    return $chanconf{'_default'}{$param};
 }
 
 sub getChanConfDefault {
     my ( $what, $default, $chan ) = @_;
-    $chan ||= "_default";
+    $chan ||= '_default';
 
     if ( exists $param{$what} ) {
         if ( !exists $cache{config}{$what} ) {
@@ -374,7 +374,7 @@ sub findChanConf {
     my ($param) = @_;
 
     if ( !defined $param ) {
-        &WARN("param == NULL.");
+        &WARN('param == NULL.');
         return 0;
     }
 
@@ -453,10 +453,10 @@ sub showProc {
 sub setup {
     &showProc(" (\&openLog before)");
     &openLog();    # write, append.
-    &status("--- Started logging.");
+    &status('--- Started logging.');
 
     # read.
-    &loadLang( $bot_data_dir . "/infobot.lang" );
+    &loadLang( $bot_data_dir . '/infobot.lang' );
     &loadIRCServers();
     &readUserFile();
     &readChanFile();
@@ -470,7 +470,7 @@ sub setup {
     );
     &checkTables();
 
-    &status( "Setup: " . &countKeys('factoids') . " factoids." );
+    &status( 'Setup: ' . &countKeys('factoids') . ' factoids.' );
     &getChanConfDefault( 'sendPrivateLimitLines', 3,    $chan );
     &getChanConfDefault( 'sendPrivateLimitBytes', 1000, $chan );
     &getChanConfDefault( 'sendPublicLimitLines',  3,    $chan );
@@ -481,12 +481,12 @@ sub setup {
     $param{tempDir} =~ s#\~/#$ENV{HOME}/#;
 
     &status("Initial memory usage: $memusage KiB");
-    &status("-------------------------------------------------------");
+    &status('-------------------------------------------------------');
 }
 
 sub setupConfig {
     $param{'VERBOSITY'} = 1;
-    &loadConfig( $bot_config_dir . "/infobot.config" );
+    &loadConfig( $bot_config_dir . '/infobot.config' );
 
     foreach (qw(ircNick ircUser ircName DBType tempDir)) {
         next if &IsParam($_);
@@ -495,11 +495,11 @@ sub setupConfig {
     }
 
     if ( $param{tempDir} =~ s#\~/#$ENV{HOME}/# ) {
-        &VERB( "Fixing up tempDir.", 2 );
+        &VERB( 'Fixing up tempDir.', 2 );
     }
 
     if ( $param{tempDir} =~ /~/ ) {
-        &ERROR("parameter tempDir still contains tilde.");
+        &ERROR('parameter tempDir still contains tilde.');
         exit 1;
     }
 
@@ -515,7 +515,7 @@ sub setupConfig {
 
 sub startup {
     if ( &IsParam('DEBUG') ) {
-        &status("enabling debug diagnostics.");
+        &status('enabling debug diagnostics.');
 
         # I thought disabling this reduced memory usage by 1000 KiB.
         use diagnostics;
@@ -531,7 +531,7 @@ sub shutdown {
     my ($sig) = @_;
 
     # reverse order of &setup().
-    &status("--- shutdown called.");
+    &status('--- shutdown called.');
 
     # hack.
     $ident ||= 'infobot';
@@ -571,9 +571,9 @@ sub restart {
 
         &ircCheck();    # heh, evil!
 
-        &DCCBroadcast( "-HUP called.", 'm' );
+        &DCCBroadcast( '-HUP called.', 'm' );
         &shutdown($sig);
-        &loadConfig( $bot_config_dir . "/infobot.config" );
+        &loadConfig( $bot_config_dir . '/infobot.config' );
         &reloadAllModules() if ( &IsParam('DEBUG') );
         &setup();
 
@@ -591,7 +591,7 @@ sub loadConfig {
     if ( !open( FILE, $file ) ) {
         &ERROR("Failed to read configuration file ($file): $!");
         &status(
-"Please read the INSTALL file on how to install and setup this file."
+'Please read the INSTALL file on how to install and setup this file.'
         );
         exit 0;
     }