From bf965fe525a92b2670e68dfff6d51da8cd98a692 Mon Sep 17 00:00:00 2001 From: timriker Date: Mon, 21 May 2007 06:56:45 +0000 Subject: [PATCH] take a few more things literally git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk@1347 c11ca15a-4712-0410-83d8-924469b57eb5 --- blootbot/src/CLI/Support.pl | 8 +- blootbot/src/DynaConfig.pl | 58 ++-- blootbot/src/Factoids/Core.pl | 84 ++--- blootbot/src/Factoids/DBCommon.pl | 42 +-- blootbot/src/Factoids/Norm.pl | 2 +- blootbot/src/Factoids/Question.pl | 30 +- blootbot/src/Factoids/Reply.pl | 22 +- blootbot/src/Factoids/Statement.pl | 20 +- blootbot/src/Factoids/Update.pl | 32 +- blootbot/src/Files.pl | 2 +- blootbot/src/IRC/Irc.pl | 46 +-- blootbot/src/IRC/IrcHelpers.pl | 42 +-- blootbot/src/IRC/IrcHooks.pl | 88 ++--- blootbot/src/IRC/Schedulers.pl | 146 ++++----- blootbot/src/Misc.pl | 50 +-- blootbot/src/Modules/BZFlag.pl | 60 ++-- blootbot/src/Modules/Debian.pl | 42 +-- blootbot/src/Modules/Dict.pl | 6 +- blootbot/src/Modules/DumpVars.pl | 8 +- blootbot/src/Modules/DumpVars2.pl | 2 +- blootbot/src/Modules/Exchange.pl | 494 ++++++++++++++--------------- blootbot/src/Modules/Factoids.pl | 224 ++++++------- blootbot/src/Modules/HTTPDtype.pl | 4 +- blootbot/src/Modules/Kernel.pl | 6 +- blootbot/src/Modules/Math.pl | 48 +-- blootbot/src/Modules/News.pl | 56 ++-- blootbot/src/Modules/OnJoin.pl | 2 +- blootbot/src/Modules/Plug.pl | 2 +- blootbot/src/Modules/Quote.pl | 4 +- blootbot/src/Modules/RootWarn.pl | 12 +- blootbot/src/Modules/Search.pl | 6 +- blootbot/src/Modules/Topic.pl | 70 ++-- blootbot/src/Modules/Units.pl | 10 +- blootbot/src/Modules/Uptime.pl | 4 +- blootbot/src/Modules/UserDCC.pl | 188 +++++------ blootbot/src/Modules/UserInfo.pl | 16 +- blootbot/src/Modules/W3Search.pl | 2 +- blootbot/src/Modules/Weather.pl | 6 +- blootbot/src/Modules/Wingate.pl | 2 +- blootbot/src/Modules/Zippy.pl | 2 +- blootbot/src/Modules/babelfish.pl | 2 +- blootbot/src/Modules/botmail.pl | 16 +- blootbot/src/Modules/insult.pl | 10 +- blootbot/src/Modules/md5.pl | 2 +- blootbot/src/Modules/nickometer.pl | 6 +- blootbot/src/Modules/pager.pl | 6 +- blootbot/src/Modules/piglatin.pl | 2 +- blootbot/src/Modules/reverse.pl | 2 +- blootbot/src/Modules/scramble.pl | 4 +- blootbot/src/Modules/slashdot.pl | 2 +- blootbot/src/Modules/spell.pl | 6 +- blootbot/src/Modules/wikipedia.pl | 14 +- blootbot/src/Modules/wtf.pl | 2 +- blootbot/src/Modules/zfi.pl | 2 +- blootbot/src/Modules/zsi.pl | 2 +- blootbot/src/Net.pl | 8 +- blootbot/src/Shm.pl | 14 +- blootbot/src/UserExtra.pl | 2 +- blootbot/src/core.pl | 68 ++-- blootbot/src/dbi.pl | 36 +-- blootbot/src/logger.pl | 34 +- blootbot/src/modules.pl | 14 +- 62 files changed, 1101 insertions(+), 1101 deletions(-) diff --git a/blootbot/src/CLI/Support.pl b/blootbot/src/CLI/Support.pl index d3c5a3d..7ee3a0b 100644 --- a/blootbot/src/CLI/Support.pl +++ b/blootbot/src/CLI/Support.pl @@ -16,13 +16,13 @@ sub cliloop { $nuh = "local!local\@local"; $uh = "local\@local"; - $who = "local"; - $orig{who} = "local"; + $who = 'local'; + $orig{who} = 'local'; $ident = $param{'ircUser'}; $chan = $talkchannel = "_local"; $addressed = 1; $msgType = 'private'; - $host = "local"; + $host = 'local'; # install libterm-readline-gnu-perl to get history support use Term::ReadLine; @@ -47,7 +47,7 @@ sub msg { } if (!defined $msg) { - $msg ||= "NULL"; + $msg ||= 'NULL'; &WARN("msg: msg == $msg."); return; } diff --git a/blootbot/src/DynaConfig.pl b/blootbot/src/DynaConfig.pl index f4ba9c3..85168e0 100644 --- a/blootbot/src/DynaConfig.pl +++ b/blootbot/src/DynaConfig.pl @@ -64,7 +64,7 @@ sub readUserFile { if (/^--(\S+)[\s\t]+(.*)$/) { # user: middle entry. my ($what,$val) = ($1,$2); - if (!defined $val or $val eq "") { + if (!defined $val or $val eq '') { &WARN("$what: val == NULL."); next; } @@ -75,7 +75,7 @@ sub readUserFile { } # nice little hack. - if ($what eq "HOSTS") { + if ($what eq 'HOSTS') { $users{$nick}{$what}{$val} = 1; } else { $users{$nick}{$what} = $val; @@ -86,9 +86,9 @@ sub readUserFile { } elsif (/^::(\S+) ignore$/) { # ignore: start entry. $chan = $1; - $type = "ignore"; + $type = 'ignore'; - } elsif (/^- (\S+):\+(\d+):\+(\d+):(\S+):(.*)$/ and $type eq "ignore") { + } elsif (/^- (\S+):\+(\d+):\+(\d+):(\S+):(.*)$/ and $type eq 'ignore') { ### ignore: middle entry. my $mask = $1; my(@array) = ($2,$3,$4,$5); @@ -101,9 +101,9 @@ sub readUserFile { } elsif (/^::(\S+) bans$/) { # bans: start entry. $chan = $1; - $type = "bans"; + $type = 'bans'; - } elsif (/^- (\S+):\+(\d+):\+(\d+):(\d+):(\S+):(.*)$/ and $type eq "bans") { + } elsif (/^- (\S+):\+(\d+):\+(\d+):(\d+):(\S+):(.*)$/ and $type eq 'bans') { ### bans: middle entry. # $btime, $atime, $count, $whoby, $reason. my(@array) = ($2,$3,$4,$5,$6); @@ -155,7 +155,7 @@ sub writeUserFile { my $what = $_; my $val = $users{$user}{$_}; - if (ref($val) eq "HASH") { + if (ref($val) eq 'HASH') { foreach (sort keys %{ $users{$user}{$_} }) { print OUT "--$what\t\t$_\n"; } @@ -407,7 +407,7 @@ sub writeChanFile { # TODO: return all flags for opers sub IsFlag { my $flags = shift; - my ($ret, $f, $o) = ""; + my ($ret, $f, $o) = ''; &verifyUser($who, $nuh); @@ -432,7 +432,7 @@ sub verifyUser { return $userHandle; } - $userHandle = ""; + $userHandle = ''; foreach $user (keys %users) { next if ($user eq "_default"); @@ -453,7 +453,7 @@ sub verifyUser { last; } - last if ($userHandle ne ""); + last if ($userHandle ne ''); if ($user =~ /^\Q$nick\E$/i and !exists $cache{VUSERWARN}{$user}) { &status("vU: nick matched but host is not in list ($lnuh)."); @@ -472,10 +472,10 @@ sub verifyUser { sub ckpasswd { # returns true if arg1 encrypts to arg2 my ($plain, $encrypted) = @_; - if ($encrypted eq "") { + if ($encrypted eq '') { ($plain, $encrypted) = split(/\s+/, $plain, 2); } - return 0 unless ($plain ne "" and $encrypted ne ""); + return 0 unless ($plain ne '' and $encrypted ne ''); # MD5 // DES. Bobby Billingsley++. my $salt; @@ -508,8 +508,8 @@ sub hasFlag { sub ignoreAdd { my($mask,$chan,$expire,$comment) = @_; - $chan ||= "*"; # global if undefined. - $comment ||= ""; # optional. + $chan ||= '*'; # global if undefined. + $comment ||= ''; # optional. $expire ||= 0; # permament. my $count ||= 0; @@ -603,7 +603,7 @@ sub userDel { sub banAdd { my($mask,$chan,$expire,$reason) = @_; - $chan ||= "*"; + $chan ||= '*'; $expire ||= 0; if ($expire > 0) { @@ -615,7 +615,7 @@ sub banAdd { exists $bans{'*'}{$mask}); $bans{$chan}{$mask} = [$expire, time(), 0, $who, $reason]; - my @chans = ($chan eq "*") ? keys %channels : $chan; + my @chans = ($chan eq '*') ? keys %channels : $chan; my $m = $mask; $m =~ s/\?/\\./g; $m =~ s/\*/\\S*/g; @@ -722,7 +722,7 @@ sub chanSet { my $was = $chanconf{$chan}{$what}; if ($set) { # add/set. - if (defined $was and $was eq "1") { + if (defined $was and $was eq '1') { &performStrictReply("setting $what for $chan already 1."); return; } @@ -739,9 +739,9 @@ sub chanSet { } # alter for cosmetic (print out) reasons only. - $was = (defined $was) ? "; was '$was'" : ""; + $was = (defined $was) ? "; was '$was'" : ''; - if ($val eq "0") { + if ($val eq '0') { &performStrictReply("Unsetting $what for $chan$was."); delete $chanconf{$chan}{$what}; } else { @@ -759,7 +759,7 @@ sub chanSet { &performStrictReply("setting $what for $chan already '$val'."); return; } - $was = ($was) ? "; was '$was'" : ""; + $was = ($was) ? "; was '$was'" : ''; &performStrictReply("Setting $what for $chan to '$val'$was."); $chanconf{$chan}{$what} = $val; @@ -826,19 +826,19 @@ sub rehashConfVars { my @regFlagsUser = ( # possible chars to include in FLAG - "A", # bot administration over /msg + 'A', # bot administration over /msg # default is only via DCC CHAT - "O", # dynamic ops (as on channel). (automatic +o) - "T", # add topics. - "a", # ask/request factoid. - "m", # modify factoid. (includes renaming) - "n", # bot owner, can "reload" - "o", # master of bot (automatic +amrt) + 'O', # dynamic ops (as on channel). (automatic +o) + 'T', # add topics. + 'a', # ask/request factoid. + 'm', # modify factoid. (includes renaming) + 'n', # bot owner, can 'reload' + 'o', # master of bot (automatic +amrt) # can search on factoid strings shorter than 2 chars # can tell bot to join new channels # can [un]lock factoids - "r", # remove factoid. - "t", # teach/add factoid. + 'r', # remove factoid. + 't', # teach/add factoid. ); 1; diff --git a/blootbot/src/Factoids/Core.pl b/blootbot/src/Factoids/Core.pl index e33685c..72d8216 100644 --- a/blootbot/src/Factoids/Core.pl +++ b/blootbot/src/Factoids/Core.pl @@ -18,7 +18,7 @@ sub validFactoid { for (lc $lhs) { # allow the following only if they have been made on purpose. - if ($rhs ne "" and $rhs !~ /^ are" if ($mhs eq "are"); - &setFactInfo($lhs, "factoid_value", $rhs); + # 'are' hack :) + $rhs = " are" if ($mhs eq 'are'); + &setFactInfo($lhs, 'factoid_value', $rhs); } return 'INFOBOT REPLY'; @@ -140,8 +140,8 @@ sub FactoidStuff { return 'forget: no addr' unless ($addressed); my $faqtoid = $message; - if ($faqtoid eq "") { - &help("forget"); + if ($faqtoid eq '') { + &help('forget'); return; } @@ -155,22 +155,22 @@ sub FactoidStuff { } # TODO: squeeze 3 getFactInfo calls into one? - my $author = &getFactInfo($faqtoid, "created_by"); - my $count = &getFactInfo($faqtoid, "requested_count") || 0; + my $author = &getFactInfo($faqtoid, 'created_by'); + my $count = &getFactInfo($faqtoid, 'requested_count') || 0; # don't delete if requested $limit times my $limit = &getChanConfDefault('factoidPreventForgetLimit', 100, $chan); # don't delete if older than $limitage seconds (modified by requests below) my $limitage = &getChanConfDefault('factoidPreventForgetLimitTime', 7 * 24 * 60 * 60, $chan); - my $t = &getFactInfo($faqtoid, "created_time") || 0; + my $t = &getFactInfo($faqtoid, 'created_time') || 0; my $age = time() - $t; # lets scale limitage from 1 (nearly 0) to $limit (full time). $limitage = $limitage*($count+1)/$limit if ($count < $limit); # isauthor and isop. my $isau = (defined $author and &IsHostMatch($author) == 2) ? 1 : 0; - my $isop = (&IsFlag("o") eq "o") ? 1 : 0; + my $isop = (&IsFlag('o') eq 'o') ? 1 : 0; - if (IsFlag("r") ne "r" && !$isop) { + if (IsFlag('r') ne 'r' && !$isop) { &msg($who, "you don't have access to remove factoids"); return; } @@ -198,16 +198,16 @@ sub FactoidStuff { # prevent deletion if other factoids redirect to it. # TODO: use hash instead of array. my @list; - if (&getChanConf("factoidPreventForgetRedirect")) { + if (&getChanConf('factoidPreventForgetRedirect')) { &status("Factoids/Core: forget: checking for redirect factoids"); - @list = &searchTable("factoids", "factoid_key", - "factoid_value", "^ see "); + @list = &searchTable('factoids', 'factoid_key', + 'factoid_value', "^ see "); } my $match = 0; for (@list) { my $f = $_; - my $v = &getFactInfo($f, "factoid_value"); + my $v = &getFactInfo($f, 'factoid_value'); my $fsafe = quotemeta($faqtoid); next unless ($v =~ /^ ?see( also)? $fsafe\.?$/i); @@ -234,21 +234,21 @@ sub FactoidStuff { # TODO: make forget limit configurable. # TODO: make forget ignore time configurable. if ($cache{forget}{$h} > 5) { - &ignoreAdd(&makeHostMask($nuh), "*", 3*24*60, "abuse of forget"); + &ignoreAdd(&makeHostMask($nuh), '*', 3*24*60, "abuse of forget"); &msg($who, "forget: Ignoring you for abuse!"); } } # lets do it! - if (&IsParam("factoidDeleteDelay") or &IsChanConf("factoidDeleteDelay") > 0) { + if (&IsParam('factoidDeleteDelay') or &IsChanConf('factoidDeleteDelay') > 0) { if (!($isop or $isau) and $faqtoid =~ / #DEL#$/) { &msg($who, "cannot delete it ($faqtoid)."); return; } &status("forgot (safe delete): '$faqtoid' - ". scalar(gmtime)); - ### TODO: check if the "backup" exists and overwrite it + ### TODO: check if the 'backup' exists and overwrite it my $check = &getFactoid("$faqtoid #DEL#"); if (!defined $check or $check =~ /^\s*$/) { @@ -260,9 +260,9 @@ sub FactoidStuff { &DEBUG("forget: not overwriting backup: $faqtoid"); } else { &status("forget: backing up '$faqtoid'"); - &setFactInfo($faqtoid, "factoid_key", $new); - &setFactInfo($new, "modified_by", $who); - &setFactInfo($new, "modified_time", time()); + &setFactInfo($faqtoid, 'factoid_key', $new); + &setFactInfo($new, 'modified_by', $who); + &setFactInfo($new, 'modified_time', time()); } } else { @@ -289,16 +289,16 @@ sub FactoidStuff { return 'unforget: no addr' unless ($addressed); my $i = 0; - $i++ if (&IsParam("factoidDeleteDelay")); - $i++ if (&IsChanConf("factoidDeleteDelay") > 0); + $i++ if (&IsParam('factoidDeleteDelay')); + $i++ if (&IsChanConf('factoidDeleteDelay') > 0); if (!$i) { &performReply("safe delete has been disable so what is there to undelete?"); return; } my $faqtoid = $message; - if ($faqtoid eq "") { - &help("unforget"); + if ($faqtoid eq '') { + &help('unforget'); return; } @@ -316,9 +316,9 @@ sub FactoidStuff { return; } - &setFactInfo($faqtoid." #DEL#", "factoid_key", $faqtoid); -# &setFactInfo($faqtoid, "modified_by", ""); -# &setFactInfo($faqtoid, "modified_time", 0); + &setFactInfo($faqtoid." #DEL#", 'factoid_key', $faqtoid); +# &setFactInfo($faqtoid, 'modified_by', ''); +# &setFactInfo($faqtoid, 'modified_time', 0); $check = &getFactoid($faqtoid); # TODO: check if $faqtoid." #DEL#" exists? @@ -339,19 +339,19 @@ sub FactoidStuff { my $function = lc $1; my $faqtoid = lc $4; - if ($faqtoid eq "") { + if ($faqtoid eq '') { &help($function); return; } - if (&getFactoid($faqtoid) eq "") { + if (&getFactoid($faqtoid) eq '') { &msg($who, "factoid \002$faqtoid\002 does not exist"); return; } - if ($function eq "lock") { + if ($function eq 'lock') { # strongly requested by #debian on 19991028. -xk - if (1 and $faqtoid !~ /^\Q$who\E$/i and &IsFlag("o") ne "o") { + if (1 and $faqtoid !~ /^\Q$who\E$/i and &IsFlag('o') ne 'o') { &msg($who,"sorry, locking cannot be used since it can be abused unneccesarily."); &status("Replace 1 with 0 in Process.pl#~324 for locking support."); return; @@ -369,8 +369,8 @@ sub FactoidStuff { if ($message =~ s/^rename(\s+|$)//) { return 'rename: no addr' unless ($addressed); - if ($message eq "") { - &help("rename"); + if ($message eq '') { + &help('rename'); return; } @@ -384,7 +384,7 @@ sub FactoidStuff { } # who == nick!user@host. - if (&IsFlag("m") ne "m" and $author !~ /^\Q$who\E\!/i) { + if (&IsFlag('m') ne 'm' and $author !~ /^\Q$who\E\!/i) { &msg($who, "factoid '$from' is not yours to modify."); return; } @@ -394,7 +394,7 @@ sub FactoidStuff { return; } - &setFactInfo($from,"factoid_key",$to); + &setFactInfo($from,'factoid_key',$to); &status("rename: <$who> '$from' is now '$to'"); &performReply("i renamed '$from' to '$to'"); @@ -421,7 +421,7 @@ sub FactoidStuff { return 'subst: locked' if (&IsLocked($faqtoid) == 1); my $was = $result; - if (($flags eq "g" && $result =~ s/\Q$op/$np/gi) || $result =~ s/\Q$op/$np/i) { + if (($flags eq 'g' && $result =~ s/\Q$op/$np/gi) || $result =~ s/\Q$op/$np/i) { # excessive length. if (length $result > $param{'maxDataSize'}) { &performReply("that's too long"); @@ -433,17 +433,17 @@ sub FactoidStuff { return; } # min length. - my $faqauth = &getFactInfo($faqtoid, "created_by"); + my $faqauth = &getFactInfo($faqtoid, 'created_by'); if ((length $result)*2 < length $was and - &IsFlag("o") ne "o" and + &IsFlag('o') ne 'o' and &IsHostMatch($faqauth) != 2 ) { &performReply("too drastic change of factoid."); } - &setFactInfo($faqtoid, "factoid_value", $result); + &setFactInfo($faqtoid, 'factoid_value', $result); &status("update: '$faqtoid' =is=> '$result'; was '$was'"); - &performReply("OK"); + &performReply('OK'); } else { &performReply("that doesn't contain '$op'"); } @@ -501,7 +501,7 @@ sub FactoidStuff { &loadMyModule('Math'); my $newresult = &perlMath(); - if (defined $newresult and $newresult ne "") { + if (defined $newresult and $newresult ne '') { $cmdstats{'Maths'}++; $result = $newresult; &status("math: <$who> $message => $result"); diff --git a/blootbot/src/Factoids/DBCommon.pl b/blootbot/src/Factoids/DBCommon.pl index c672255..1d7c499 100644 --- a/blootbot/src/Factoids/DBCommon.pl +++ b/blootbot/src/Factoids/DBCommon.pl @@ -10,7 +10,7 @@ ##### # Usage: &setFactInfo($faqtoid, $key, $val); sub setFactInfo { - &sqlSet("factoids", + &sqlSet('factoids', { factoid_key => $_[0] }, { $_[1] => $_[2] } ); @@ -19,13 +19,13 @@ sub setFactInfo { ##### # Usage: &getFactInfo($faqtoid, [$what]); sub getFactInfo { - return &sqlSelect("factoids", $_[1], { factoid_key => $_[0] } ); + return &sqlSelect('factoids', $_[1], { factoid_key => $_[0] } ); } ##### # Usage: &getFactoid($faqtoid); sub getFactoid { - return &getFactInfo($_[0], "factoid_value"); + return &getFactInfo($_[0], 'factoid_value'); } ##### @@ -33,7 +33,7 @@ sub getFactoid { sub delFactoid { my ($faqtoid) = @_; - &sqlDelete("factoids", { factoid_key => $faqtoid } ); + &sqlDelete('factoids', { factoid_key => $faqtoid } ); &status("DELETED $faqtoid"); return 1; @@ -43,10 +43,10 @@ sub delFactoid { # Usage: &IsLocked($faqtoid); sub IsLocked { my ($faqtoid) = @_; - my $thisnuh = &getFactInfo($faqtoid, "locked_by"); + my $thisnuh = &getFactInfo($faqtoid, 'locked_by'); - if (defined $thisnuh and $thisnuh ne "") { - if (!&IsHostMatch($thisnuh) and &IsFlag("o") ne "o") { + if (defined $thisnuh and $thisnuh ne '') { + if (!&IsHostMatch($thisnuh) and &IsFlag('o') ne 'o') { &performReply("cannot alter locked factoids"); return 1; } @@ -59,7 +59,7 @@ sub IsLocked { # Usage: &AddModified($faqtoid,$nuh); sub AddModified { my ($faqtoid,$nuh) = @_; - my $modified_by = &getFactInfo($faqtoid, "modified_by"); + my $modified_by = &getFactInfo($faqtoid, 'modified_by'); my (@modifiedlist, @modified, %modified); if (defined $modified_by) { @@ -83,8 +83,8 @@ sub AddModified { } shift(@modifiedlist) while (scalar @modifiedlist > 3); - &setFactInfo($faqtoid, "modified_by", join(",",@modifiedlist)); - &setFactInfo($faqtoid, "modified_time", time()); + &setFactInfo($faqtoid, 'modified_by', join(",",@modifiedlist)); + &setFactInfo($faqtoid, 'modified_time', time()); return 1; } @@ -98,28 +98,28 @@ sub AddModified { sub CmdLock { my ($faqtoid) = @_; - my $thisnuh = &getFactInfo($faqtoid,"locked_by"); + my $thisnuh = &getFactInfo($faqtoid,'locked_by'); - if (defined $thisnuh and $thisnuh ne "") { + if (defined $thisnuh and $thisnuh ne '') { my $locked_by = (split(/\!/,$thisnuh))[0]; &msg($who,"factoid \002$faqtoid\002 has already been locked by $locked_by."); return 0; } - $thisnuh ||= &getFactInfo($faqtoid,"created_by"); + $thisnuh ||= &getFactInfo($faqtoid,'created_by'); # fixes bug found on 19991103. # code needs to be reorganised though. - if ($thisnuh ne "") { - if (!&IsHostMatch($thisnuh) && IsFlag("o") ne "o") { + if ($thisnuh ne '') { + if (!&IsHostMatch($thisnuh) && IsFlag('o') ne 'o') { &msg($who, "sorry, you are not allowed to lock '$faqtoid'."); return 0; } } &performReply("locking factoid \002$faqtoid\002"); - &setFactInfo($faqtoid,"locked_by",$nuh); - &setFactInfo($faqtoid,"locked_time", time()); + &setFactInfo($faqtoid,'locked_by',$nuh); + &setFactInfo($faqtoid,'locked_time', time()); return 1; } @@ -129,21 +129,21 @@ sub CmdLock { sub CmdUnLock { my ($faqtoid) = @_; - my $thisnuh = &getFactInfo($faqtoid,"locked_by"); + my $thisnuh = &getFactInfo($faqtoid,'locked_by'); if (!defined $thisnuh) { &msg($who, "factoid \002$faqtoid\002 is not locked."); return 0; } - if ($thisnuh ne "" and !&IsHostMatch($thisnuh) and &IsFlag("o") ne "o") { + if ($thisnuh ne '' and !&IsHostMatch($thisnuh) and &IsFlag('o') ne 'o') { &msg($who, "sorry, you are not allowed to unlock factoid '$faqtoid'."); return 0; } &performReply("unlocking factoid \002$faqtoid\002"); - &setFactInfo($faqtoid,"locked_by", ""); - &setFactInfo($faqtoid,"locked_time", "0"); # pgsql complains if NOT NULL set. So set 0 which is the default + &setFactInfo($faqtoid,'locked_by', ''); + &setFactInfo($faqtoid,'locked_time', '0'); # pgsql complains if NOT NULL set. So set 0 which is the default return 1; } diff --git a/blootbot/src/Factoids/Norm.pl b/blootbot/src/Factoids/Norm.pl index 0d853a9..980936c 100644 --- a/blootbot/src/Factoids/Norm.pl +++ b/blootbot/src/Factoids/Norm.pl @@ -86,7 +86,7 @@ sub switchPerson { s/(^|\W)you\'?re(\W|$)/$1you are$2/ig; if ($addressed) { - my $mynick = "UNDEF"; + my $mynick = 'UNDEF'; $mynick = $conn->nick() if ($conn); # is it safe to remove $in from here, too? $in =~ s/yourself/$mynick/i; diff --git a/blootbot/src/Factoids/Question.pl b/blootbot/src/Factoids/Question.pl index 44fd742..1ba3b55 100644 --- a/blootbot/src/Factoids/Question.pl +++ b/blootbot/src/Factoids/Question.pl @@ -20,7 +20,7 @@ sub doQuestion { # my doesn't allow variables to be inherinted, local does. # following is used in math()... local($query) = @_; - local($reply) = ""; + local($reply) = ''; local $finalQMark = $query =~ s/\?+\s*$//; $finalQMark += $query =~ s/\?\s*$//; $query =~ s/^\s+|\s+$//g; @@ -29,11 +29,11 @@ sub doQuestion { return ''; } - my $questionWord = ""; + my $questionWord = ''; if (!$addressed) { return '' unless ($finalQMark); - return '' unless &IsChanConf("minVolunteerLength") > 0; + return '' unless &IsChanConf('minVolunteerLength') > 0; return '' if (length $query < &::getChanConf('minVolunteerLength')); } else { ### TODO: this should be caught in Process.pl? @@ -41,7 +41,7 @@ sub doQuestion { # there is no flag to disable/enable asking factoids... # so it was added... thanks zyxep! :) - if (&IsFlag("a") ne "a" && &IsFlag("o") ne "o") { + if (&IsFlag('a') ne 'a' && &IsFlag('o') ne 'o') { &status("$who tried to ask us when not allowed."); return; } @@ -87,13 +87,13 @@ sub doQuestion { $questionWord = lc($1); } - if ($questionWord eq "" and $finalQMark and $addressed) { - $questionWord = "where"; + if ($questionWord eq '' and $finalQMark and $addressed) { + $questionWord = 'where'; } $query =~ s/^\s+|\s+$//g; # bleh. hacked. push(@query, $query) if ($query ne $x); - if (&IsChanConf("factoidArguments") > 0) { + if (&IsChanConf('factoidArguments') > 0) { $result = &factoidArgs($query[0]); return $result if (defined $result); @@ -103,7 +103,7 @@ sub doQuestion { for (my$i=0; $i ".join(' :: ', @query)) if ($finalQMark); - return '' unless (&IsParam("friendlyBots")); + return '' unless (&IsParam('friendlyBots')); foreach (split /\s+/, $param{'friendlyBots'}) { &msg($_, ":INFOBOT:QUERY <$who> $query"); @@ -191,7 +191,7 @@ sub factoidArgs { # ignore split to commands [dumb commands vs. factoids] (editing commands?) return undef if $str =~ /\s+\=\~\s+s[\#\/\:]/; - my @list = &searchTable("factoids", "factoid_key", "factoid_key", "^cmd: $first "); + my @list = &searchTable('factoids', 'factoid_key', 'factoid_key', "^cmd: $first "); # my $delta_time = &timedelta($t); # &DEBUG("factArgs: delta_time = $delta_time s"); # &DEBUG("factArgs: list => ".scalar(@list) ); @@ -238,9 +238,9 @@ sub factoidArgs { } # update stats. old mysql/sqlite don't do +1 - my ($count) = &sqlSelect("factoids", "requested_count", { factoid_key => $q }); + my ($count) = &sqlSelect('factoids', 'requested_count', { factoid_key => $q }); $count++; - &sqlSet("factoids", {'factoid_key' => $q}, { + &sqlSet('factoids', {'factoid_key' => $q}, { requested_by => $nuh, requested_time => time(), requested_count => $count diff --git a/blootbot/src/Factoids/Reply.pl b/blootbot/src/Factoids/Reply.pl index fb69ebf..1ab437a 100644 --- a/blootbot/src/Factoids/Reply.pl +++ b/blootbot/src/Factoids/Reply.pl @@ -46,7 +46,7 @@ sub getReply { } else { $factoid = "$search $message"; } - ($count, $fauthor, $result) = &sqlSelect("factoids", + ($count, $fauthor, $result) = &sqlSelect('factoids', "requested_count,created_by,factoid_value", { factoid_key => $factoid } ); @@ -55,7 +55,7 @@ sub getReply { if ($result) { $lhs = $message; - $mhs = "is"; + $mhs = 'is'; $rhs = $result; return "\"$factoid\" $mhs \"$rhs\"" if ($literal); @@ -76,7 +76,7 @@ sub getReply { $result = &SARit($result); $reply = $result; - if ($result ne "") { + if ($result ne '') { ### AT LAST, REPEAT PREVENTION CODE REMOVED IN FAVOUR OF GLOBAL ### FLOOD REPETION AND PROTECTION. -20000124 @@ -84,7 +84,7 @@ sub getReply { ### FIXME: old mysql/sqlite doesn't support ### "requested_count=requested_count+1". $count++; - &sqlSet("factoids", {'factoid_key' => $factoid}, { + &sqlSet('factoids', {'factoid_key' => $factoid}, { requested_by => $nuh, requested_time => time(), requested_count => $count @@ -92,9 +92,9 @@ sub getReply { # TODO: rename $real to something else! my $real = 0; -# my $author = &getFactInfo($lhs,"created_by") || ''; +# my $author = &getFactInfo($lhs,'created_by') || ''; # $real++ if ($author =~ /^\Q$who\E\!/); -# $real++ if (&IsFlag("n")); +# $real++ if (&IsFlag('n')); $real = 0 if ($msgType =~ /public/); ### fix up the reply. @@ -117,7 +117,7 @@ sub getReply { ### bot->person reply. # result is random if separated by '||'. # rhs is full factoid with '||'. - if ($mhs eq "is") { + if ($mhs eq 'is') { $reply = &getRandom(keys %{ $lang{'factoid'} }); $reply =~ s/##KEY/$lhs/; $reply =~ s/##VALUE/$result/; @@ -337,25 +337,25 @@ sub substVars { } if ($reply =~ /\$factoids/) { - my $factoids = &countKeys("factoids"); + my $factoids = &countKeys('factoids'); $reply =~ s/\$factoids/$factoids/; } if ($reply =~ /\$Fupdate/) { my $x = "\002$count{'Update'}\002 ". - &fixPlural("modification", $count{'Update'}); + &fixPlural('modification', $count{'Update'}); $reply =~ s/\$Fupdate/$x/; } if ($reply =~ /\$Fquestion/) { my $x = "\002$count{'Question'}\002 ". - &fixPlural("question", $count{'Question'}); + &fixPlural('question', $count{'Question'}); $reply =~ s/\$Fquestion/$x/; } if ($reply =~ /\$Fdunno/) { my $x = "\002$count{'Dunno'}\002 ". - &fixPlural("dunno", $count{'Dunno'}); + &fixPlural('dunno', $count{'Dunno'}); $reply =~ s/\$Fdunno/$x/; } diff --git a/blootbot/src/Factoids/Statement.pl b/blootbot/src/Factoids/Statement.pl index 6617dd6..8eaa5e1 100644 --- a/blootbot/src/Factoids/Statement.pl +++ b/blootbot/src/Factoids/Statement.pl @@ -24,13 +24,13 @@ sub doStatement { # check if we need to be addressed and if we are return unless ($learnok); - my($urlType) = ""; + my($urlType) = ''; # prefix www with http:// and ftp with ftp:// $in =~ s/ www\./ http:\/\/www\./ig; $in =~ s/ ftp\./ ftp:\/\/ftp\./ig; - $urlType = "about" if ($in =~ /\babout:/i); + $urlType = 'about' if ($in =~ /\babout:/i); $urlType = 'afp' if ($in =~ /\bafp:/); $urlType = 'file' if ($in =~ /\bfile:/); $urlType = 'palace' if ($in =~ /\bpalace:/); @@ -40,12 +40,12 @@ sub doStatement { } # acceptUrl. - if (&IsParam("acceptUrl")) { + if (&IsParam('acceptUrl')) { if ($param{'acceptUrl'} eq 'REQUIRE') { # require url type. - return if ($urlType eq ""); + return if ($urlType eq ''); } elsif ($param{'acceptUrl'} eq 'REJECT') { - &status("REJECTED URL entry") if (&IsParam("VERBOSITY")); - return unless ($urlType eq ""); + &status("REJECTED URL entry") if (&IsParam('VERBOSITY')); + return unless ($urlType eq ''); } else { # OPTIONAL } @@ -56,7 +56,7 @@ sub doStatement { my($lhs, $mhs, $rhs) = ($`, $&, $'); # allows factoid arguments to be updated. -lear. - $lhs =~ s/^(cmd: )?(.*)/$1||"" . lc $2/e; + $lhs =~ s/^(cmd: )?(.*)/$1||'' . lc $2/e; # discard article. $lhs =~ s/^(the|da|an?)\s+//i; @@ -67,7 +67,7 @@ sub doStatement { $rhs =~ s/^\s+|\s+$//g; # break if either lhs or rhs is NULL. - if ($lhs eq "" or $rhs eq "") { + if ($lhs eq '' or $rhs eq '') { return "NOT-A-STATEMENT"; } @@ -86,7 +86,7 @@ sub doStatement { &status("statement: <$who> $message"); - # change "#*#" back to "*" because of '\' sar to '#blah#'. + # change "#*#" back to '*' because of '\' sar to '#blah#'. $lhs =~ s/\#(\S+)\#/$1/g; $rhs =~ s/\#(\S+)\#/$1/g; @@ -108,7 +108,7 @@ sub doStatement { return if (&update($lhs, $mhs, $rhs)); } - return "CONTINUE"; + return 'CONTINUE'; } 1; diff --git a/blootbot/src/Factoids/Update.pl b/blootbot/src/Factoids/Update.pl index fcb6ca2..b948266 100644 --- a/blootbot/src/Factoids/Update.pl +++ b/blootbot/src/Factoids/Update.pl @@ -21,13 +21,13 @@ sub update { return if (&IsLocked($lhs) == 1); # profanity. - if (&IsParam("profanityCheck") and &hasProfanity($rhs)) { + if (&IsParam('profanityCheck') and &hasProfanity($rhs)) { &performReply("please, watch your language."); return 1; } # teaching. - if (&IsFlag("t") ne "t" && &IsFlag("o") ne "o") { + if (&IsFlag('t') ne 't' && &IsFlag('o') ne 'o') { &msg($who, "permission denied."); &status("alert: $who wanted to teach me."); return 1; @@ -54,7 +54,7 @@ sub update { # factoid arguments handler. # must start with a non-variable - if (&IsChanConf("factoidArguments") > 0 and $lhs =~ /^[^\$]+.*\$/) { + if (&IsChanConf('factoidArguments') > 0 and $lhs =~ /^[^\$]+.*\$/) { &status("Update: Factoid Arguments found."); &status("Update: orig lhs => '$lhs'."); &status("Update: orig rhs => '$rhs'."); @@ -87,23 +87,23 @@ sub update { # nice 'are' hack (or work-around). if ($mhs =~ /^are$/i and $rhs !~ /<\S+>/) { &status("Update: 'are' hack detected."); - $mhs = "is"; + $mhs = 'is'; $rhs = " are ". $rhs; } &status("enter: <$who> \'$lhs\' =$mhs=> \'$rhs\'"); $count{'Update'}++; - &performAddressedReply("okay"); + &performAddressedReply('okay'); - &sqlInsert("factoids", { + &sqlInsert('factoids', { created_by => $nuh, created_time => time(), # modified time. factoid_key => $lhs, factoid_value => $rhs, } ); - if (!defined $rhs or $rhs eq "") { + if (!defined $rhs or $rhs eq '') { &ERROR("Update: rhs1 == NULL."); } @@ -174,20 +174,20 @@ sub update { } } - &performAddressedReply("okay"); + &performAddressedReply('okay'); $count{'Update'}++; &status("update: <$who> \'$lhs\' =$mhs=> \'$rhs\'; was \'$exists\'"); - &sqlSet("factoids", {'factoid_key' => $lhs}, { + &sqlSet('factoids', {'factoid_key' => $lhs}, { modified_by => $nuh, modified_time => time(), factoid_value => $rhs, } ); - if (!defined $rhs or $rhs eq "") { + if (!defined $rhs or $rhs eq '') { &ERROR("Update: rhs1 == NULL."); } - } else { # not "also" + } else { # not 'also' if (!$correction_plausible) { # "no, blah is ..." if ($addressed) { @@ -197,27 +197,27 @@ sub update { return 1; } - my $author = &getFactInfo($lhs, "created_by") || ""; + my $author = &getFactInfo($lhs, 'created_by') || ''; - if (IsFlag("m") ne "m" && IsFlag("o") ne "o" && + if (IsFlag('m') ne 'm' && IsFlag('o') ne 'o' && $author !~ /^\Q$who\E\!/i ) { &msg($who, "you can't change that factoid."); return 1; } - &performAddressedReply("okay"); + &performAddressedReply('okay'); $count{'Update'}++; &status("update: <$who> \'$lhs\' =$mhs=> \'$rhs\'; was \'$exists\'"); - &sqlSet("factoids", {'factoid_key' => $lhs}, { + &sqlSet('factoids', {'factoid_key' => $lhs}, { modified_by => $nuh, modified_time => time(), factoid_value => $rhs, } ); - if (!defined $rhs or $rhs eq "") { + if (!defined $rhs or $rhs eq '') { &ERROR("Update: rhs1 == NULL."); } } diff --git a/blootbot/src/Files.pl b/blootbot/src/Files.pl index a3dae2e..938f615 100644 --- a/blootbot/src/Files.pl +++ b/blootbot/src/Files.pl @@ -26,7 +26,7 @@ sub loadLang { while () { chop; - if ($_ eq "" || /^#/) { + if ($_ eq '' || /^#/) { undef $replyName; next; } diff --git a/blootbot/src/IRC/Irc.pl b/blootbot/src/IRC/Irc.pl index be71105..5159832 100644 --- a/blootbot/src/IRC/Irc.pl +++ b/blootbot/src/IRC/Irc.pl @@ -177,7 +177,7 @@ sub irc { # works? needs to actually do something # should likely listen on a tcp port instead - #$irc->addfh(STDIN, \&on_stdin, "r"); + #$irc->addfh(STDIN, \&on_stdin, 'r'); &status("starting main loop"); @@ -192,7 +192,7 @@ sub rawout { my ($buf) = @_; $buf =~ s/\n//gi; - # slow down a bit if traffic is "high". + # slow down a bit if traffic is 'high'. # need to take into account time of last message sent. if ($last{buflen} > 256 and length($buf) > 256) { sleep 1; @@ -207,7 +207,7 @@ sub say { my ($msg) = @_; my $mynick = $conn->nick(); if (!defined $msg) { - $msg ||= "NULL"; + $msg ||= 'NULL'; &WARN("say: msg == $msg."); return; } @@ -230,7 +230,7 @@ sub say { return unless (&whatInterface() =~ /IRC/); - $msg = "zero" if ($msg =~ /^0+$/); + $msg = 'zero' if ($msg =~ /^0+$/); my $t = time(); @@ -238,8 +238,8 @@ sub say { $pubcount++; $pubsize += length $msg; - my $i = &getChanConfDefault("sendPublicLimitLines", 3, $chan); - my $j = &getChanConfDefault("sendPublicLimitBytes", 1000, $chan); + my $i = &getChanConfDefault('sendPublicLimitLines', 3, $chan); + my $j = &getChanConfDefault('sendPublicLimitBytes', 1000, $chan); if ( ($pubcount % $i) == 0 and $pubcount) { sleep 1; @@ -265,7 +265,7 @@ sub msg { } if (!defined $msg) { - $msg ||= "NULL"; + $msg ||= 'NULL'; &WARN("msg: msg == $msg."); return; } @@ -285,8 +285,8 @@ sub msg { $msgcount++; $msgsize += length $msg; - my $i = &getChanConfDefault("sendPrivateLimitLines", 3, $chan); - my $j = &getChanConfDefault("sendPrivateLimitBytes", 1000, $chan); + my $i = &getChanConfDefault('sendPrivateLimitLines', 3, $chan); + my $j = &getChanConfDefault('sendPrivateLimitBytes', 1000, $chan); if ( ($msgcount % $i) == 0 and $msgcount) { sleep 1; } elsif ($msgsize > $j) { @@ -342,8 +342,8 @@ sub notice { $notcount++; $notsize += length $txt; - my $i = &getChanConfDefault("sendNoticeLimitLines", 3, $chan); - my $j = &getChanConfDefault("sendNoticeLimitBytes", 1000, $chan); + my $i = &getChanConfDefault('sendNoticeLimitLines', 3, $chan); + my $j = &getChanConfDefault('sendNoticeLimitBytes', 1000, $chan); if ( ($notcount % $i) == 0 and $notcount) { sleep 1; @@ -479,8 +479,8 @@ sub dcc_close { sub joinchan { my ($chan, $key) = @_; - $key ||= &getChanConf("chankey", $chan); - $key ||= ""; + $key ||= &getChanConf('chankey', $chan); + $key ||= ''; # forgot for about 2 years to implement channel keys when moving # over to Net::IRC... @@ -505,7 +505,7 @@ sub part { my $chan; foreach $chan (@_) { - next if ($chan eq ""); + next if ($chan eq ''); $chan =~ tr/A-Z/a-z/; # lowercase. if ($chan !~ /^$mask{chan}$/) { @@ -541,24 +541,24 @@ sub mode { sub op { my ($chan, @who) = @_; - my $os = "o" x scalar(@who); + my $os = 'o' x scalar(@who); &mode($chan, "+$os @who"); } sub deop { my ($chan, @who) = @_; - my $os = "o" x scalar(@who); + my $os = 'o' x scalar(@who); &mode($chan, "-$os ".@who); } sub kick { my ($nick,$chan,$msg) = @_; - my (@chans) = ($chan eq "") ? (keys %channels) : lc($chan); + my (@chans) = ($chan eq '') ? (keys %channels) : lc($chan); my $mynick = $conn->nick(); - if ($chan ne "" and &validChan($chan) == 0) { + if ($chan ne '' and &validChan($chan) == 0) { &ERROR("kick: invalid channel $chan."); return; } @@ -715,7 +715,7 @@ sub joinNextChan { } # chanserv check: global channels, in case we missed one. - foreach ( &ChanConfList("chanServ_ops") ) { + foreach ( &ChanConfList('chanServ_ops') ) { &chanServCheck($_); } } @@ -847,14 +847,14 @@ sub getJoinChans { my $nick = $conn->nick(); foreach (keys %chanconf) { - next if ($_ eq "_default"); + next if ($_ eq '_default'); my $skip = 0; my $val = $chanconf{$_}{autojoin}; if (defined $val) { - $skip++ if ($val eq "0"); - if ($val eq "1") { + $skip++ if ($val eq '0'); + if ($val eq '1') { # convert old +autojoin to autojoin $val = lc $nick; $chanconf{$_}{autojoin} = $val; @@ -911,7 +911,7 @@ sub closeDCC { sub joinfloodCheck { my($who,$chan,$userhost) = @_; - return unless (&IsChanConf("joinfloodCheck") > 0); + return unless (&IsChanConf('joinfloodCheck') > 0); if (exists $netsplit{lc $who}) { # netsplit join. &DEBUG("joinfloodCheck: $who was in netsplit; not checking."); diff --git a/blootbot/src/IRC/IrcHelpers.pl b/blootbot/src/IRC/IrcHelpers.pl index cc53742..e45b4b7 100644 --- a/blootbot/src/IRC/IrcHelpers.pl +++ b/blootbot/src/IRC/IrcHelpers.pl @@ -34,11 +34,11 @@ sub hookMode { my $target = shift @targets; if ($parity) { - $chanstats{$chan}{'Op'}++ if ($mode eq "o"); - $chanstats{$chan}{'Ban'}++ if ($mode eq "b"); + $chanstats{$chan}{'Op'}++ if ($mode eq 'o'); + $chanstats{$chan}{'Ban'}++ if ($mode eq 'b'); } else { - $chanstats{$chan}{'Deop'}++ if ($mode eq "o"); - $chanstats{$chan}{'Unban'}++ if ($mode eq "b"); + $chanstats{$chan}{'Deop'}++ if ($mode eq 'o'); + $chanstats{$chan}{'Unban'}++ if ($mode eq 'b'); } # modes w/ target affecting nick => cache it. @@ -47,8 +47,8 @@ sub hookMode { delete $channels{$chan}{$mode}{$target} if !$parity; # lets do some custom stuff. - if ($mode eq "o" and $parity) { - if ($nick eq "ChanServ" and $target =~ /^\Q$ident\E$/i) { + if ($mode eq 'o' and $parity) { + if ($nick eq 'ChanServ' and $target =~ /^\Q$ident\E$/i) { &VERB("hookmode: chanserv deopped us! asking",2); &chanServCheck($chan); } @@ -116,13 +116,13 @@ sub hookMsg { $addressed = 1; } else { # ignore messages addressed to other people or unaddressed. - $skipmessage++ if ($2 ne "" and $2 !~ /^ /); + $skipmessage++ if ($2 ne '' and $2 !~ /^ /); } } } # Determine floodwho. - my $c = "_default"; + my $c = '_default'; if ($msgType =~ /public/i) { # public. $floodwho = $c = lc $chan; @@ -134,14 +134,14 @@ sub hookMsg { &FIXME("floodwho = ???"); } - my $val = &getChanConfDefault("floodRepeat", "2:5", $c); + my $val = &getChanConfDefault('floodRepeat', "2:5", $c); my ($count, $interval) = split /:/, $val; # flood repeat protection. if ($addressed) { my $time = $flood{$floodwho}{$message} || 0; - if (!&IsFlag('o') and $msgType eq "public" and (time() - $time < $interval)) { + if (!&IsFlag('o') and $msgType eq 'public' and (time() - $time < $interval)) { ### public != personal who so the below is kind of pointless. my @who; foreach (keys %flood) { @@ -154,7 +154,7 @@ sub hookMsg { return if ($lobotomized); if (!scalar @who) { - push(@who,"Someone"); + push(@who,'Someone'); } &msg($who,join(' ', @who)." already said that ". (time - $time) ." seconds ago" ); @@ -176,14 +176,14 @@ sub hookMsg { if ($addrchar) { &status("$b_cyan$who$ob is short-addressing $mynick"); - } elsif ($msgType eq "private") { # private. + } elsif ($msgType eq 'private') { # private. &status("$b_cyan$who$ob is /msg'ing $mynick"); } else { # public? &status("$b_cyan$who$ob is addressing $mynick"); } $flood{$floodwho}{$message} = time(); - } elsif ($msgType eq "public" and &IsChanConf("kickOnRepeat") > 0) { + } elsif ($msgType eq 'public' and &IsChanConf('kickOnRepeat') > 0) { # unaddressed, public only. ### TODO: use a separate "short-time" hash. @@ -191,7 +191,7 @@ sub hookMsg { @data = keys %{ $flood{$floodwho} } if (exists $flood{$floodwho}); } - $val = &getChanConfDefault("floodMessages", "5:30", $c); + $val = &getChanConfDefault('floodMessages', "5:30", $c); ($count, $interval) = split /:/, $val; # flood overflow protection. @@ -252,7 +252,7 @@ sub hookMsg { $seencache{$who}{'msg'} = $orig{message}; $seencache{$who}{'msgcount'}++; } - if (&IsChanConf("minVolunteerLength") > 0) { + if (&IsChanConf('minVolunteerLength') > 0) { # FIXME hack to treat unaddressed as if using addrchar $addrchar = 1; } @@ -305,7 +305,7 @@ sub chanLimitVerify { $chan = $c; my $l = $channels{$chan}{'l'}; - return unless (&IsChanConf("chanlimitcheck") > 0); + return unless (&IsChanConf('chanlimitcheck') > 0); if (scalar keys %netsplit) { &WARN("clV: netsplit active (1, chan = $chan); skipping."); @@ -319,9 +319,9 @@ sub chanLimitVerify { } # only change it if it's not set. - my $plus = &getChanConfDefault("chanlimitcheckPlus", 5, $chan); + my $plus = &getChanConfDefault('chanlimitcheckPlus', 5, $chan); my $count = scalar(keys %{ $channels{$chan}{''} }); - my $int = &getChanConfDefault("chanlimitcheckInterval", 10, $chan); + my $int = &getChanConfDefault('chanlimitcheckInterval', 10, $chan); my $delta = $count + $plus - $l; # $delta =~ s/^\-//; @@ -360,14 +360,14 @@ sub chanServCheck { &DEBUG("chanServCheck: lowercased chan ($chan)"); } - if (! &IsChanConf("chanServ_ops") > 0) { + if (! &IsChanConf('chanServ_ops') > 0) { return 0; } &VERB("chanServCheck($chan) called.",2); - if ( &IsParam("nickServ_pass") and !$nickserv) { - $conn->who("NickServ"); + if ( &IsParam('nickServ_pass') and !$nickserv) { + $conn->who('NickServ'); return 0; } diff --git a/blootbot/src/IRC/IrcHooks.pl b/blootbot/src/IRC/IrcHooks.pl index c158f3b..cf873ce 100644 --- a/blootbot/src/IRC/IrcHooks.pl +++ b/blootbot/src/IRC/IrcHooks.pl @@ -50,7 +50,7 @@ sub on_chat { } ### set vars that would have been set in hookMsg. - $userHandle = ""; # reset. + $userHandle = ''; # reset. $who = lc $nick; $message = $msg; $orig{who} = $nick; @@ -66,7 +66,7 @@ sub on_chat { my $crypto = $users{$userHandle}{PASS}; my $success = 0; - if ($userHandle eq "_default") { + if ($userHandle eq '_default') { &WARN("DCC CHAT: _default/guest not allowed."); return; } @@ -84,7 +84,7 @@ sub on_chat { $conn->privmsg($sock, "Commands start with '.' (like '.quit' or '.help')"); $conn->privmsg($sock, "Everything else goes out to the party line."); - &dccStatus(2) unless (exists $sched{"dccStatus"}{RUNNING}); + &dccStatus(2) unless (exists $sched{'dccStatus'}{RUNNING}); $success++; @@ -103,7 +103,7 @@ sub on_chat { $dcc{'CHATvrfy'}{$nick} = $userHandle; - return if ($userHandle eq "_default"); + return if ($userHandle eq '_default'); &dccsay($nick,"Flags: $users{$userHandle}{FLAGS}"); } @@ -117,7 +117,7 @@ sub on_chat { ### TODO: make use of &Forker(); here? &loadMyModule('UserDCC'); - &DCCBroadcast("#$who# $message","m"); + &DCCBroadcast("#$who# $message",'m'); my $retval = &userDCC(); return unless (defined $retval); @@ -160,7 +160,7 @@ sub on_endofmotd { # first time run. if (!exists $users{_default}) { &status("!!! First time run... adding _default user."); - $users{_default}{FLAGS} = "amrt"; + $users{_default}{FLAGS} = 'amrt'; $users{_default}{HOSTS}{"*!*@*"} = 1; } @@ -183,11 +183,11 @@ sub on_endofmotd { } if ($firsttime) { - &ScheduleThis(1, "setupSchedulers"); + &ScheduleThis(1, 'setupSchedulers'); $firsttime = 0; } - if (&IsParam("ircUMode")) { + if (&IsParam('ircUMode')) { &VERB("Attempting change of user modes to $param{'ircUMode'}.", 2); if ($param{'ircUMode'} !~ /^[-+]/) { &WARN("ircUMode had no +- prefix; adding +"); @@ -204,7 +204,7 @@ sub on_endofmotd { $conn->ison($conn->nick()); # Q, as on quakenet.org. - if (&IsParam("Q_pass")) { + if (&IsParam('Q_pass')) { &status("Authing to Q..."); &rawout("PRIVMSG Q\@CServe.quakenet.org :AUTH $param{'Q_user'} $param{'Q_pass'}"); } @@ -315,7 +315,7 @@ sub on_dcc_open { ### TODO: run ScheduleThis inside on_dcc_open_chat recursively ### 1,3,5,10 seconds then fail. if ($nuh{$nick} eq "GETTING-NOW") { - &ScheduleThis(3/60, "on_dcc_open_chat", $nick, $sock); + &ScheduleThis(3/60, 'on_dcc_open_chat', $nick, $sock); } else { on_dcc_open_chat(undef, $nick, $sock); } @@ -355,7 +355,7 @@ sub on_dcc_open_chat { $dcc{'CHAT'}{$nick} = $sock; # TODO: don't make DCC CHAT established in the first place. - if ($userHandle eq "_default") { + if ($userHandle eq '_default') { &dccsay($nick, "_default/guest not allowed"); $sock->close(); return; @@ -397,7 +397,7 @@ sub on_disconnect { &WARN("scheduling call ircCheck() in 60s"); &clearIRCVars(); - &ScheduleThis(1, "ircCheck"); + &ScheduleThis(1, 'ircCheck'); } sub on_endofnames { @@ -420,13 +420,13 @@ sub on_endofnames { my $txt; my @array; - foreach ("o","v","") { + foreach ('o','v','') { my $count = scalar(keys %{ $channels{$chan}{$_} }); next unless ($count); - $txt = "total" if ($_ eq ""); - $txt = "voice" if ($_ eq "v"); - $txt = "ops" if ($_ eq "o"); + $txt = 'total' if ($_ eq ''); + $txt = 'voice' if ($_ eq 'v'); + $txt = 'ops' if ($_ eq 'o'); push(@array, "$count $txt"); } @@ -477,17 +477,17 @@ sub on_join { my ($user,$host) = split(/\@/, $event->userhost); $chan = lc( ($event->to)[0] ); # CASING!!!! $who = $event->nick(); - $msgType = "public"; + $msgType = 'public'; my $i = scalar(keys %{ $channels{$chan} }); my $j = $cache{maxpeeps}{$chan} || 0; - if (!&IsParam("noSHM") && time() > ($sched{shmFlush}{TIME} || time()) + 3600) { + if (!&IsParam('noSHM') && time() > ($sched{shmFlush}{TIME} || time()) + 3600) { &DEBUG("looks like schedulers died somewhere... restarting..."); &setupSchedulers(); } $chanstats{$chan}{'Join'}++; - $userstats{lc $who}{'Join'} = time() if (&IsChanConf("seenStats") > 0); + $userstats{lc $who}{'Join'} = time() if (&IsChanConf('seenStats') > 0); $cache{maxpeeps}{$chan} = $i if ($i > $j); &joinfloodCheck($who, $chan, $event->userhost); @@ -518,7 +518,7 @@ sub on_join { # how to tell if there's a netjoin??? - my $netsplitstr = ""; + my $netsplitstr = ''; $netsplitstr = " $b_yellow\[${ob}NETSPLIT VICTIM$b_yellow]$ob" if ($netsplit); &status(">>> join/$b_blue$chan$ob $b_cyan$who$ob $b_yellow($ob$user\@$host$b_yellow)$ob$netsplitstr"); @@ -529,7 +529,7 @@ sub on_join { ### on-join bans. my @bans; push(@bans, keys %{ $bans{$chan} }) if (exists $bans{$chan}); - push(@bans, keys %{ $bans{"*"} }) if (exists $bans{"*"}); + push(@bans, keys %{ $bans{'*'} }) if (exists $bans{'*'}); foreach (@bans) { my $ban = $_; @@ -544,7 +544,7 @@ sub on_join { } my $reason = "no reason"; - foreach ($chan, "*") { + foreach ($chan, '*') { next unless (exists $bans{$_}); next unless (exists $bans{$_}{$ban}); @@ -637,7 +637,7 @@ sub on_mode { $chan = ($event->to)[0]; # last element is empty... so nuke it. - pop @args while ($args[$#args] eq ""); + pop @args while ($args[$#args] eq ''); if ($nick eq $chan) { # UMODE &status(">>> mode $b_yellow\[$ob$b@args$b_yellow\]$ob by $b_cyan$nick$ob"); @@ -670,7 +670,7 @@ sub on_msg { $h = $host; if ($nick eq $ident) { # hopefully ourselves. - if ($msg eq "TEST") { + if ($msg eq 'TEST') { &status("IRCTEST: Yes, we're alive."); delete $cache{connect}; return; @@ -678,9 +678,9 @@ sub on_msg { } &hookMsg('private', undef, $nick, $msg); - $who = ""; - $chan = ""; - $msgType = ""; + $who = ''; + $chan = ''; + $msgType = ''; } sub on_names { @@ -739,7 +739,7 @@ sub on_nick_taken { $conn = shift(@_); my $nick = $conn->nick(); #my $newnick = $nick . int(rand 10); - my $newnick = $nick . "_"; + my $newnick = $nick . '_'; &DEBUG("on_nick_taken: nick => $nick"); @@ -769,7 +769,7 @@ sub on_notice { if ($check) { &status("nickserv told us to register; doing it."); - if (&IsParam("nickServ_pass")) { + if (&IsParam('nickServ_pass')) { &status("NickServ: ==> Identifying."); &rawout("PRIVMSG NickServ :IDENTIFY $param{'nickServ_pass'}"); return; @@ -782,7 +782,7 @@ sub on_notice { if ($args =~ /^Password a/i) { my $done = 0; - foreach ( &ChanConfList("chanServ_ops") ) { + foreach ( &ChanConfList('chanServ_ops') ) { next unless &chanServCheck($_); next if ($done); &DEBUG("nickserv activated or restarted; doing chanserv check."); @@ -823,7 +823,7 @@ sub on_part { my $nick = $event->nick; my $userhost = $event->userhost; $who = $nick; - $msgType = "public"; + $msgType = 'public'; if (!exists $channels{$chan}) { &DEBUG("on_part: found out $mynick is on $chan!"); @@ -840,7 +840,7 @@ sub on_part { &clearChanVars($chan); } - if (!&IsNickInAnyChan($nick) and &IsChanConf("seenStats") > 0) { + if (!&IsNickInAnyChan($nick) and &IsChanConf('seenStats') > 0) { delete $userstats{lc $nick}; } @@ -880,7 +880,7 @@ sub on_public { $who = $nick; $uh = $event->userhost(); $nuh = $nick."!".$uh; - $msgType = "public"; + $msgType = 'public'; # TODO: move this out of hookMsg to here? ($user,$host) = split(/\@/, $uh); $h = $host; @@ -894,7 +894,7 @@ sub on_public { $msgtime = time(); $lastWho{$chan} = $nick; ### TODO: use $nick or lc $nick? - if (&IsChanConf("seenStats") > 0) { + if (&IsChanConf('seenStats') > 0) { $userstats{lc $nick}{'Count'}++; $userstats{lc $nick}{'Time'} = time(); } @@ -903,7 +903,7 @@ sub on_public { my $time = time(); if (!$cache{ircTextCounters}) { &DEBUG("caching ircTextCounters for first time."); - my @str = split(/\s+/, &getChanConf("ircTextCounters")); + my @str = split(/\s+/, &getChanConf('ircTextCounters')); for (@str) { $_ = quotemeta($_); } $cache{ircTextCounters} = join('|', @str); } @@ -913,11 +913,11 @@ sub on_public { my $x = $1; &VERB("textcounters: $x matched for $who",2); - my $c = $chan || "PRIVATE"; + my $c = $chan || 'PRIVATE'; # better to do "counter=counter+1". # but that will avoid time check. - my ($v,$t) = &sqlSelect("stats", "counter,time", { + my ($v,$t) = &sqlSelect('stats', "counter,time", { nick => $who, type => $x, channel => $c, @@ -926,7 +926,7 @@ sub on_public { # don't allow ppl to cheat the stats :-) if (defined $t && $time - $t > 60) { - &sqlSet("stats", {'nick' => $who}, { + &sqlSet('stats', {'nick' => $who}, { type => $x, channel => $c, time => $time, @@ -937,9 +937,9 @@ sub on_public { &hookMsg('public', $chan, $nick, $msg); $chanstats{$chan}{'PublicMsg'}++; - $who = ""; - $chan = ""; - $msgType = ""; + $who = ''; + $chan = ''; + $msgType = ''; } sub on_quit { @@ -949,7 +949,7 @@ sub on_quit { my $reason = ($event->args)[0]; # hack for ICC. - $msgType = "public"; + $msgType = 'public'; $who = $nick; ### $chan = $reason; # no. @@ -973,7 +973,7 @@ sub on_quit { # chanlimit code. foreach $chan ( &getNickInChans($nick) ) { - next unless ( &IsChanConf("chanlimitcheck") > 0); + next unless ( &IsChanConf('chanlimitcheck') > 0); next unless ( exists $channels{$_}{'l'} ); &DEBUG("on_quit: netsplit detected on $_; disabling chan limit."); @@ -1000,7 +1000,7 @@ sub on_quit { # well.. it's good but weird that this has happened - lets just # be quiet about it. } - delete $userstats{lc $nick} if (&IsChanConf("seenStats") > 0); + delete $userstats{lc $nick} if (&IsChanConf('seenStats') > 0); delete $chanstats{lc $nick}; ### diff --git a/blootbot/src/IRC/Schedulers.pl b/blootbot/src/IRC/Schedulers.pl index b31a95c..a59c939 100644 --- a/blootbot/src/IRC/Schedulers.pl +++ b/blootbot/src/IRC/Schedulers.pl @@ -18,7 +18,7 @@ use vars qw(%sched %schedule); # ) #%schedule = { -# uptimeLoop => ("", 60, 1), +# uptimeLoop => ('', 60, 1), #}; sub setupSchedulersII { @@ -125,13 +125,13 @@ sub ScheduleThis { #### sub randomQuote { - my $interval = &getChanConfDefault("randomQuoteInterval", 60, $chan); + my $interval = &getChanConfDefault('randomQuoteInterval', 60, $chan); if (@_) { - &ScheduleThis($interval, "randomQuote"); - return if ($_[0] eq "2"); # defer. + &ScheduleThis($interval, 'randomQuote'); + return if ($_[0] eq '2'); # defer. } - foreach ( &ChanConfList("randomQuote") ) { + foreach ( &ChanConfList('randomQuote') ) { next unless (&validChan($_)); my $line = &getRandomLineFromFile($bot_data_dir. "/blootbot.randtext"); @@ -151,18 +151,18 @@ sub randomFactoid { my ($key,$val); my $error = 0; - my $interval = &getChanConfDefault("randomFactoidInterval", 60, $chan); + my $interval = &getChanConfDefault('randomFactoidInterval', 60, $chan); if (@_) { - &ScheduleThis($interval, "randomFactoid"); - return if ($_[0] eq "2"); # defer. + &ScheduleThis($interval, 'randomFactoid'); + return if ($_[0] eq '2'); # defer. } - foreach ( &ChanConfList("randomFactoid") ) { + foreach ( &ChanConfList('randomFactoid') ) { next unless (&validChan($_)); &status("sending random Factoid to $_."); while (1) { - ($key,$val) = &randKey("factoids","factoid_key,factoid_value"); + ($key,$val) = &randKey('factoids',"factoid_key,factoid_value"); &DEBUG("rF: $key, $val"); ### $val =~ tr/^[A-Z]/[a-z]/; # blah is Good => blah is good. last if ((defined $val) and ($val !~ /^ $param{'maxLogSize'}) { @@ -250,16 +250,16 @@ sub logLoop { sub seenFlushOld { if (@_) { - &ScheduleThis(1440, "seenFlushOld"); - return if ($_[0] eq "2"); # defer. + &ScheduleThis(1440, 'seenFlushOld'); + return if ($_[0] eq '2'); # defer. } # is this global-only? - return unless (&IsChanConf("seen") > 0); - return unless (&IsChanConf("seenFlushInterval") > 0); + return unless (&IsChanConf('seen') > 0); + return unless (&IsChanConf('seenFlushInterval') > 0); # global setting. does not make sense for per-channel. - my $max_time = &getChanConfDefault("seenMaxDays", 30, $chan) *60*60*24; + my $max_time = &getChanConfDefault('seenMaxDays', 30, $chan) *60*60*24; my $delete = 0; if ($param{'DBType'} =~ /^(pgsql|mysql|sqlite(2)?)$/i) { @@ -278,7 +278,7 @@ sub seenFlushOld { while (my @row = $sth->fetchrow_array) { my ($nick,$time) = @row; - &sqlDelete("seen", { nick => $nick } ); + &sqlDelete('seen', { nick => $nick } ); $delete++; } $sth->finish; @@ -292,8 +292,8 @@ sub seenFlushOld { sub newsFlush { if (@_) { - &ScheduleThis(60, "newsFlush"); - return if ($_[0] eq "2"); # defer. + &ScheduleThis(60, 'newsFlush'); + return if ($_[0] eq '2'); # defer. } if (!&ChanConfList('News')) { @@ -369,25 +369,25 @@ sub newsFlush { } sub chanlimitCheck { - my $interval = &getChanConfDefault("chanlimitcheckInterval", 10, $chan); + my $interval = &getChanConfDefault('chanlimitcheckInterval', 10, $chan); my $mynick=$conn->nick(); if (@_) { - &ScheduleThis($interval, "chanlimitCheck"); - return if ($_[0] eq "2"); + &ScheduleThis($interval, 'chanlimitCheck'); + return if ($_[0] eq '2'); } - my $str = join(' ', &ChanConfList("chanlimitcheck") ); + my $str = join(' ', &ChanConfList('chanlimitcheck') ); - foreach $chan ( &ChanConfList("chanlimitcheck") ) { + foreach $chan ( &ChanConfList('chanlimitcheck') ) { next unless (&validChan($chan)); - if ($chan eq "_default") { + if ($chan eq '_default') { &WARN("chanlimit: we're doing $chan!! HELP ME!"); next; } - my $limitplus = &getChanConfDefault("chanlimitcheckPlus", 5, $chan); + my $limitplus = &getChanConfDefault('chanlimitcheckPlus', 5, $chan); my $newlimit = scalar(keys %{ $channels{$chan}{''} }) + $limitplus; my $limit = $channels{$chan}{'l'}; @@ -441,8 +441,8 @@ sub netsplitCheck { my ($s1,$s2); if (@_) { - &ScheduleThis(15, "netsplitCheck"); - return if ($_[0] eq "2"); + &ScheduleThis(15, 'netsplitCheck'); + return if ($_[0] eq '2'); } $cache{'netsplitCache'}++; @@ -518,12 +518,12 @@ sub floodLoop { my $who; if (@_) { - &ScheduleThis(60, "floodLoop"); # minutes. - return if ($_[0] eq "2"); + &ScheduleThis(60, 'floodLoop'); # minutes. + return if ($_[0] eq '2'); } my $time = time(); - my $interval = &getChanConfDefault("floodCycle",60, $chan); + my $interval = &getChanConfDefault('floodCycle',60, $chan); foreach $who (keys %flood) { foreach (keys %{ $flood{$who} }) { @@ -543,21 +543,21 @@ sub floodLoop { sub seenFlush { if (@_) { - my $interval = &getChanConfDefault("seenFlushInterval", 60, $chan); - &ScheduleThis($interval, "seenFlush"); - return if ($_[0] eq "2"); + my $interval = &getChanConfDefault('seenFlushInterval', 60, $chan); + &ScheduleThis($interval, 'seenFlush'); + return if ($_[0] eq '2'); } my %stats; my $nick; my $flushed = 0; - $stats{'count_old'} = &countKeys("seen") || 0; + $stats{'count_old'} = &countKeys('seen') || 0; $stats{'new'} = 0; $stats{'old'} = 0; if ($param{'DBType'} =~ /^(mysql|pgsql|sqlite(2)?)$/i) { foreach $nick (keys %seencache) { - my $retval = &sqlSet("seen", {'nick' => lc $seencache{$nick}{'nick'}}, { + my $retval = &sqlSet('seen', {'nick' => lc $seencache{$nick}{'nick'}}, { time => $seencache{$nick}{'time'}, host => $seencache{$nick}{'host'}, channel => $seencache{$nick}{'chan'}, @@ -576,8 +576,8 @@ sub seenFlush { $stats{'new'}*100/($stats{'count_old'} || 1), $stats{'new'}, ( $stats{'count_old'} || 1) ), 2) if ($stats{'new'}); &VERB(sprintf(" now seen: %3.1f%% (%d/%d)", - $stats{'old'}*100 / ( &countKeys("seen") || 1), - $stats{'old'}, &countKeys("seen") ), 2) if ($stats{'old'}); + $stats{'old'}*100 / ( &countKeys('seen') || 1), + $stats{'old'}, &countKeys('seen') ), 2) if ($stats{'old'}); &WARN("scalar keys seenflush != 0!") if (scalar keys %seenflush); } @@ -587,8 +587,8 @@ sub leakCheck { my $count = 0; if (@_) { - &ScheduleThis(240, "leakCheck"); - return if ($_[0] eq "2"); + &ScheduleThis(240, 'leakCheck'); + return if ($_[0] eq '2'); } # flood. this is dealt with in floodLoop() @@ -643,8 +643,8 @@ sub leakCheck { sub ignoreCheck { if (@_) { - &ScheduleThis(60, "ignoreCheck"); - return if ($_[0] eq "2"); # defer. + &ScheduleThis(60, 'ignoreCheck'); + return if ($_[0] eq '2'); # defer. } my $time = time(); @@ -671,8 +671,8 @@ sub ignoreCheck { sub ircCheck { if (@_) { - &ScheduleThis(15, "ircCheck"); - return if ($_[0] eq "2"); # defer. + &ScheduleThis(15, 'ircCheck'); + return if ($_[0] eq '2'); # defer. } $cache{statusSafe} = 1; @@ -698,7 +698,7 @@ sub ircCheck { } else { &status('ircCheck: possible lost in space; checking.'. scalar(gmtime) ); - &msg($mynick, "TEST"); + &msg($mynick, 'TEST'); $cache{connect} = time(); } } @@ -729,8 +729,8 @@ sub ircCheck { sub miscCheck { if (@_) { - &ScheduleThis(120, "miscCheck"); - return if ($_[0] eq "2"); # defer. + &ScheduleThis(120, 'miscCheck'); + return if ($_[0] eq '2'); # defer. } # SHM check. @@ -787,8 +787,8 @@ sub miscCheck { sub miscCheck2 { if (@_) { - &ScheduleThis(240, "miscCheck2"); - return if ($_[0] eq "2"); # defer. + &ScheduleThis(240, 'miscCheck2'); + return if ($_[0] eq '2'); # defer. } # debian check. @@ -833,8 +833,8 @@ sub getNickInUse { # } # # if (@_) { -# &ScheduleThis(30, "getNickInUse"); -# return if ($_[0] eq "2"); # defer. +# &ScheduleThis(30, 'getNickInUse'); +# return if ($_[0] eq '2'); # defer. # } # # &nick( $param{'ircNick'} ); @@ -856,7 +856,7 @@ sub slashdotLoop { if (@_) { &ScheduleThis(60, 'slashdotLoop'); - return if ($_[0] eq "2"); + return if ($_[0] eq '2'); } my @chans = &ChanConfList('slashdotAnnounce'); @@ -879,7 +879,7 @@ sub plugLoop { if (@_) { &ScheduleThis(60, 'plugLoop'); - return if ($_[0] eq "2"); + return if ($_[0] eq '2'); } my @chans = &ChanConfList('plugAnnounce'); @@ -900,14 +900,14 @@ sub plugLoop { sub kernelLoop { if (@_) { - &ScheduleThis(240, "kernelLoop"); - return if ($_[0] eq "2"); + &ScheduleThis(240, 'kernelLoop'); + return if ($_[0] eq '2'); } - my @chans = &ChanConfList("kernelAnnounce"); + my @chans = &ChanConfList('kernelAnnounce'); return unless (scalar @chans); - &Forker("Kernel", sub { + &Forker('Kernel', sub { my @data = &Kernel::kernelAnnounce(); foreach (@chans) { @@ -928,12 +928,12 @@ sub wingateCheck { ### FILE CACHE OF OFFENDING WINGATES. foreach (grep /^$host$/, @wingateBad) { &status("Wingate: RUNNING ON $host BY $who"); - &ban("*!*\@$host", "") if &IsChanConf('wingateBan') > 0; + &ban("*!*\@$host", '') if &IsChanConf('wingateBan') > 0; my $reason = &getChanConf('wingateKick'); next unless ($reason); - &kick($who, "", $reason) + &kick($who, '', $reason) } ### RUN CACHE OF TRIED WINGATES. @@ -959,7 +959,7 @@ sub wingateCheck { sub wingateWriteFile { if (@_) { &ScheduleThis(60, 'wingateWriteFile'); - return if ($_[0] eq "2"); # defer. + return if ($_[0] eq '2'); # defer. } return unless (scalar @wingateCache); @@ -990,21 +990,21 @@ sub wingateWriteFile { sub factoidCheck { if (@_) { - &ScheduleThis(720, "factoidCheck"); - return if ($_[0] eq "2"); # defer. + &ScheduleThis(720, 'factoidCheck'); + return if ($_[0] eq '2'); # defer. } - my @list = &searchTable("factoids", "factoid_key", "factoid_key", " #DEL#"); - my $stale = &getChanConfDefault("factoidDeleteDelay", 14, $chan) *60*60*24; + my @list = &searchTable('factoids', 'factoid_key', 'factoid_key', " #DEL#"); + my $stale = &getChanConfDefault('factoidDeleteDelay', 14, $chan) *60*60*24; if ($stale < 1) { - # disable it since it's "illegal". + # disable it since it's 'illegal'. return; } my $time = time(); foreach (@list) { - my $age = &getFactInfo($_, "modified_time"); + my $age = &getFactInfo($_, 'modified_time'); if (!defined $age or $age !~ /^\d+$/) { if (scalar @list > 50) { @@ -1035,8 +1035,8 @@ sub dccStatus { return unless (scalar keys %{ $dcc{CHAT} }); if (@_) { - &ScheduleThis(10, "dccStatus"); - return if ($_[0] eq "2"); # defer. + &ScheduleThis(10, 'dccStatus'); + return if ($_[0] eq '2'); # defer. } my $time = strftime("%H:%M", gmtime(time()) ); @@ -1097,9 +1097,9 @@ sub mkBackup { return; } - my $age = "New"; + my $age = 'New'; if ( -e "$file~" ) { - $backup++ if ((stat $file)[9] - (stat "$file~")[9] > $time); + $backup++ if ((stat $file)[9] - (stat "$file~")[9] > $time); my $delta = time() - (stat "$file~")[9]; $age = &Time2String($delta); } else { diff --git a/blootbot/src/Misc.pl b/blootbot/src/Misc.pl index c768a53..47cbd36 100644 --- a/blootbot/src/Misc.pl +++ b/blootbot/src/Misc.pl @@ -17,7 +17,7 @@ sub help { my %help = (); # crude hack for performStrictReply() to work as expected. - $msgType = "private" if ($msgType eq "public"); + $msgType = 'private' if ($msgType eq 'public'); if (!open(FILE, $file)) { &ERROR("Failed reading help file ($file): $!"); @@ -39,12 +39,12 @@ sub help { $val =~ s/__/\037/g; $val =~ s/==/ /; - $help{$key} = "" if (!exists $help{$key}); + $help{$key} = '' if (!exists $help{$key}); $help{$key} .= $val."\n"; } close FILE; - if (!defined $topic or $topic eq "") { + if (!defined $topic or $topic eq '') { &msg($who, $help{'main'}); my $i = 0; @@ -165,7 +165,7 @@ sub formListReply { # Usage: &IJoin(@array); sub IJoin { if (!scalar @_) { - return "NULL"; + return 'NULL'; } elsif (scalar @_ == 1) { return $_[0]; } else { @@ -177,10 +177,10 @@ sub IJoin { # Usage: &Time2String(seconds); sub Time2String { my ($time) = @_; - my $prefix = ""; + my $prefix = ''; my (@s, @t); - return "NULL" if (!defined $time); + return 'NULL' if (!defined $time); return $time if ($time !~ /\d+/); if ($time < 0) { @@ -279,24 +279,24 @@ sub fixPlural { return $str; } - if ($str eq "has") { - $str = "have" if ($int > 1); - } elsif ($str eq "is") { - $str = "are" if ($int > 1); - } elsif ($str eq "was") { - $str = "were" if ($int > 1); - } elsif ($str eq "this") { - $str = "these" if ($int > 1); + if ($str eq 'has') { + $str = 'have' if ($int > 1); + } elsif ($str eq 'is') { + $str = 'are' if ($int > 1); + } elsif ($str eq 'was') { + $str = 'were' if ($int > 1); + } elsif ($str eq 'this') { + $str = 'these' if ($int > 1); } elsif ($str =~ /y$/) { if ($int > 1) { if ($str =~ /ey$/) { - $str .= "s"; # eg: "money" => "moneys". + $str .= 's'; # eg: 'money' => 'moneys'. } else { $str =~ s/y$/ies/; } } } else { - $str .= "s" if ($int != 1); + $str .= 's' if ($int != 1); } return $str; @@ -436,7 +436,7 @@ sub IsHostMatch { $this{'host'} = &makeHostMask(lc $3); } else { &WARN("IHM: thisnuh is invalid '$thisnuh'."); - return 1 if ($thisnuh eq ""); + return 1 if ($thisnuh eq ''); return 0; } @@ -501,7 +501,7 @@ sub isFileUpdated { # Usage: &makeHostMask($host); sub makeHostMask { my ($host) = @_; - my $nu = ""; + my $nu = ''; if ($host =~ s/^(\S+!\S+\@)//) { &DEBUG("mHM: detected nick!user\@ for host arg; fixing"); @@ -548,7 +548,7 @@ sub makeRandom { sub checkMsgType { my ($reply) = @_; - return unless (&IsParam("minLengthBeforePrivate")); + return unless (&IsParam('minLengthBeforePrivate')); return if ($force_public_reply); if (length $reply > $param{'minLengthBeforePrivate'}) { @@ -609,7 +609,7 @@ sub Forker { &shmFlush(); &VERB("double fork detected; not forking.",2) if ($$ != $bot_pid); - if (&IsParam("forking") and $$ == $bot_pid) { + if (&IsParam('forking') and $$ == $bot_pid) { return unless &addForked($label); $SIG{CHLD} = 'IGNORE'; @@ -655,13 +655,13 @@ sub mkcrypt { } sub closeStats { - return unless (&getChanConfList("ircTextCounters")); + return unless (&getChanConfList('ircTextCounters')); foreach (keys %cmdstats) { my $type = $_; - my $i = &sqlSelect("stats", "counter", { + my $i = &sqlSelect('stats', 'counter', { nick => $type, - type => "cmdstats", + type => 'cmdstats', } ); my $z = 0; $z++ unless ($i); @@ -669,8 +669,8 @@ sub closeStats { $i += $cmdstats{$type}; - &sqlSet("stats", {'nick' => $type}, { - type => "cmdstats", + &sqlSet('stats', {'nick' => $type}, { + type => 'cmdstats', 'time' => time(), counter => $i, } ); diff --git a/blootbot/src/Modules/BZFlag.pl b/blootbot/src/Modules/BZFlag.pl index 518efbe..69672c2 100755 --- a/blootbot/src/Modules/BZFlag.pl +++ b/blootbot/src/Modules/BZFlag.pl @@ -44,7 +44,7 @@ sub BZFlag { sub list { my ($response); my $ua = new LWP::UserAgent; - $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam("httpProxy")); + $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam('httpProxy')); $ua->timeout(5); @@ -58,7 +58,7 @@ sub list { my ($style, $maxShots, $shakeWins, $shakeTimeout, $maxPlayerScore, $maxTeamScore, $maxTime, $maxPlayers, $rogueSize, $rogueMax, $redSize, $redMax, $greenSize, $greenMax, $blueSize, $blueMax, $purpleSize, $purpleMax, $observerSize, $observerMax) = - unpack("A4A4A4A4A4A4A4A2A2A2A2A2A2A2A2A2A2A2A2A2", $flags); + unpack('A4A4A4A4A4A4A4A2A2A2A2A2A2A2A2A2A2A2A2A2', $flags); my $playerSize = hex($rogueSize) + hex($redSize) + hex($greenSize) + hex($blueSize) + hex($purpleSize) + hex($observerSize); $servers{$serverport} = $playerSize; @@ -79,7 +79,7 @@ sub list { sub list17 { my ($response); my $ua = new LWP::UserAgent; - $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam("httpProxy")); + $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam('httpProxy')); $ua->timeout(5); @@ -96,7 +96,7 @@ sub list17 { $rogueMax,$redMax,$greenMax,$blueMax,$purpleMax, $shakeWins,$shakeTimeout, $maxPlayerScore,$maxTeamScore,$maxTime) = - unpack("A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4", $flags); + unpack('A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4', $flags); my $playerSize = hex($rogueSize) + hex($redSize) + hex($greenSize) + hex($blueSize) + hex($purpleSize); $servers{$serverport} = $playerSize; @@ -120,8 +120,8 @@ sub querytext { &::status("BZFlag module requires Socket."); return 'BZFlag module not active'; } - #my @teamName = ("Rogue", "Red", "Green", "Blue", "Purple", "Observer", "Rabbit"); - my @teamName = ("X", "R", "G", "B", "P", "O", "K"); + #my @teamName = ('Rogue', 'Red', 'Green', 'Blue', 'Purple', 'Observer', 'Rabbit'); + my @teamName = ('X', 'R', 'G', 'B', 'P', 'O', 'K'); my ($message, $server, $response); $port = 5154 unless $port; @@ -154,26 +154,26 @@ sub querytext { my ($version) = $magic . $major . $minor . $something . $revision; # quit if version isn't valid - return 'not a bzflag server' if ($magic ne "BZFS"); + return 'not a bzflag server' if ($magic ne 'BZFS'); $response .= "$major$minor$something$revision "; # check version - if ($version eq "BZFS0026") { + if ($version eq 'BZFS0026') { # 1.11.x handled here return 'read error' unless read(S1, $buffer, 1) == 1; - my ($id) = unpack("C", $buffer); + my ($id) = unpack('C', $buffer); return "rejected by server" if ($id == 255); # send game request - print S1 pack("n2", 0, 0x7167); + print S1 pack('n2', 0, 0x7167); # get reply my $nbytes = read(S1, $buffer, 4); - my ($infolen, $infocode) = unpack("n2", $buffer); + my ($infolen, $infocode) = unpack('n2', $buffer); if ($infocode == 0x6774) { # read and ignore MsgGameTime from new servers $nbytes = read(S1, $buffer, 8); $nbytes = read(S1, $buffer, 4); - ($infolen, $infocode) = unpack("n2", $buffer); + ($infolen, $infocode) = unpack('n2', $buffer); } $nbytes = read(S1, $buffer, 42); if ($nbytes != 42) { @@ -184,15 +184,15 @@ sub querytext { $rogueSize,$redSize,$greenSize,$blueSize,$purpleSize,$observerSize, $rogueMax,$redMax,$greenMax,$blueMax,$purpleMax,$observerMax, $shakeWins,$shakeTimeout, - $maxPlayerScore,$maxTeamScore,$maxTime,$timeElapsed) = unpack("n23", $buffer); + $maxPlayerScore,$maxTeamScore,$maxTime,$timeElapsed) = unpack('n23', $buffer); return "bad server data $infocode" unless $infocode == 0x7167; # send players request - print S1 pack("n2", 0, 0x7170); + print S1 pack('n2', 0, 0x7170); # get number of teams and players we'll be receiving return 'count read error' unless read(S1, $buffer, 8) == 8; - my ($countlen,$countcode,$numTeams,$numPlayers) = unpack("n4", $buffer); + my ($countlen,$countcode,$numTeams,$numPlayers) = unpack('n4', $buffer); # get the teams return 'bad count data' unless $countcode == 0x7170; @@ -200,7 +200,7 @@ sub querytext { ($countlen,$countcode,$numTeams) = unpack("n n C", $buffer); for (1..$numTeams) { return 'team read error' unless read(S1, $buffer, 8) == 8; - my ($team,$size,$won,$lost) = unpack("n4", $buffer); + my ($team,$size,$won,$lost) = unpack('n4', $buffer); if ($size > 0) { my $score = $won - $lost; $response .= "$teamName[$team]:$score($won-$lost) "; @@ -211,7 +211,7 @@ sub querytext { for (1..$numPlayers) { last unless read(S1, $buffer, 175) == 175; my ($playerlen,$playercode,$pID,$type,$team,$won,$lost,$tks,$sign,$email) = - unpack("n2Cn5A32A128", $buffer); + unpack('n2Cn5A32A128', $buffer); #my ($playerlen,$playercode,$pAddr,$pPort,$pNum,$type,$team,$won,$lost,$sign,$email) = # unpack("n2Nn2 n4A32A128", $buffer); return 'bad player data' unless $playercode == 0x6170; @@ -227,10 +227,10 @@ sub querytext { # 1.10.x handled here $revision = $something * 10 + $revision; return 'read error' unless read(S1, $buffer, 1) == 1; - my ($id) = unpack("C", $buffer); + my ($id) = unpack('C', $buffer); # send game request - print S1 pack("n2", 0, 0x7167); + print S1 pack('n2', 0, 0x7167); # FIXME the packets are wrong from here down # get reply @@ -239,15 +239,15 @@ sub querytext { $rogueSize,$redSize,$greenSize,$blueSize,$purpleSize, $rogueMax,$redMax,$greenMax,$blueMax,$purpleMax, $shakeWins,$shakeTimeout, - $maxPlayerScore,$maxTeamScore,$maxTime) = unpack("n20", $buffer); + $maxPlayerScore,$maxTeamScore,$maxTime) = unpack('n20', $buffer); return 'bad server data' unless $infocode == 0x7167; # send players request - print S1 pack("n2", 0, 0x7170); + print S1 pack('n2', 0, 0x7170); # get number of teams and players we'll be receiving return 'count read error' unless read(S1, $buffer, 8) == 8; - my ($countlen,$countcode,$numTeams,$numPlayers) = unpack("n4", $buffer); + my ($countlen,$countcode,$numTeams,$numPlayers) = unpack('n4', $buffer); # get the teams return 'bad count data' unless $countcode == 0x7170; @@ -255,7 +255,7 @@ sub querytext { ($countlen,$countcode,$numTeams) = unpack("n n C", $buffer); for (1..$numTeams) { return 'team read error' unless read(S1, $buffer, 8) == 8; - my ($team,$size,$won,$lost) = unpack("n4", $buffer); + my ($team,$size,$won,$lost) = unpack('n4', $buffer); if ($size > 0) { my $score = $won - $lost; $response .= "$teamName[$team]:$score($won-$lost) "; @@ -266,7 +266,7 @@ sub querytext { for (1..$numPlayers) { last unless read(S1, $buffer, 175) == 175; my ($playerlen,$playercode,$pID,$type,$team,$won,$lost,$tks,$sign,$email) = - unpack("n2Cn5A32A128", $buffer); + unpack('n2Cn5A32A128', $buffer); #my ($playerlen,$playercode,$pAddr,$pPort,$pNum,$type,$team,$won,$lost,$sign,$email) = # unpack("n2Nn2 n4A32A128", $buffer); return 'bad player data' unless $playercode == 0x6170; @@ -283,7 +283,7 @@ sub querytext { # 1.7* versions handled here # old servers send a reconnect port number return 'read error' unless read(S1, $buffer, 2) == 2; - my ($reconnect) = unpack("n", $buffer); + my ($reconnect) = unpack('n', $buffer); $minor = $minor * 10 + $something; # quit if rejected return 'rejected by server' if ($reconnect == 0); @@ -298,7 +298,7 @@ sub querytext { close(S1); # send game request - print S pack("n2", 0, 0x7167); + print S pack('n2', 0, 0x7167); # get reply return 'server read error' unless read(S, $buffer, 40) == 40; @@ -306,21 +306,21 @@ sub querytext { $rogueSize,$redSize,$greenSize,$blueSize,$purpleSize, $rogueMax,$redMax,$greenMax,$blueMax,$purpleMax, $shakeWins,$shakeTimeout, - $maxPlayerScore,$maxTeamScore,$maxTime) = unpack("n20", $buffer); + $maxPlayerScore,$maxTeamScore,$maxTime) = unpack('n20', $buffer); return 'bad server data' unless $infocode == 0x7167; # send players request - print S pack("n2", 0, 0x7170); + print S pack('n2', 0, 0x7170); # get number of teams and players we'll be receiving return 'count read error' unless read(S, $buffer, 8) == 8; - my ($countlen,$countcode,$numTeams,$numPlayers) = unpack("n4", $buffer); + my ($countlen,$countcode,$numTeams,$numPlayers) = unpack('n4', $buffer); return 'bad count data' unless $countcode == 0x7170; # get the teams for (1..$numTeams) { return 'team read error' unless read(S, $buffer, 14) == 14; - my ($teamlen,$teamcode,$team,$size,$aSize,$won,$lost) = unpack("n7", $buffer); + my ($teamlen,$teamcode,$team,$size,$aSize,$won,$lost) = unpack('n7', $buffer); return 'bad team data' unless $teamcode == 0x7475; if ($size > 0) { my $score = $won - $lost; diff --git a/blootbot/src/Modules/Debian.pl b/blootbot/src/Modules/Debian.pl index 0e2eaf5..6d0e396 100644 --- a/blootbot/src/Modules/Debian.pl +++ b/blootbot/src/Modules/Debian.pl @@ -210,7 +210,7 @@ sub searchContents { $grepRE = "$query*\[ \t]"; } - # fix up grepRE for "*". + # fix up grepRE for '*'. $grepRE =~ s/\*/.*/g; my @files; @@ -327,7 +327,7 @@ sub searchContents { } elsif (scalar @list == 1) { # list = 1. &::DEBUG("deb: list == 1; showing package info of '$list[0]'."); - &infoPackages("info", $list[0]); + &infoPackages('info', $list[0]); } else { # list > 1. my $prefix = "Debian Desc Search of '$query' "; @@ -382,13 +382,13 @@ sub searchAuthor { } elsif (/^Maintainer: (.*) \<(\S+)\>$/) { my($name,$email) = ($1,$2); - if ($package eq "") { + if ($package eq '') { &::DEBUG("deb: sA: package == NULL."); next; } $maint{$name}{$email} = 1; $pkg{$name}{$package} = 1; - $package = ""; + $package = ''; } else { chop; @@ -492,13 +492,13 @@ sub searchDesc { next unless (eval { $desc =~ /$regex/i }); return unless &checkEval($@); - if ($package eq "") { + if ($package eq '') { &::WARN("sD: package == NULL?"); next; } $desc{$package} = $desc; - $package = ""; + $package = ''; } else { chop; @@ -546,7 +546,7 @@ sub generateIncoming { print IDX "$1\n"; print PKG "Package: $1\n"; print PKG "Version: $2\n"; - print PKG "Architecture: ", (defined $4) ? $4 : "all", "\n"; + print PKG "Architecture: ", (defined $4) ? $4 : 'all', "\n"; } print PKG "Filename: $file\n"; print PKG "Size: $ftp{$file}\n"; @@ -658,7 +658,7 @@ sub infoPackages { # download packages file. # hrm... my %urls = &fixDist($dist, %urlpackages); - if ($dist ne "incoming") { + if ($dist ne 'incoming') { &::DEBUG("deb: download 3.") if ($debug); if (!&DebianDownload($dist, %urls)) { # no good download. @@ -671,7 +671,7 @@ sub infoPackages { my @files = &validPackage($package, $dist); if (!scalar @files) { &::status("Debian: no valid package found; checking incoming."); - @files = &validPackage($package, "incoming"); + @files = &validPackage($package, 'incoming'); if (scalar @files) { &::status("Debian: cool, it exists in incoming."); @@ -709,10 +709,10 @@ sub infoPackages { } my %pkg = &getPackageInfo($package, $file); - $query = "info" if ($query eq "dinfo"); + $query = 'info' if ($query eq 'dinfo'); # 'fm'-like output. - if ($query eq "info") { + if ($query eq 'info') { if (scalar keys %pkg <= 5) { &::DEBUG("deb: running debianCheck() due to problems (".scalar(keys %pkg).")."); &debianCheck(); @@ -742,20 +742,20 @@ sub infoPackages { } } - if ($dist eq "incoming") { + if ($dist eq 'incoming') { $pkg{'info'} .= "Version: \002$pkg{'version'}\002"; $pkg{'info'} .= ", Packaged size: \002". int($pkg{'size'}/1024) ."\002 kB"; $pkg{'info'} .= ", is in incoming!!!"; } if (!exists $pkg{$query}) { - if ($query eq "suggests") { + if ($query eq 'suggests') { $pkg{$query} = "has no suggestions"; - } elsif ($query eq "conflicts") { + } elsif ($query eq 'conflicts') { $pkg{$query} = "does not conflict with any other package"; - } elsif ($query eq "depends") { + } elsif ($query eq 'depends') { $pkg{$query} = "does not depend on anything"; - } elsif ($query eq "maint") { + } elsif ($query eq 'maint') { $pkg{$query} = "has no maintainer"; } else { $pkg{$query} = "has nothing about $query"; @@ -967,7 +967,7 @@ sub searchPackage { unlink $file if ( -z $file ); while (!open IN, $file) { - if ($dist eq "incoming") { + if ($dist eq 'incoming') { &::DEBUG("deb: sP: dist == incoming; calling gI()."); &generateIncoming(); } @@ -1015,7 +1015,7 @@ sub searchPackage { sub getDistro { my $dist = $_[0]; - if (!defined $dist or $dist eq "") { + if (!defined $dist or $dist eq '') { &::DEBUG("deb: gD: dist == NULL; dist = defaultdist."); $dist = $defaultdist; } @@ -1077,10 +1077,10 @@ sub DebianFind { my @results = sort &searchPackage($str); if (!scalar @results) { - &::Forker("Debian", sub { &searchContents($str); } ); + &::Forker('Debian', sub { &searchContents($str); } ); } elsif (scalar @results == 1) { &::status("searchPackage returned one result; getting info of package instead!"); - &::Forker("Debian", sub { &infoPackages("info", "$results[0] $dist"); } ); + &::Forker('Debian', sub { &infoPackages('info', "$results[0] $dist"); } ); } else { my $prefix = "Debian Package Listing of '$query' "; &::performStrictReply( &::formListReply(0, $prefix, @results) ); @@ -1146,7 +1146,7 @@ sub searchDescFE { &::performStrictReply( &::formListReply(0, $prefix, ) ); } elsif (scalar @list == 1) { # list = 1. &::DEBUG("deb: list == 1; showing package info of '$list[0]'."); - &infoPackages("info", $list[0]); + &infoPackages('info', $list[0]); } else { # list > 1. my $prefix = "Debian Desc Search of '$query' "; &::performStrictReply( &::formListReply(0, $prefix, @list) ); diff --git a/blootbot/src/Modules/Dict.pl b/blootbot/src/Modules/Dict.pl index 05b3d0f..8fccf13 100644 --- a/blootbot/src/Modules/Dict.pl +++ b/blootbot/src/Modules/Dict.pl @@ -37,7 +37,7 @@ sub Dict { my $socket = new IO::Socket; socket($socket, PF_INET, SOCK_STREAM, $proto) or return "error: socket: $!"; eval { - local $SIG{ALRM} = sub { die "alarm" }; + local $SIG{ALRM} = sub { die 'alarm' }; alarm 10; connect($socket, sockaddr_in($port, inet_aton($server))) or die "error: connect: $!"; alarm 0; @@ -110,7 +110,7 @@ sub Define { &::DEBUG("Dict: asking $dict."); print $socket "DEFINE $dict \"$query\"\n"; - my $def = ""; + my $def = ''; my $term = $query; while (<$socket>) { @@ -148,7 +148,7 @@ sub Define { $def =~ s/\s+$//; #&::DEBUG("def => '$def'."); $def =~ s/\[[^\]]*\]//g; - push(@results, $def) if ($def ne ""); + push(@results, $def) if ($def ne ''); $def = $text; } elsif (/^\s+(.*)/) { $def .= $line; diff --git a/blootbot/src/Modules/DumpVars.pl b/blootbot/src/Modules/DumpVars.pl index 2e9fa97..80037b0 100644 --- a/blootbot/src/Modules/DumpVars.pl +++ b/blootbot/src/Modules/DumpVars.pl @@ -15,7 +15,7 @@ my $countlines = 0; sub dumpvarslog { my ($line) = @_; - if (&IsParam("dumpvarsLogFile")) { + if (&IsParam('dumpvarsLogFile')) { print DUMPVARS $line."\n"; } else { &status("DV: ".$line); @@ -28,7 +28,7 @@ sub DumpNames(\%$) { my $line; if ($packname eq 'main::') { - &dumpvarslog("Packages"); + &dumpvarslog('Packages'); foreach $symname (sort keys %$package) { local *sym = $$package{$symname}; @@ -113,7 +113,7 @@ sub DumpNames(\%$) { } sub dumpallvars { - if (&IsParam("dumpvarsLogFile")) { + if (&IsParam('dumpvarsLogFile')) { my $file = $param{'dumpvarsLogFile'}; &status("opening fh to dumpvars ($file)"); if (!open(DUMPVARS,">$file")) { @@ -124,7 +124,7 @@ sub dumpallvars { DumpNames(%main::,'main::'); - if (&IsParam("dumpvarsLogFile")) { + if (&IsParam('dumpvarsLogFile')) { &status("closing fh to dumpvars"); close DUMPVARS; } diff --git a/blootbot/src/Modules/DumpVars2.pl b/blootbot/src/Modules/DumpVars2.pl index ddff6fa..2049846 100644 --- a/blootbot/src/Modules/DumpVars2.pl +++ b/blootbot/src/Modules/DumpVars2.pl @@ -32,7 +32,7 @@ sub symdumpAll { sub symdumpRecur { my $x = shift; - if (ref $x eq "HASH") { + if (ref $x eq 'HASH') { foreach (keys %$x) { &symdumpRecur($_); } diff --git a/blootbot/src/Modules/Exchange.pl b/blootbot/src/Modules/Exchange.pl index ae8470f..71dc58b 100644 --- a/blootbot/src/Modules/Exchange.pl +++ b/blootbot/src/Modules/Exchange.pl @@ -1,6 +1,6 @@ #!/usr/bin/perl -# Exchange.pl - currency exchange "module" +# Exchange.pl - currency exchange 'module' # # Last update: 990818 08:30:10, bobby@bofh.dk # 20021111 Tim Riker @@ -30,245 +30,245 @@ sub GetAbb { sub GetTlds { my %Hash = ( - "AF", "AFGHANISTAN", - "AL", "ALBANIA", - "DZ", "ALGERIA", - "AS", "AMERICAN SAMOA", - "AD", "ANDORRA", - "AO", "ANGOLA", - "AI", "ANGUILLA", - "AQ", "ANTARCTICA", - "AG", "ANTIGUA AND BARBUDA", - "AR", "ARGENTINA", - "AM", "ARMENIA", - "AW", "ARUBA", - "AU", "AUSTRALIA", - "AT", "AUSTRIA", - "AZ", "AZERBAIJAN", - "BS", "BAHAMAS", - "BH", "BAHRAIN", - "BD", "BANGLADESH", - "BB", "BARBADOS", - "BY", "BELARUS", - "BE", "BELGIUM", - "BZ", "BELIZE", - "BJ", "BENIN", - "BM", "BERMUDA", - "BT", "BHUTAN", - "BO", "BOLIVIA", - "BA", "BOSNIA AND HERZEGOWINA", - "BW", "BOTSWANA", - "BV", "BOUVET ISLAND", - "BR", "BRAZIL", - "IO", "BRITISH INDIAN OCEAN TERRITORY", - "BN", "BRUNEI DARUSSALAM", - "BG", "BULGARIA", - "BF", "BURKINA FASO", - "BI", "BURUNDI", - "KH", "CAMBODIA", - "CM", "CAMEROON", - "CA", "CANADA", - "CV", "CAPE VERDE", - "KY", "CAYMAN ISLANDS", - "CF", "CENTRAL AFRICAN REPUBLIC", - "TD", "CHAD", - "CL", "CHILE", - "CN", "CHINA", - "CX", "CHRISTMAS ISLAND", - "CC", "COCOS (KEELING) ISLANDS", - "CO", "COLOMBIA", - "KM", "COMOROS", - "CG", "CONGO", - "CD", "CONGO, THE DEMOCRATIC REPUBLIC OF THE", - "CK", "COOK ISLANDS", - "CR", "COSTA RICA", - "CI", "COTE D'IVOIRE", - "HR", "CROATIA (local name: Hrvatska)", - "CU", "CUBA", - "CY", "CYPRUS", - "CZ", "CZECH REPUBLIC", - "DK", "DENMARK", - "DJ", "DJIBOUTI", - "DM", "DOMINICA", - "DO", "DOMINICAN REPUBLIC", - "TP", "EAST TIMOR", - "EC", "ECUADOR", - "EG", "EGYPT", - "SV", "EL SALVADOR", - "GQ", "EQUATORIAL GUINEA", - "ER", "ERITREA", - "EE", "ESTONIA", - "ET", "ETHIOPIA", - "FK", "FALKLAND ISLANDS (MALVINAS)", - "FO", "FAROE ISLANDS", - "FJ", "FIJI", - "FI", "FINLAND", - "FR", "FRANCE", - "FX", "FRANCE, METROPOLITAN", - "GF", "FRENCH GUIANA", - "PF", "FRENCH POLYNESIA", - "TF", "FRENCH SOUTHERN TERRITORIES", - "GA", "GABON", - "GM", "GAMBIA", - "GE", "GEORGIA", - "DE", "GERMANY", - "GH", "GHANA", - "GI", "GIBRALTAR", - "GR", "GREECE", - "GL", "GREENLAND", - "GD", "GRENADA", - "GP", "GUADELOUPE", - "GU", "GUAM", - "GT", "GUATEMALA", - "GN", "GUINEA", - "GW", "GUINEA-BISSAU", - "GY", "GUYANA", - "HT", "HAITI", - "HM", "HEARD AND MC DONALD ISLANDS", - "VA", "HOLY SEE (VATICAN CITY STATE)", - "HN", "HONDURAS", - "HK", "HONG KONG", - "HU", "HUNGARY", - "IS", "ICELAND", - "IN", "INDIA", - "ID", "INDONESIA", - "IR", "IRAN (ISLAMIC REPUBLIC OF)", - "IQ", "IRAQ", - "IE", "IRELAND", - "IL", "ISRAEL", - "IT", "ITALY", - "JM", "JAMAICA", - "JP", "JAPAN", - "JO", "JORDAN", - "KZ", "KAZAKHSTAN", - "KE", "KENYA", - "KI", "KIRIBATI", - "KP", "KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF", - "KR", "KOREA, REPUBLIC OF", - "KW", "KUWAIT", - "KG", "KYRGYZSTAN", - "LA", "LAO PEOPLE'S DEMOCRATIC REPUBLIC", - "LV", "LATVIA", - "LB", "LEBANON", - "LS", "LESOTHO", - "LR", "LIBERIA", - "LY", "LIBYAN ARAB JAMAHIRIYA", - "LI", "LIECHTENSTEIN", - "LT", "LITHUANIA", - "LU", "LUXEMBOURG", - "MO", "MACAU", - "MK", "MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF", - "MG", "MADAGASCAR", - "MW", "MALAWI", - "MY", "MALAYSIA", - "MV", "MALDIVES", - "ML", "MALI", - "MT", "MALTA", - "MH", "MARSHALL ISLANDS", - "MQ", "MARTINIQUE", - "MR", "MAURITANIA", - "MU", "MAURITIUS", - "YT", "MAYOTTE", - "MX", "MEXICO", - "FM", "MICRONESIA, FEDERATED STATES OF", - "MD", "MOLDOVA, REPUBLIC OF", - "MC", "MONACO", - "MN", "MONGOLIA", - "MS", "MONTSERRAT", - "MA", "MOROCCO", - "MZ", "MOZAMBIQUE", - "MM", "MYANMAR", - "NA", "NAMIBIA", - "NR", "NAURU", - "NP", "NEPAL", - "NL", "NETHERLANDS", - "AN", "NETHERLANDS ANTILLES", - "NC", "NEW CALEDONIA", - "NZ", "NEW ZEALAND", - "NI", "NICARAGUA", - "NE", "NIGER", - "NG", "NIGERIA", - "NU", "NIUE", - "NF", "NORFOLK ISLAND", - "MP", "NORTHERN MARIANA ISLANDS", - "NO", "NORWAY", - "OM", "OMAN", - "PK", "PAKISTAN", - "PW", "PALAU", - "PA", "PANAMA", - "PG", "PAPUA NEW GUINEA", - "PY", "PARAGUAY", - "PE", "PERU", - "PH", "PHILIPPINES", - "PN", "PITCAIRN", - "PL", "POLAND", - "PT", "PORTUGAL", - "PR", "PUERTO RICO", - "QA", "QATAR", - "RE", "REUNION", - "RO", "ROMANIA", - "RU", "RUSSIAN FEDERATION", - "RW", "RWANDA", - "KN", "SAINT KITTS AND NEVIS", - "LC", "SAINT LUCIA", - "VC", "SAINT VINCENT AND THE GRENADINES", - "WS", "SAMOA", - "SM", "SAN MARINO", - "ST", "SAO TOME AND PRINCIPE", - "SA", "SAUDI ARABIA", - "SN", "SENEGAL", - "SC", "SEYCHELLES", - "SL", "SIERRA LEONE", - "SG", "SINGAPORE", - "SK", "SLOVAKIA (Slovak Republic)", - "SI", "SLOVENIA", - "SB", "SOLOMON ISLANDS", - "SO", "SOMALIA", - "ZA", "SOUTH AFRICA", - "GS", "SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS", - "ES", "SPAIN", - "LK", "SRI LANKA", - "SH", "ST. HELENA", - "PM", "ST. PIERRE AND MIQUELON", - "SD", "SUDAN", - "SR", "SURINAME", - "SJ", "SVALBARD AND JAN MAYEN ISLANDS", - "SZ", "SWAZILAND", - "SE", "SWEDEN", - "CH", "SWITZERLAND", - "SY", "SYRIAN ARAB REPUBLIC", - "TW", "TAIWAN, PROVINCE OF CHINA", - "TJ", "TAJIKISTAN", - "TZ", "TANZANIA, UNITED REPUBLIC OF", - "TH", "THAILAND", - "TG", "TOGO", - "TK", "TOKELAU", - "TO", "TONGA", - "TT", "TRINIDAD AND TOBAGO", - "TN", "TUNISIA", - "TR", "TURKEY", - "TM", "TURKMENISTAN", - "TC", "TURKS AND CAICOS ISLANDS", - "TV", "TUVALU", - "UG", "UGANDA", - "UA", "UKRAINE", - "AE", "UNITED ARAB EMIRATES", - "GB", "UNITED KINGDOM", - "US", "UNITED STATES", - "UM", "UNITED STATES MINOR OUTLYING ISLANDS", - "UY", "URUGUAY", - "UZ", "UZBEKISTAN", - "VU", "VANUATU", - "VE", "VENEZUELA", - "VN", "VIET NAM", - "VG", "VIRGIN ISLANDS (BRITISH)", - "VI", "VIRGIN ISLANDS (U.S.)", - "WF", "WALLIS AND FUTUNA ISLANDS", - "EH", "WESTERN SAHARA", - "YE", "YEMEN", - "YU", "YUGOSLAVIA", - "ZM", "ZAMBIA", - "ZW", "ZIMBABWE", + 'AF', 'AFGHANISTAN', + 'AL', 'ALBANIA', + 'DZ', 'ALGERIA', + 'AS', 'AMERICAN SAMOA', + 'AD', 'ANDORRA', + 'AO', 'ANGOLA', + 'AI', 'ANGUILLA', + 'AQ', 'ANTARCTICA', + 'AG', 'ANTIGUA AND BARBUDA', + 'AR', 'ARGENTINA', + 'AM', 'ARMENIA', + 'AW', 'ARUBA', + 'AU', 'AUSTRALIA', + 'AT', 'AUSTRIA', + 'AZ', 'AZERBAIJAN', + 'BS', 'BAHAMAS', + 'BH', 'BAHRAIN', + 'BD', 'BANGLADESH', + 'BB', 'BARBADOS', + 'BY', 'BELARUS', + 'BE', 'BELGIUM', + 'BZ', 'BELIZE', + 'BJ', 'BENIN', + 'BM', 'BERMUDA', + 'BT', 'BHUTAN', + 'BO', 'BOLIVIA', + 'BA', 'BOSNIA AND HERZEGOWINA', + 'BW', 'BOTSWANA', + 'BV', 'BOUVET ISLAND', + 'BR', 'BRAZIL', + 'IO', 'BRITISH INDIAN OCEAN TERRITORY', + 'BN', 'BRUNEI DARUSSALAM', + 'BG', 'BULGARIA', + 'BF', 'BURKINA FASO', + 'BI', 'BURUNDI', + 'KH', 'CAMBODIA', + 'CM', 'CAMEROON', + 'CA', 'CANADA', + 'CV', 'CAPE VERDE', + 'KY', 'CAYMAN ISLANDS', + 'CF', 'CENTRAL AFRICAN REPUBLIC', + 'TD', 'CHAD', + 'CL', 'CHILE', + 'CN', 'CHINA', + 'CX', 'CHRISTMAS ISLAND', + 'CC', 'COCOS (KEELING) ISLANDS', + 'CO', 'COLOMBIA', + 'KM', 'COMOROS', + 'CG', 'CONGO', + 'CD', 'CONGO, THE DEMOCRATIC REPUBLIC OF THE', + 'CK', 'COOK ISLANDS', + 'CR', 'COSTA RICA', + 'CI', "COTE D'IVOIRE", + 'HR', 'CROATIA (local name: Hrvatska)', + 'CU', 'CUBA', + 'CY', 'CYPRUS', + 'CZ', 'CZECH REPUBLIC', + 'DK', 'DENMARK', + 'DJ', 'DJIBOUTI', + 'DM', 'DOMINICA', + 'DO', 'DOMINICAN REPUBLIC', + 'TP', 'EAST TIMOR', + 'EC', 'ECUADOR', + 'EG', 'EGYPT', + 'SV', 'EL SALVADOR', + 'GQ', 'EQUATORIAL GUINEA', + 'ER', 'ERITREA', + 'EE', 'ESTONIA', + 'ET', 'ETHIOPIA', + 'FK', 'FALKLAND ISLANDS (MALVINAS)', + 'FO', 'FAROE ISLANDS', + 'FJ', 'FIJI', + 'FI', 'FINLAND', + 'FR', 'FRANCE', + 'FX', 'FRANCE, METROPOLITAN', + 'GF', 'FRENCH GUIANA', + 'PF', 'FRENCH POLYNESIA', + 'TF', 'FRENCH SOUTHERN TERRITORIES', + 'GA', 'GABON', + 'GM', 'GAMBIA', + 'GE', 'GEORGIA', + 'DE', 'GERMANY', + 'GH', 'GHANA', + 'GI', 'GIBRALTAR', + 'GR', 'GREECE', + 'GL', 'GREENLAND', + 'GD', 'GRENADA', + 'GP', 'GUADELOUPE', + 'GU', 'GUAM', + 'GT', 'GUATEMALA', + 'GN', 'GUINEA', + 'GW', 'GUINEA-BISSAU', + 'GY', 'GUYANA', + 'HT', 'HAITI', + 'HM', 'HEARD AND MC DONALD ISLANDS', + 'VA', 'HOLY SEE (VATICAN CITY STATE)', + 'HN', 'HONDURAS', + 'HK', 'HONG KONG', + 'HU', 'HUNGARY', + 'IS', 'ICELAND', + 'IN', 'INDIA', + 'ID', 'INDONESIA', + 'IR', 'IRAN (ISLAMIC REPUBLIC OF)', + 'IQ', 'IRAQ', + 'IE', 'IRELAND', + 'IL', 'ISRAEL', + 'IT', 'ITALY', + 'JM', 'JAMAICA', + 'JP', 'JAPAN', + 'JO', 'JORDAN', + 'KZ', 'KAZAKHSTAN', + 'KE', 'KENYA', + 'KI', 'KIRIBATI', + 'KP', "KOREA, DEMOCRATIC PEOPLE'S REPUBLIC OF", + 'KR', 'KOREA, REPUBLIC OF', + 'KW', 'KUWAIT', + 'KG', 'KYRGYZSTAN', + 'LA', "LAO PEOPLE'S DEMOCRATIC REPUBLIC", + 'LV', 'LATVIA', + 'LB', 'LEBANON', + 'LS', 'LESOTHO', + 'LR', 'LIBERIA', + 'LY', 'LIBYAN ARAB JAMAHIRIYA', + 'LI', 'LIECHTENSTEIN', + 'LT', 'LITHUANIA', + 'LU', 'LUXEMBOURG', + 'MO', 'MACAU', + 'MK', 'MACEDONIA, THE FORMER YUGOSLAV REPUBLIC OF', + 'MG', 'MADAGASCAR', + 'MW', 'MALAWI', + 'MY', 'MALAYSIA', + 'MV', 'MALDIVES', + 'ML', 'MALI', + 'MT', 'MALTA', + 'MH', 'MARSHALL ISLANDS', + 'MQ', 'MARTINIQUE', + 'MR', 'MAURITANIA', + 'MU', 'MAURITIUS', + 'YT', 'MAYOTTE', + 'MX', 'MEXICO', + 'FM', 'MICRONESIA, FEDERATED STATES OF', + 'MD', 'MOLDOVA, REPUBLIC OF', + 'MC', 'MONACO', + 'MN', 'MONGOLIA', + 'MS', 'MONTSERRAT', + 'MA', 'MOROCCO', + 'MZ', 'MOZAMBIQUE', + 'MM', 'MYANMAR', + 'NA', 'NAMIBIA', + 'NR', 'NAURU', + 'NP', 'NEPAL', + 'NL', 'NETHERLANDS', + 'AN', 'NETHERLANDS ANTILLES', + 'NC', 'NEW CALEDONIA', + 'NZ', 'NEW ZEALAND', + 'NI', 'NICARAGUA', + 'NE', 'NIGER', + 'NG', 'NIGERIA', + 'NU', 'NIUE', + 'NF', 'NORFOLK ISLAND', + 'MP', 'NORTHERN MARIANA ISLANDS', + 'NO', 'NORWAY', + 'OM', 'OMAN', + 'PK', 'PAKISTAN', + 'PW', 'PALAU', + 'PA', 'PANAMA', + 'PG', 'PAPUA NEW GUINEA', + 'PY', 'PARAGUAY', + 'PE', 'PERU', + 'PH', 'PHILIPPINES', + 'PN', 'PITCAIRN', + 'PL', 'POLAND', + 'PT', 'PORTUGAL', + 'PR', 'PUERTO RICO', + 'QA', 'QATAR', + 'RE', 'REUNION', + 'RO', 'ROMANIA', + 'RU', 'RUSSIAN FEDERATION', + 'RW', 'RWANDA', + 'KN', 'SAINT KITTS AND NEVIS', + 'LC', 'SAINT LUCIA', + 'VC', 'SAINT VINCENT AND THE GRENADINES', + 'WS', 'SAMOA', + 'SM', 'SAN MARINO', + 'ST', 'SAO TOME AND PRINCIPE', + 'SA', 'SAUDI ARABIA', + 'SN', 'SENEGAL', + 'SC', 'SEYCHELLES', + 'SL', 'SIERRA LEONE', + 'SG', 'SINGAPORE', + 'SK', 'SLOVAKIA (Slovak Republic)', + 'SI', 'SLOVENIA', + 'SB', 'SOLOMON ISLANDS', + 'SO', 'SOMALIA', + 'ZA', 'SOUTH AFRICA', + 'GS', 'SOUTH GEORGIA AND THE SOUTH SANDWICH ISLANDS', + 'ES', 'SPAIN', + 'LK', 'SRI LANKA', + 'SH', 'ST. HELENA', + 'PM', 'ST. PIERRE AND MIQUELON', + 'SD', 'SUDAN', + 'SR', 'SURINAME', + 'SJ', 'SVALBARD AND JAN MAYEN ISLANDS', + 'SZ', 'SWAZILAND', + 'SE', 'SWEDEN', + 'CH', 'SWITZERLAND', + 'SY', 'SYRIAN ARAB REPUBLIC', + 'TW', 'TAIWAN, PROVINCE OF CHINA', + 'TJ', 'TAJIKISTAN', + 'TZ', 'TANZANIA, UNITED REPUBLIC OF', + 'TH', 'THAILAND', + 'TG', 'TOGO', + 'TK', 'TOKELAU', + 'TO', 'TONGA', + 'TT', 'TRINIDAD AND TOBAGO', + 'TN', 'TUNISIA', + 'TR', 'TURKEY', + 'TM', 'TURKMENISTAN', + 'TC', 'TURKS AND CAICOS ISLANDS', + 'TV', 'TUVALU', + 'UG', 'UGANDA', + 'UA', 'UKRAINE', + 'AE', 'UNITED ARAB EMIRATES', + 'GB', 'UNITED KINGDOM', + 'US', 'UNITED STATES', + 'UM', 'UNITED STATES MINOR OUTLYING ISLANDS', + 'UY', 'URUGUAY', + 'UZ', 'UZBEKISTAN', + 'VU', 'VANUATU', + 'VE', 'VENEZUELA', + 'VN', 'VIET NAM', + 'VG', 'VIRGIN ISLANDS (BRITISH)', + 'VI', 'VIRGIN ISLANDS (U.S.)', + 'WF', 'WALLIS AND FUTUNA ISLANDS', + 'EH', 'WESTERN SAHARA', + 'YE', 'YEMEN', + 'YU', 'YUGOSLAVIA', + 'ZM', 'ZAMBIA', + 'ZW', 'ZIMBABWE', ); return %Hash; } @@ -277,7 +277,7 @@ sub exchange { my ($message) = @_; &::DEBUG("exchange(@_)"); - return "Exchange.pl needs LWP::UserAgent and HTTP::Request::Common" + return 'Exchange.pl needs LWP::UserAgent and HTTP::Request::Common' if ($no_exchange); my ($From, $To, $Amount, $Country); @@ -289,14 +289,14 @@ sub exchange { # looking up the currency for a country $Country = $1; } else { - return "that doesn't look right"; + return 'that doesn't look right'; } my $ua = new LWP::UserAgent; # Let's pretend - #$ua->agent("Mozilla/5.0 " . $ua->agent); - $ua->agent("Mozilla/5.0"); - $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam("httpProxy")); + #$ua->agent('Mozilla/5.0 ' . $ua->agent); + $ua->agent('Mozilla/5.0'); + $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam('httpProxy')); $ua->timeout(10); my $Referer = 'http://www.xe.net/ucc/full.shtml'; @@ -306,7 +306,7 @@ sub exchange { my $grab = GET $Referer; my $reply = $ua->request($grab); if (!$reply->is_success) { - return "EXCHANGE: ".$reply->status_line; + return 'EXCHANGE: '.$reply->status_line; } my $html = $reply->as_string; my %Currencies = (grep /\S+/, @@ -373,7 +373,7 @@ sub exchange { return "$Cfrom $Currencies{$From} makes ". "$Cto $Currencies{$To} (from http://www.xe.com/)"; # ." ($When)\n"; } else { - return "i got some error trying that"; + return 'i got some error trying that'; } } else { # Oh dear. diff --git a/blootbot/src/Modules/Factoids.pl b/blootbot/src/Modules/Factoids.pl index 91eb3e7..89a6934 100644 --- a/blootbot/src/Modules/Factoids.pl +++ b/blootbot/src/Modules/Factoids.pl @@ -15,14 +15,14 @@ use vars qw(%param); sub CmdFactInfo { my ($faqtoid, $query) = (lc $_[0], $_[1]); my @array; - my $string = ""; + my $string = ''; - if ($faqtoid eq "") { - &help("factinfo"); + if ($faqtoid eq '') { + &help('factinfo'); return; } - my %factinfo = &sqlSelectRowHash("factoids", "*", + my %factinfo = &sqlSelectRowHash('factoids', '*', { factoid_key => $faqtoid } ); @@ -47,7 +47,7 @@ sub CmdFactInfo { if ($factinfo{'created_by'}) { $factinfo{'created_by'} =~ s/\!/ "; + $factinfo{'created_by'} .= '>'; $string = "created by $factinfo{'created_by'}"; my $time = $factinfo{'created_time'}; @@ -57,27 +57,27 @@ sub CmdFactInfo { $string .= " at \037". scalar(gmtime $time). "\037" . " ($days days)"; } else { - $string .= " ".&Time2String(time() - $time)." ago"; + $string .= ' '.&Time2String(time() - $time).' ago'; } } push(@array,$string); } - # modified: (TimRiker asks "why do you keep turning this off?) + # modified: (TimRiker asks: why do you keep turning this off?) if ($factinfo{'modified_by'}) { - $string = "last modified"; + $string = 'last modified'; my $time = $factinfo{'modified_time'}; if ($time) { if (time() - $time > 60*60*24*7) { $string .= " at \037". scalar(gmtime $time). "\037"; } else { - $string .= " ".&Time2String(time() - $time)." ago "; + $string .= ' '.&Time2String(time() - $time).' ago '; } } - $string .= " by ".(split ",", $factinfo{'modified_by'})[0]; + $string .= ' by '.(split ',', $factinfo{'modified_by'})[0]; push(@array,$string); } @@ -87,12 +87,12 @@ sub CmdFactInfo { my $requested_count = $factinfo{'requested_count'}; if ($requested_count) { - $string = "it has been requested "; + $string = 'it has been requested '; if ($requested_count == 1) { $string .= "\002once\002"; } else { $string .= "\002". $requested_count. "\002 ". - &fixPlural("time", $requested_count); + &fixPlural('time', $requested_count); } my $requested_by = $factinfo{'requested_by'}; @@ -104,11 +104,11 @@ sub CmdFactInfo { if (time() - $requested_time > 60*60*24*7) { $string .= " at \037". scalar(localtime $requested_time). "\037"; } else { - $string .= ", ".&Time2String(time() - $requested_time)." ago"; + $string .= ', '.&Time2String(time() - $requested_time).' ago'; } } } else { - $string = "has not been requested yet"; + $string = 'has not been requested yet'; } push(@array, $string); @@ -128,7 +128,7 @@ sub CmdFactInfo { return; } - &performStrictReply("$factinfo{'factoid_key'} -- ". join("; ", @array) ."."); + &performStrictReply("$factinfo{'factoid_key'} -- ". join('; ', @array) .'.'); return; } @@ -136,9 +136,9 @@ sub CmdFactStats { my ($type) = @_; if ($type =~ /^author$/i) { - my %hash = &sqlSelectColHash("factoids", - "factoid_key,created_by", undef, - "WHERE created_by IS NOT NULL" + my %hash = &sqlSelectColHash('factoids', + 'factoid_key,created_by', undef, + 'WHERE created_by IS NOT NULL' ); my %author; @@ -163,24 +163,24 @@ sub CmdFactStats { my $count; my @list; foreach $count (sort { $b <=> $a } keys %count) { - my $author = join(", ", sort keys %{ $count{$count} }); + my $author = join(', ', sort keys %{ $count{$count} }); push(@list, "$count by $author"); } - my $prefix = "factoid statistics by author: "; + my $prefix = 'factoid statistics by author: '; return &formListReply(0, $prefix, @list); } elsif ($type =~ /^vandalism$/i) { - &status("factstats(vandalism): starting..."); + &status('factstats(vandalism): starting...'); my $start_time = &timeget(); - my %data = &sqlSelectColHash("factoids", - "factoid_key,factoid_value", undef, - "WHERE factoid_value IS NOT NULL" + my %data = &sqlSelectColHash('factoids', + 'factoid_key,factoid_value', undef, + 'WHERE factoid_value IS NOT NULL' ); my @list; my $delta_time = &timedelta($start_time); - &status(sprintf("factstats(vandalism): %.02f sec to retreive all factoids.", $delta_time)) if ($delta_time > 0); + &status(sprintf('factstats(vandalism): %.02f sec to retreive all factoids.', $delta_time)) if ($delta_time > 0); $start_time = &timeget(); # parse the factoids. @@ -192,7 +192,7 @@ sub CmdFactStats { } $delta_time = &timedelta($start_time); - &status(sprintf("factstats(vandalism): %.02f sec to complete.", $delta_time)) if ($delta_time > 0); + &status(sprintf('factstats(vandalism): %.02f sec to complete.', $delta_time)) if ($delta_time > 0); # bail out on no results. if (scalar @list == 0) { @@ -200,11 +200,11 @@ sub CmdFactStats { } # parse the results. - my $prefix = "Vandalised factoid "; + my $prefix = 'Vandalised factoid '; return &formListReply(1, $prefix, @list); } elsif ($type =~ /^total$/i) { - &status("factstats(total): starting..."); + &status('factstats(total): starting...'); my $start_time = &timeget(); my @list; my $str; @@ -213,50 +213,50 @@ sub CmdFactStats { ### lets do it. # total factoids requests. - $i = &sumKey("factoids", "requested_count"); + $i = &sumKey('factoids', 'requested_count'); push(@list, "total requests - $i"); # total factoids modified. - $str = &countKeys("factoids", "modified_by"); + $str = &countKeys('factoids', 'modified_by'); push(@list, "total modified - $str"); # total factoids modified. - $j = &countKeys("factoids", "requested_count"); - $str = &countKeys("factoids", "factoid_key"); - push(@list, "total non-requested - ".($str - $i)); + $j = &countKeys('factoids', 'requested_count'); + $str = &countKeys('factoids', 'factoid_key'); + push(@list, 'total non-requested - '.($str - $i)); # average request/factoid. # i/j == total(requested_count)/count(requested_count) - $str = sprintf("%.01f", $i/$j); + $str = sprintf('%.01f', $i/$j); push(@list, "average requested per factoid - $str"); # total prepared for deletion. - $str = scalar( &searchTable("factoids", "factoid_key", "factoid_value", " #DEL") ); + $str = scalar( &searchTable('factoids', 'factoid_key', 'factoid_value', ' #DEL') ); push(@list, "total prepared for deletion - $str"); # total unique authors. # TODO: convert to sqlSelectColHash ? (or ColArray?) - foreach ( &sqlRawReturn("SELECT created_by FROM factoids WHERE created_by IS NOT NULL") ) { + foreach ( &sqlRawReturn('SELECT created_by FROM factoids WHERE created_by IS NOT NULL') ) { /^(\S+)!/; my $nick = lc $1; $hash{$nick}++; } - push(@list, "total unique authors - ".(scalar keys %hash) ); + push(@list, 'total unique authors - '.(scalar keys %hash) ); undef %hash; # total unique requesters. - foreach ( &sqlRawReturn("SELECT requested_by FROM factoids WHERE requested_by IS NOT NULL") ) { + foreach ( &sqlRawReturn('SELECT requested_by FROM factoids WHERE requested_by IS NOT NULL') ) { /^(\S+)!/; my $nick = lc $1; $hash{$nick}++; } - push(@list, "total unique requesters - ".(scalar keys %hash) ); + push(@list, 'total unique requesters - '.(scalar keys %hash) ); undef %hash; - ### end of "job". + ### end of 'job'. my $delta_time = &timedelta($start_time); - &status(sprintf("factstats(broken): %.02f sec to retreive all factoids.", $delta_time)) if ($delta_time > 0); + &status(sprintf('factstats(broken): %.02f sec to retreive all factoids.', $delta_time)) if ($delta_time > 0); $start_time = &timeget(); # bail out on no results. @@ -265,21 +265,21 @@ sub CmdFactStats { } # parse the results. - my $prefix = "General factoid statistics "; + my $prefix = 'General factoid statistics '; return &formListReply(1, $prefix, @list); } elsif ($type =~ /^deadredir$/i) { - my @list = &searchTable("factoids", "factoid_key", - "factoid_value", "^ see "); + my @list = &searchTable('factoids', 'factoid_key', + 'factoid_value', '^ see '); my %redir; my $f; for (@list) { my $factoid = $_; - my $val = &getFactInfo($factoid, "factoid_value"); + my $val = &getFactInfo($factoid, 'factoid_value'); if ($val =~ /^ ?see( also)? (.*?)\.?$/i) { my $redirf = lc $2; - my $redir = &getFactInfo($redirf, "factoid_value"); + my $redir = &getFactInfo($redirf, 'factoid_value'); next if (defined $redir); next if (length $val > 50); @@ -298,15 +298,15 @@ sub CmdFactStats { } # parse the results. - my $prefix = "Loose link (dead) redirections in factoids "; + my $prefix = 'Loose link (dead) redirections in factoids '; return &formListReply(1, $prefix, @newlist); } elsif ($type =~ /^dup(licate|e)$/i) { - &status("factstats(dupe): starting..."); + &status('factstats(dupe): starting...'); my $start_time = &timeget(); - my %hash = &sqlSelectColHash("factoids", - "factoid_key,factoid_value", undef, - "WHERE factoid_value IS NOT NULL", 1 + my %hash = &sqlSelectColHash('factoids', + 'factoid_key,factoid_value', undef, + 'WHERE factoid_value IS NOT NULL', 1 ); my $refs = 0; my @list; @@ -324,8 +324,8 @@ sub CmdFactStats { } s/([\,\;]+)/\037$1\037/g; - if ($_ eq "") { - &WARN("dupe: _ = NULL. should never happen!."); + if ($_ eq '') { + &WARN('dupe: _ = NULL. should never happen!.'); next; } push(@sublist, $_); @@ -333,20 +333,20 @@ sub CmdFactStats { next unless (scalar @sublist); - push(@list, join(", ", @sublist)); + push(@list, join(', ', @sublist)); } &status("factstats(dupe): (good) dupe refs: $refs."); my $delta_time = &timedelta($start_time); - &status(sprintf("factstats(dupe): %.02f sec to complete", $delta_time)) if ($delta_time > 0); + &status(sprintf('factstats(dupe): %.02f sec to complete', $delta_time)) if ($delta_time > 0); # bail out on no results. if (scalar @list == 0) { - return "no duplicate factoids... woohoo."; + return 'no duplicate factoids... woohoo.'; } # parse the results. - my $prefix = "dupe factoid "; + my $prefix = 'dupe factoid '; return &formListReply(1, $prefix, @list); } elsif ($type =~ /^nullfactoids$/i) { @@ -356,7 +356,7 @@ sub CmdFactStats { my @list; while (my @row = $sth->fetchrow_array) { - if ($row[1] ne "") { + if ($row[1] ne '') { &DEBUG("row[1] != NULL for $row[0]."); next; } @@ -367,12 +367,12 @@ sub CmdFactStats { $sth->finish; # parse the results. - my $prefix = "NULL factoids (not deleted yet) "; + my $prefix = 'NULL factoids (not deleted yet) '; return &formListReply(1, $prefix, @list); } elsif ($type =~ /^(2|too)short$/i) { # Custom select statement. - my $query = "SELECT factoid_key,factoid_value FROM factoids WHERE length(factoid_value) <= 40"; + my $query = 'SELECT factoid_key,factoid_value FROM factoids WHERE length(factoid_value) <= 40'; my $sth = $dbh->prepare($query); &ERROR("factstats(lame): => '$query'.") unless $sth->execute; @@ -394,12 +394,12 @@ sub CmdFactStats { $sth->finish; # parse the results. - my $prefix = "Lame factoids "; + my $prefix = 'Lame factoids '; return &formListReply(1, $prefix, @list); } elsif ($type =~ /^listfix$/i) { # Custom select statement. - my $query = "SELECT factoid_key,factoid_value FROM factoids"; + my $query = 'SELECT factoid_key,factoid_value FROM factoids'; my $sth = $dbh->prepare($query); &ERROR("factstats(listfix): => '$query'.") unless $sth->execute; @@ -414,18 +414,18 @@ sub CmdFactStats { push(@list, $key); $val =~ s/,? or /, /g; &DEBUG("fixed: => $val."); - &setFactInfo($key,"factoid_value", $val); + &setFactInfo($key,'factoid_value', $val); } $sth->finish; # parse the results. - my $prefix = "Inefficient lists fixed "; + my $prefix = 'Inefficient lists fixed '; return &formListReply(1, $prefix, @list); } elsif ($type =~ /^locked$/i) { - my %hash = &sqlSelectColHash("factoids", - "factoid_key,locked_by", undef, - "WHERE locked_by IS NOT NULL" + my %hash = &sqlSelectColHash('factoids', + 'factoid_key,locked_by', undef, + 'WHERE locked_by IS NOT NULL' ); my @list = keys %hash; @@ -437,9 +437,9 @@ sub CmdFactStats { return &formListReply(0, $prefix, @list); } elsif ($type =~ /^new$/i) { - my %hash = &sqlSelectColHash("factoids", - "factoid_key,created_time", undef, - "WHERE created_time IS NOT NULL" + my %hash = &sqlSelectColHash('factoids', + 'factoid_key,created_time', undef, + 'WHERE created_time IS NOT NULL' ); my %age; @@ -452,24 +452,24 @@ sub CmdFactStats { } if (scalar keys %age == 0) { - return "sorry, no new factoids."; + return 'sorry, no new factoids.'; } my @list; foreach (sort {$a <=> $b} keys %age) { - push(@list, join(",", keys %{ $age{$_} })); + push(@list, join(',', keys %{ $age{$_} })); } - my $prefix = "new factoids in the last 24hours "; + my $prefix = 'new factoids in the last 24hours '; return &formListReply(0, $prefix, @list); } elsif ($type =~ /^part(ial)?dupe$/i) { - ### requires "custom" select statement... oh well... + ### requires 'custom' select statement... oh well... my $start_time = &timeget(); # form length|key and key=length hash list. - &status("factstats(partdupe): forming length hash list."); - my $query = "SELECT factoid_key,factoid_value,length(factoid_value) AS length FROM factoids WHERE length(factoid_value) >= 192 ORDER BY length"; + &status('factstats(partdupe): forming length hash list.'); + my $query = 'SELECT factoid_key,factoid_value,length(factoid_value) AS length FROM factoids WHERE length(factoid_value) >= 192 ORDER BY length'; my $sth = $dbh->prepare($query); &ERROR("factstats(partdupe): => '$query'.") unless $sth->execute; @@ -482,7 +482,7 @@ sub CmdFactStats { } $sth->finish; &status("factstats(partdupe): total keys => '". scalar(@key) ."'."); - &status("factstats(partdupe): now deciphering data gathered"); + &status('factstats(partdupe): now deciphering data gathered'); my @length = sort { $a <=> $b } keys %length; my $key; @@ -498,53 +498,53 @@ sub CmdFactStats { if ($key{$_} =~ /^$val/i) { s/([\,\;]+)/\037$1\037/g; s/( and|and )/\037$1\037/g; - push(@sublist,$key." and ".$_); + push(@sublist,$key.' and '.$_); } } } - push(@list, join(" ,",@sublist)) if (scalar @sublist); + push(@list, join(' ,',@sublist)) if (scalar @sublist); } - my $delta_time = sprintf("%.02fs", &timedelta($start_time) ); + my $delta_time = sprintf('%.02fs', &timedelta($start_time) ); &status("factstats(partdupe): $delta_time sec to complete.") if ($delta_time > 0); # bail out on no results. if (scalar @list == 0) { - return "no initial partial duplicate factoids... woohoo."; + return 'no initial partial duplicate factoids... woohoo.'; } # parse the results. - my $prefix = "initial partial dupe factoid "; + my $prefix = 'initial partial dupe factoid '; return &formListReply(1, $prefix, @list); } elsif ($type =~ /^profanity$/i) { - my %data = &sqlSelectColHash("factoids", - "factoid_key,factoid_value", undef, - "WHERE factoid_value IS NOT NULL" + my %data = &sqlSelectColHash('factoids', + 'factoid_key,factoid_value', undef, + 'WHERE factoid_value IS NOT NULL' ); my @list; foreach (keys %data) { - push(@list, $_) if (&hasProfanity($_." ".$data{$_})); + push(@list, $_) if (&hasProfanity($_.' '.$data{$_})); } # parse the results. - my $prefix = "Profanity in factoids "; + my $prefix = 'Profanity in factoids '; return &formListReply(1, $prefix, @list); } elsif ($type =~ /^redir(ection)?$/i) { - my @list = &searchTable("factoids", "factoid_key", - "factoid_value", "^ see "); + my @list = &searchTable('factoids', 'factoid_key', + 'factoid_value', '^ see '); my %redir; my $f; my $dangling = 0; for (@list) { my $factoid = $_; - my $val = &getFactInfo($factoid, "factoid_value"); + my $val = &getFactInfo($factoid, 'factoid_value'); if ($val =~ /^ see( also)? (.*?)\.?$/i) { my $redir = lc $2; - my $redirval = &getFactInfo($redir, "factoid_value"); + my $redirval = &getFactInfo($redir, 'factoid_value'); if (defined $redirval) { $redir{$redir}{$factoid} = 1; } else { @@ -569,9 +569,9 @@ sub CmdFactStats { return &formListReply(1, $prefix, @newlist); } elsif ($type =~ /^request(ed)?$/i) { - my %hash = &sqlSelectColHash("factoids", - "factoid_key,requested_count", undef, - "WHERE requested_count IS NOT NULL", 1 + my %hash = &sqlSelectColHash('factoids', + 'factoid_key,requested_count', undef, + 'WHERE requested_count IS NOT NULL', 1 ); if (!scalar keys %hash) { @@ -589,7 +589,7 @@ sub CmdFactStats { } $total += $count * scalar(@faqtoids); - push(@list, "$count - ". join(", ", @faqtoids)); + push(@list, "$count - ". join(', ', @faqtoids)); } unshift(@list, "\037$total - TOTAL\037"); @@ -597,9 +597,9 @@ sub CmdFactStats { return &formListReply(0, $prefix, @list); } elsif ($type =~ /^reqrate$/i) { - my %hash = &sqlSelectColHash("factoids", + my %hash = &sqlSelectColHash('factoids', "factoid_key,(unix_timestamp() - created_time)/requested_count as rate", undef, - "WHERE requested_by IS NOT NULL and created_time IS NOT NULL ORDER BY rate LIMIT 15", 1 + 'WHERE requested_by IS NOT NULL and created_time IS NOT NULL ORDER BY rate LIMIT 15', 1 ); my $rate; @@ -607,7 +607,7 @@ sub CmdFactStats { my $total = 0; my $users = 0; foreach $rate (sort { $b <=> $a } keys %hash) { - my $f = join(", ", sort keys %{ $hash{$rate} }); + my $f = join(', ', sort keys %{ $hash{$rate} }); my $str = "$f - ".&Time2String($rate); $str =~ s/\002//g; push(@list, $str); @@ -617,9 +617,9 @@ sub CmdFactStats { return &formListReply(0, $prefix, @list); } elsif ($type =~ /^requesters?$/i) { - my %hash = &sqlSelectColHash("factoids", - "factoid_key,requested_by", undef, - "WHERE requested_by IS NOT NULL" + my %hash = &sqlSelectColHash('factoids', + 'factoid_key,requested_by', undef, + 'WHERE requested_by IS NOT NULL' ); my %requester; @@ -646,7 +646,7 @@ sub CmdFactStats { my $total = 0; my $users = 0; foreach $count (sort { $b <=> $a } keys %count) { - my $requester = join(", ", sort keys %{ $count{$count} }); + my $requester = join(', ', sort keys %{ $count{$count} }); $total += $count * scalar(keys %{ $count{$count} }); $users += scalar(keys %{ $count{$count} }); push(@list, "$count by $requester"); @@ -655,12 +655,12 @@ sub CmdFactStats { # should not the above value be the same as collected by # 'requested'? soemthing weird is going on! - my $prefix = "rank of top factoid requesters: "; + my $prefix = 'rank of top factoid requesters: '; return &formListReply(0, $prefix, @list); } elsif ($type =~ /^seefix$/i) { - my @list = &searchTable("factoids", "factoid_key", - "factoid_value", "^see "); + my @list = &searchTable('factoids', 'factoid_key', + 'factoid_value', '^see '); my @newlist; my $fixed = 0; my %loop; @@ -668,12 +668,12 @@ sub CmdFactStats { for (@list) { my $factoid = $_; - my $val = &getFactInfo($factoid, "factoid_value"); + my $val = &getFactInfo($factoid, 'factoid_value'); next unless ($val =~ /^see( also)? (.*?)\.?$/i); my $redirf = lc $2; - my $redir = &getFactInfo($redirf, "factoid_value"); + my $redir = &getFactInfo($redirf, 'factoid_value'); if ($redirf =~ /^\Q$factoid\W$/i) { &delFactoid($factoid); @@ -681,7 +681,7 @@ sub CmdFactStats { } if (defined $redir) { # good. - &setFactInfo($factoid,"factoid_value"," see $redir"); + &setFactInfo($factoid,'factoid_value'," see $redir"); $fixed++; } else { push(@newlist, $redirf); @@ -690,7 +690,7 @@ sub CmdFactStats { # parse the results. &msg($who, "Fixed $fixed factoids."); - &msg($who, "Self looped factoids removed: ". keys %loop ) if (scalar keys %loop); + &msg($who, 'Self looped factoids removed: '. keys %loop ) if (scalar keys %loop); my $prefix = "Loose link (dead) redirections in factoids "; return &formListReply(1, $prefix, @newlist); @@ -718,11 +718,11 @@ sub CmdFactStats { $sth->finish; if (scalar @list == 0) { - return "good. no factoids exceed length."; + return 'good. no factoids exceed length.'; } # parse the results. - my $prefix = "factoid key||value exceeding length "; + my $prefix = 'factoid key||value exceeding length '; return &formListReply(1, $prefix, @list); } elsif ($type =~ /^unrequest(ed)?$/i) { @@ -738,7 +738,7 @@ sub CmdFactStats { sub CmdListAuth { my ($query) = @_; my $maxshow = &::getChanConfDefault('maxListReplyCount', 15, $chan); - my @list = &searchTable("factoids","factoid_key", "created_by", "^$query!"); + my @list = &searchTable('factoids','factoid_key', 'created_by', "^$query!"); @list=grep(!/\#DEL\#$/,@list) if (scalar(@list) > $maxshow); my $prefix = "factoid author list by '$query' "; diff --git a/blootbot/src/Modules/HTTPDtype.pl b/blootbot/src/Modules/HTTPDtype.pl index c91ecd0..5906077 100644 --- a/blootbot/src/Modules/HTTPDtype.pl +++ b/blootbot/src/Modules/HTTPDtype.pl @@ -21,13 +21,13 @@ sub HTTPDtype { $s->write_request(HEAD => "/"); my $sel = IO::Select->new($s); - $line = "Header timeout" unless $sel->can_read(10); + $line = 'Header timeout' unless $sel->can_read(10); ($code, $mess, %h) = $s->read_response_headers; $line = (length($h{Server}) > 0) ? $h{Server} : "Couldn't fetch headers from $HOST"; - &::performStrictReply($line||"Unknown Error Condition"); + &::performStrictReply($line||'Unknown Error Condition'); } 1; diff --git a/blootbot/src/Modules/Kernel.pl b/blootbot/src/Modules/Kernel.pl index 45c1190..2b0ba90 100644 --- a/blootbot/src/Modules/Kernel.pl +++ b/blootbot/src/Modules/Kernel.pl @@ -12,7 +12,7 @@ sub kernelGetInfo { } sub Kernel { - my $retval = "Linux kernel versions"; + my $retval = 'Linux kernel versions'; my @now = &kernelGetInfo(); if (!scalar @now) { &::msg($::who, "failed."); @@ -32,7 +32,7 @@ sub Kernel { $line =~ s/ for 2.4//; $line =~ s/ for 2.2//; $line =~ s/ is: */: /; - $retval .= ", " . $line; + $retval .= ', ' . $line; } &::performStrictReply($retval); } @@ -43,7 +43,7 @@ sub kernelAnnounce { my @old; if (!scalar @now) { - &::DEBUG("kA: failure to retrieve."); + &::DEBUG('kA: failure to retrieve.'); return; } diff --git a/blootbot/src/Modules/Math.pl b/blootbot/src/Modules/Math.pl index b91f8fe..32350ff 100644 --- a/blootbot/src/Modules/Math.pl +++ b/blootbot/src/Modules/Math.pl @@ -7,26 +7,26 @@ use strict; use vars qw($message); my %digits = ( - "first", "1", - "second", "2", - "third", "3", - "fourth", "4", - "fifth", "5", - "sixth", "6", - "seventh", "7", - "eighth", "8", - "ninth", "9", - "tenth", "10", - "one", "1", - "two", "2", - "three", "3", - "four", "4", - "five", "5", - "six", "6", - "seven", "7", - "eight", "8", - "nine", "9", - "ten", "10" + 'first', '1', + 'second', '2', + 'third', '3', + 'fourth', '4', + 'fifth', '5', + 'sixth', '6', + 'seventh', '7', + 'eighth', '8', + 'ninth', '9', + 'tenth', '10', + 'one', '1', + 'two', '2', + 'three', '3', + 'four', '4', + 'five', '5', + 'six', '6', + 'seven', '7', + 'eight', '8', + 'nine', '9', + 'ten', '10' ); sub perlMath { @@ -60,13 +60,13 @@ sub perlMath { while ($locMsg =~ /(log\s*((\d+\.?\d*)|\d*\.?\d+))\s*/) { my ($exp, $res) = ($1, $2); - my $val = ($res) ? log($res) : "Infinity"; + my $val = ($res) ? log($res) : 'Infinity'; $locMsg =~ s/$exp/+$val/g; } while ($locMsg =~ /(bin2dec ([01]+))/) { my $exp = $1; - my $val = join ("", unpack("B*",$2)) ; + my $val = join ('', unpack('B*',$2)) ; $locMsg =~ s/$exp/+$val/g; } @@ -121,11 +121,11 @@ sub perlMath { &FIXME("math: locMsg => '$locMsg'..."); } else { &status("math: could not really compute."); - $locMsg = ""; + $locMsg = ''; } } } else { - $locMsg = ""; + $locMsg = ''; } if (defined $locMsg and $locMsg ne $message) { diff --git a/blootbot/src/Modules/News.pl b/blootbot/src/Modules/News.pl index 25b049c..5e1200b 100644 --- a/blootbot/src/Modules/News.pl +++ b/blootbot/src/Modules/News.pl @@ -35,7 +35,7 @@ sub Parse { &readNews(); } - if ($::msgType ne "private") { + if ($::msgType ne 'private') { $chan = $::chan; } @@ -118,8 +118,8 @@ sub Parse { } elsif ($what =~ /^(un)?notify$/i) { my $state = ($1) ? 0 : 1; - # TODO: don't notify even if "News" is called. - if (&::IsChanConf("newsNotifyAll") <= 0) { + # TODO: don't notify even if 'News' is called. + if (&::IsChanConf('newsNotifyAll') <= 0) { &::DEBUG("news: chan => $chan, ::chan => $::chan."); &::notice($who, "not available for this channel or disabled altogether."); return; @@ -137,7 +137,7 @@ sub Parse { } else { # state = 0 my $x = $::newsuser{$chan}{$who}; if (defined $x and ($x == 0 or $x == -1)) { - &::notice($who, "notify already disabled"); + &::notice($who, 'notify already disabled'); return; } $::newsuser{$chan}{$who} = -1; @@ -198,9 +198,9 @@ sub readNews { return unless ($ci or $cn or $cu); &::status("News: read ". - $ci. &::fixPlural(" item", $ci). " for ". - $cn. &::fixPlural(" chan", $cn). ", ". - $cu. &::fixPlural(" user", $cu), " cache" + $ci. &::fixPlural(' item', $ci). ' for '. + $cn. &::fixPlural(' chan', $cn). ', '. + $cu. &::fixPlural(' user', $cu), ' cache' ); } @@ -244,7 +244,7 @@ sub writeNews { } # TODO: show how many users we wrote down. - if (&::getChanConfList("newsKeepRead")) { + if (&::getChanConfList('newsKeepRead')) { # old users are removed in newsFlush(), perhaps it should be # done here. @@ -266,7 +266,7 @@ sub add { my($str) = @_; if (!defined $chan or !defined $str or $str =~ /^\s*$/) { - &::help("news add"); + &::help('news add'); return; } @@ -281,7 +281,7 @@ sub add { } $::news{$chan}{$str}{Time} = time(); - my $expire = &::getChanConfDefault("newsDefaultExpire",7, $chan); + my $expire = &::getChanConfDefault('newsDefaultExpire',7, $chan); $::news{$chan}{$str}{Expire} = time() + $expire*60*60*24; $::news{$chan}{$str}{Author} = $::who; # case! @@ -302,7 +302,7 @@ sub del { my $item = 0; if (!defined $what) { - &::help("news del"); + &::help('news del'); return; } @@ -350,7 +350,7 @@ sub del { if (exists $::news{$chan}{$what}) { my $auth = 0; $auth++ if ($::who eq $::news{$chan}{$what}{Author}); - $auth++ if (&::IsFlag("o")); + $auth++ if (&::IsFlag('o')); if (!$auth) { # TODO: show when it'll expire. @@ -371,7 +371,7 @@ sub list { return; } - if (&::IsChanConf("newsKeepRead") > 0) { + if (&::IsChanConf('newsKeepRead') > 0) { my $x = $::newsuser{$chan}{$who}; if (defined $x and ($x == 0 or $x == -1)) { @@ -404,7 +404,7 @@ sub list { } my $timestr = &::Time2String(time() - $newest); &::msg($who, "|= Last updated $timestr ago."); - &::msg($who, " \037Num\037 \037Item ".(" "x40)." \037"); + &::msg($who, " \037Num\037 \037Item ".(' 'x40)." \037"); # &::DEBUG("news: list: expire = $expire"); # &::DEBUG("news: list: eno = $eno"); @@ -413,7 +413,7 @@ sub list { foreach ( &getNewsAll() ) { my $subtopic = $_; my $setby = $::news{$chan}{$subtopic}{Author}; - my $chr = (exists $::News{$chan}{$subtopic}{Text}) ? "" : "*"; + my $chr = (exists $::News{$chan}{$subtopic}{Text}) ? '' : '*'; if (!defined $subtopic) { &::DEBUG("news: warn: subtopic == undef."); @@ -441,7 +441,7 @@ sub read { my($str) = @_; if (!defined $chan or !defined $str or $str =~ /^\s*$/) { - &::help("news read"); + &::help('news read'); return; } @@ -466,7 +466,7 @@ sub read { } if (!exists $::news{$chan}{$item}{Text}) { - &::notice($who, "Someone forgot to add info to this news item"); + &::notice($who, 'Someone forgot to add info to this news item'); return; } @@ -511,8 +511,8 @@ sub read { sub mod { my($item, $str) = split /\s+/, $_[0], 2; - if (!defined $item or $item eq "" or $str =~ /^\s*$/) { - &::help("news mod"); + if (!defined $item or $item eq '' or $str =~ /^\s*$/) { + &::help('news mod'); return; } @@ -539,10 +539,10 @@ sub mod { # TODO: make code safer. my $done = 0; # TODO: use eval to deal with flags easily. - if ($flags eq "") { + if ($flags eq '') { $done++ if (!$done and $mod_news =~ s/\Q$op\E/$np/); $done++ if (!$done and $mod_nnews =~ s/\Q$op\E/$np/); - } elsif ($flags eq "g") { + } elsif ($flags eq 'g') { $done++ if ($mod_news =~ s/\Q$op\E/$np/g); $done++ if ($mod_nnews =~ s/\Q$op\E/$np/g); } @@ -598,8 +598,8 @@ sub set { $what = $1 if ($args =~ s/^(\S+)\s*//); $value = $args; - if ($item eq "") { - &::help("news set"); + if ($item eq '') { + &::help('news set'); return; } @@ -617,7 +617,7 @@ sub set { } my $ok = 0; - my @elements = ("Expire","Text"); + my @elements = ('Expire','Text'); foreach (@elements) { next unless ($what =~ /^$_$/i); $what = $_; @@ -641,7 +641,7 @@ sub set { return; } - if ($what eq "Expire") { + if ($what eq 'Expire') { # TODO: use do_set(). my $time = 0; @@ -697,7 +697,7 @@ sub set { # &::DEBUG("news: who => '$who'"); my $author = $::news{$chan}{$news}{Author}; $auth++ if ($::who eq $author); - $auth++ if (&::IsFlag("o")); + $auth++ if (&::IsFlag('o')); if (!defined $author) { &::DEBUG("news: news{$chan}{$news}{Author} is not defined! auth'd anyway"); $::news{$chan}{$news}{Author} = $::who; @@ -751,7 +751,7 @@ sub latest { } $::chan = $chan; - return if (&::IsChanConf("newsNotifyAll") <= 0); + return if (&::IsChanConf('newsNotifyAll') <= 0); # I don't understand this code ;) $t = 1 if (!defined $t); @@ -791,7 +791,7 @@ sub latest { # scalar @new, !$flag my $unread = scalar @new; my $total = scalar keys %{ $::news{$chan} }; - if (!$flag && &::IsChanConf("newsTellUnread") <= 0) { + if (!$flag && &::IsChanConf('newsTellUnread') <= 0) { return; } diff --git a/blootbot/src/Modules/OnJoin.pl b/blootbot/src/Modules/OnJoin.pl index d5012b0..74ca9d8 100644 --- a/blootbot/src/Modules/OnJoin.pl +++ b/blootbot/src/Modules/OnJoin.pl @@ -111,7 +111,7 @@ sub Cmdonjoin { &sqlDelete('onjoin', { nick => $nick, channel => $ch }); my $insert = &sqlInsert('onjoin', { nick => $nick, channel => $ch, message => $msg, modified_by => $who, modified_time => time() }); if ($insert){ - &performReply("ok"); + &performReply('ok'); } else{ &performReply('whoops. database error'); diff --git a/blootbot/src/Modules/Plug.pl b/blootbot/src/Modules/Plug.pl index 067b391..05f67b5 100644 --- a/blootbot/src/Modules/Plug.pl +++ b/blootbot/src/Modules/Plug.pl @@ -39,7 +39,7 @@ sub Plug { my $retval = "i could not get the headlines."; if (scalar @results) { - my $prefix = "Plug Headlines "; + my $prefix = 'Plug Headlines '; my @list = &plugParse(@results); $retval = &::formListReply(0, $prefix, @list); } diff --git a/blootbot/src/Modules/Quote.pl b/blootbot/src/Modules/Quote.pl index 147c230..14ee9fb 100644 --- a/blootbot/src/Modules/Quote.pl +++ b/blootbot/src/Modules/Quote.pl @@ -20,7 +20,7 @@ sub commify { sub Quote { my $stock = shift; - my @results = &::getURL("http://quote.yahoo.com/d/quotes.csv" . + my @results = &::getURL('http://quote.yahoo.com/d/quotes.csv' . "?s=$stock&f=sl1d1t1c1ohgv&e=.csv"); @@ -45,7 +45,7 @@ sub Quote { "Opened $open, Volume $newvol, Change $change"; } - if ($reply eq "") { + if ($reply eq '') { $reply = "i couldn't get the quote for $stock. sorry. :("; } diff --git a/blootbot/src/Modules/RootWarn.pl b/blootbot/src/Modules/RootWarn.pl index fc30550..80d228e 100644 --- a/blootbot/src/Modules/RootWarn.pl +++ b/blootbot/src/Modules/RootWarn.pl @@ -21,7 +21,7 @@ sub rootWarn { &status('RootWarn: Detected root user; notifying user'); } else { &status('RootWarn: Detected root user; notifying nick and channel.'); - &msg($chan, "ROO".("O" x int(rand 8))."T has landed!"); + &msg($chan, 'ROO'.('O' x int(rand 8))."T has landed!"); } if ($_ = &getFactoid('root')) { @@ -57,7 +57,7 @@ sub rootWarn { $attempt++; ### TODO: OPTIMIZE THIS. # ok... don't record the attempt if nick==root. - return if ($nick eq "root"); + return if ($nick eq 'root'); &sqlSet('rootwarn', { nick => lc($nick) }, { attempt => $attempt, @@ -81,8 +81,8 @@ sub CmdrootWarn { } # reply #1. - $reply = "there ".&fixPlural("has",$count) ." been \002$count\002 ". - &fixPlural("rooter",$count) ." warned about root."; + $reply = 'there '.&fixPlural('has',$count) ." been \002$count\002 ". + &fixPlural('rooter',$count) ." warned about root."; if ($param{'DBType'} !~ /^(pg|my)sql$/i) { &FIXME("rootwarn does not yet support non-{my,pg}sql."); @@ -103,8 +103,8 @@ sub CmdrootWarn { if ($found) { $reply .= " Of which, \002$found\002 ". - &fixPlural("rooter",$found)." ". - &fixPlural("has",$found). + &fixPlural('rooter',$found).' '. + &fixPlural('has',$found). " done it at least 3 times."; } diff --git a/blootbot/src/Modules/Search.pl b/blootbot/src/Modules/Search.pl index a71bd9c..5f4108a 100644 --- a/blootbot/src/Modules/Search.pl +++ b/blootbot/src/Modules/Search.pl @@ -17,12 +17,12 @@ sub Search { $type =~ s/s$//; # nice work-around. - if ($type eq "value") { + if ($type eq 'value') { # search by value. - @list = &::searchTable("factoids", "factoid_key", "factoid_value", $str); + @list = &::searchTable('factoids', 'factoid_key', 'factoid_value', $str); } else { # search by key. - @list = &::searchTable("factoids", "factoid_key", "factoid_key", $str); + @list = &::searchTable('factoids', 'factoid_key', 'factoid_key', $str); } @list=grep(!/\#DEL\#$/,@list) if (scalar(@list) > $maxshow); diff --git a/blootbot/src/Modules/Topic.pl b/blootbot/src/Modules/Topic.pl index 10f0f77..e12fc5d 100644 --- a/blootbot/src/Modules/Topic.pl +++ b/blootbot/src/Modules/Topic.pl @@ -33,7 +33,7 @@ sub topicDecipher { } my $subtopic = $_; - my $owner = "Unknown"; + my $owner = 'Unknown'; if (/(.*)\s+\((.*?)\)$/) { $subtopic = $1; @@ -60,7 +60,7 @@ sub topicCipher { foreach (@_) { my ($subtopic, $setby) = split /\|\|/; - if ($param{'topicAuthor'} eq "1" and (!$setby =~ /^(unknown|)$/i)) { + if ($param{'topicAuthor'} eq '1' and (!$setby =~ /^(unknown|)$/i)) { push(@topic, "$subtopic ($setby)"); } else { push(@topic, "$subtopic"); @@ -101,7 +101,7 @@ sub topicNew { return 1; } - if (defined $updateMsg && $updateMsg ne "") { + if (defined $updateMsg && $updateMsg ne '') { &msg($who, $updateMsg); } @@ -113,7 +113,7 @@ sub topicNew { $conn->topic($chan, $topic); &topicAddHistory($chan, $topic); } else { - $conn->topic($chan, " "); + $conn->topic($chan, ' '); } return 1; @@ -125,10 +125,10 @@ sub topicAddHistory { my ($chan, $topic) = @_; my $dupe = 0; - return 1 if ($topic eq ""); # required fix. + return 1 if ($topic eq ''); # required fix. foreach (@{ $topic{$chan}{'History'} }) { - next if ($_ ne "" and $_ ne $topic); + next if ($_ ne '' and $_ ne $topic); # checking length is required. # slightly weird to put a return statement in a loop. @@ -153,24 +153,24 @@ sub topicAddHistory { sub do_add { my ($chan, $args) = @_; - if ($args eq "") { - &help("topic add"); + if ($args eq '') { + &help('topic add'); return; } # heh, joeyh. 19990819. -xk if ($who =~ /\|\|/) { - &msg($who, "error: you have an invalid nick, loser!"); + &msg($who, 'error: you have an invalid nick, loser!'); return; } - return if ($channels{$chan}{t} and !&hasFlag("T")); + return if ($channels{$chan}{t} and !&hasFlag('T')); my @prev = &topicDecipher($chan); my $new; # If bot new to chan and topic is blank, it still got a (owner). This is fix - if ($param{'topicAuthor'} eq "1") { - $new = "$args ($orig{who})"; + if ($param{'topicAuthor'} eq '1') { + $new = "$args ($orig{who})"; } else { $new = "$args"; } @@ -181,7 +181,7 @@ sub do_add { $new = &topicCipher(@prev, $str); } - &topicNew($chan, $new, ""); + &topicNew($chan, $new, ''); } # cmd: delete. @@ -191,12 +191,12 @@ sub do_delete { my $topiccount = scalar @subtopics; if ($topiccount == 0) { - &msg($who, "No topic set."); + &msg($who, 'No topic set.'); return; } - if ($args eq "") { - &help("topic del"); + if ($args eq '') { + &help('topic del'); return; } @@ -215,8 +215,8 @@ sub do_delete { } my @delete; - foreach (split ",", $args) { - next if ($_ eq ""); + foreach (split ',', $args) { + next if ($_ eq ''); # change to hash list instead of array? if (/^(\d+)-(\d+)$/) { @@ -231,7 +231,7 @@ sub do_delete { return; } - $topic{$chan}{'What'} = "Deleted ".join("/",@delete); + $topic{$chan}{'What'} = 'Deleted '.join("/",@delete); } foreach (@delete) { @@ -246,7 +246,7 @@ sub do_delete { my ($subtopic,$whoby) = split('\|\|', $subtopics[$_-1]); - $whoby = "unknown" if ($whoby eq ""); + $whoby = 'unknown' if ($whoby eq ''); &msg($who, "Deleting topic: $subtopic ($whoby)"); undef $subtopics[$_-1]; @@ -258,7 +258,7 @@ sub do_delete { push(@newtopics, $_); } - &topicNew($chan, &topicCipher(@newtopics), ""); + &topicNew($chan, &topicCipher(@newtopics), ''); } # cmd: list @@ -294,8 +294,8 @@ sub do_list { sub do_modify { my ($chan, $args) = @_; - if ($args eq "") { - &help("topic mod"); + if ($args eq '') { + &help('topic mod'); return; } @@ -318,8 +318,8 @@ sub do_modify { my $topic = $topic{$chan}{'Current'}; ### TODO: use m### to make code safe! - if (($flags eq "g" and $topic =~ s/\Q$op\E/$np/g) || - ($flags eq "" and $topic =~ s/\Q$op\E/$np/) + if (($flags eq 'g' and $topic =~ s/\Q$op\E/$np/g) || + ($flags eq '' and $topic =~ s/\Q$op\E/$np/) ) { $_ = "Modifying topic with sar s/$op/$np/."; @@ -338,8 +338,8 @@ sub do_modify { sub do_move { my ($chan, $args) = @_; - if ($args eq "") { - &help("topic mv"); + if ($args eq '') { + &help('topic mv'); return; } @@ -408,7 +408,7 @@ sub do_move { undef @subtopics; # lets reuse this array. foreach (@newtopics) { - next if (!defined $_ or $_ eq ""); + next if (!defined $_ or $_ eq ''); push(@subtopics, $_); } @@ -422,7 +422,7 @@ sub do_shuffle { my @subtopics = &topicDecipher($chan); my @newtopics; - $topic{$chan}{'What'} = "shuffled"; + $topic{$chan}{'What'} = 'shuffled'; foreach (&makeRandom(scalar @subtopics)) { push(@newtopics, $subtopics[$_]); @@ -457,8 +457,8 @@ sub do_history { sub do_restore { my ($chan, $args) = @_; - if ($args eq "") { - &help("topic restore"); + if ($args eq '') { + &help('topic restore'); return; } @@ -492,7 +492,7 @@ sub do_rehash { my ($chan) = @_; $_ = "Rehashing topic..."; - $topic{$chan}{'What'} = "Rehash"; + $topic{$chan}{'What'} = 'Rehash'; &topicNew($chan, $topic{$chan}{'Current'}, $_, 1); } @@ -504,7 +504,7 @@ sub do_info { if (exists $topic{$chan}{'Who'} and exists $topic{$chan}{'Time'}) { $reply = "topic on \002$chan\002 was last set by ". $topic{$chan}{'Who'}. ". This was done ". - &Time2String(time() - $topic{$chan}{'Time'}) ." ago". + &Time2String(time() - $topic{$chan}{'Time'}) .' ago'. ". Length: ".length($topic{$chan}{'Current'}); my $change = $topic{$chan}{'What'}; $reply .= ". Change => $change" if (defined $change); @@ -559,13 +559,13 @@ sub Topic { } else { ### HELP: - if ($cmd ne "" and $cmd !~ /^help/i) { + if ($cmd ne '' and $cmd !~ /^help/i) { &msg($who, "Invalid command [$cmd]."); &msg($who, "Try 'help topic'."); return; } - &help("topic"); + &help('topic'); } return; diff --git a/blootbot/src/Modules/Units.pl b/blootbot/src/Modules/Units.pl index ff16e7e..aad95d8 100644 --- a/blootbot/src/Modules/Units.pl +++ b/blootbot/src/Modules/Units.pl @@ -54,7 +54,7 @@ BEGIN { $defs_read += read_defs("$::bot_data_dir/unittab"); unless ($defs_read) { - &::ERROR("Could not read any of the initialization files UNITTAB"); + &::ERROR('Could not read any of the initialization files UNITTAB'); return; } } @@ -87,7 +87,7 @@ sub convertUnits { return; } unless ($from =~ /\S/) { - &::DEBUG("FAILURE 2"); + &::DEBUG('FAILURE 2'); return; } @@ -124,8 +124,8 @@ sub convertUnits { # print # "conformability (Not the same dimension)\n", -# "\t", $from, " is ", text_unit($hu), "\n", -# "\t", $to, " is ", text_unit($wu), "\n", +# "\t", $from, ' is ', text_unit($hu), "\n", +# "\t", $to, ' is ', text_unit($wu), "\n", # ; } } @@ -216,7 +216,7 @@ sub unit_multiply { sub unit_divide { my ($a, $b) = @_; if ($b->{_} == 0) { - &::DEBUG("Division by zero error"); + &::DEBUG('Division by zero error'); return; } my $r = {%$a}; diff --git a/blootbot/src/Modules/Uptime.pl b/blootbot/src/Modules/Uptime.pl index ac962f0..83b2e1b 100644 --- a/blootbot/src/Modules/Uptime.pl +++ b/blootbot/src/Modules/Uptime.pl @@ -83,11 +83,11 @@ sub uptimeWriteFile { } close OUT; - &status("--- Saved uptime records."); + &status('--- Saved uptime records.'); return unless defined $conn; - $conn->schedule(&getRandomInt("1800-3600"), \&uptimeWriteFile, ""); + $conn->schedule(&getRandomInt('1800-3600'), \&uptimeWriteFile, ''); } 1; diff --git a/blootbot/src/Modules/UserDCC.pl b/blootbot/src/Modules/UserDCC.pl index 6403c25..5554b0b 100644 --- a/blootbot/src/Modules/UserDCC.pl +++ b/blootbot/src/Modules/UserDCC.pl @@ -48,7 +48,7 @@ sub userDCC { if ($message =~ /^tellme(\s+(.*))?$/i) { my $args = $2; if ($args =~ /^\s*$/) { - &help("tellme"); + &help('tellme'); return; } @@ -60,12 +60,12 @@ sub userDCC { # 4op. if ($message =~ /^4op(\s+($mask{chan}))?$/i) { - return unless (&hasFlag("o")); + return unless (&hasFlag('o')); my $chan = $2; - if ($chan eq "") { - &help("4op"); + if ($chan eq '') { + &help('4op'); return; } @@ -86,13 +86,13 @@ sub userDCC { # opme. if ($message =~ /^opme(\s+($mask{chan}))?$/i) { - return unless (&hasFlag("o")); - return unless (&hasFlag("A")); + return unless (&hasFlag('o')); + return unless (&hasFlag('A')); my $chan = $2; - if ($chan eq "") { - &help("4op"); + if ($chan eq '') { + &help('4op'); return; } @@ -104,13 +104,13 @@ sub userDCC { # backlog. if ($message =~ /^backlog(\s+(.*))?$/i) { - return unless (&hasFlag("o")); - return unless (&IsParam("backlog")); + return unless (&hasFlag('o')); + return unless (&IsParam('backlog')); my $num = $2; my $max = $param{'backlog'}; if (!defined $num) { - &help("backlog"); + &help('backlog'); return; } elsif ($num !~ /^\d+/) { &msg($who, "error: argument is not positive integer."); @@ -132,8 +132,8 @@ sub userDCC { # dump variables. if ($message =~ /^dumpvars$/i) { - return unless (&hasFlag("o")); - return unless (&IsParam("DumpVars")); + return unless (&hasFlag('o')); + return unless (&IsParam('DumpVars')); &status("Dumping all variables..."); &dumpallvars(); @@ -154,12 +154,12 @@ sub userDCC { # kick. if ($message =~ /^kick(\s+(.*?))$/) { - return unless (&hasFlag("o")); + return unless (&hasFlag('o')); my $arg = $2; - if ($arg eq "") { - &help("kick"); + if ($arg eq '') { + &help('kick'); return; } my @args = split(/\s+/, $arg); @@ -182,11 +182,11 @@ sub userDCC { # mode. if ($message =~ /^mode(\s+(.*))?$/) { - return unless (&hasFlag("n")); + return unless (&hasFlag('n')); my ($chan,$mode) = split /\s+/,$2,2; - if ($chan eq "") { - &help("mode"); + if ($chan eq '') { + &help('mode'); return; } @@ -207,12 +207,12 @@ sub userDCC { # part. if ($message =~ /^part(\s+(\S+))?$/i) { - return unless (&hasFlag("o")); + return unless (&hasFlag('o')); my $jchan = $2; if ($jchan !~ /^$mask{chan}$/) { &msg($who, "error, invalid chan."); - &help("part"); + &help('part'); return; } @@ -228,12 +228,12 @@ sub userDCC { # lobotomy. sometimes we want the bot to be _QUIET_. if ($message =~ /^(lobotomy|bequiet)$/i) { - return unless (&hasFlag("o")); + return unless (&hasFlag('o')); if ($lobotomized) { &performReply("i'm already lobotomized"); } else { - &performReply("i have been lobotomized"); + &performReply('i have been lobotomized'); $lobotomized = 1; } @@ -242,10 +242,10 @@ sub userDCC { # unlobotomy. if ($message =~ /^(unlobotomy|benoisy)$/i) { - return unless (&hasFlag("o")); + return unless (&hasFlag('o')); if ($lobotomized) { - &performReply("i have been unlobotomized, woohoo"); + &performReply('i have been unlobotomized, woohoo'); $lobotomized = 0; delete $cache{lobotomy}; # undef $cache{lobotomy}; # ?? @@ -258,7 +258,7 @@ sub userDCC { # op. if ($message =~ /^op(\s+(.*))?$/i) { - return unless (&hasFlag("o")); + return unless (&hasFlag('o')); my ($opee) = lc $2; my @chans; @@ -305,7 +305,7 @@ sub userDCC { # deop. if ($message =~ /^deop(\s+(.*))?$/i) { - return unless (&hasFlag("o")); + return unless (&hasFlag('o')); my ($opee) = lc $2; my @chans; @@ -352,7 +352,7 @@ sub userDCC { # say. if ($message =~ s/^say\s+(\S+)\s+(.*)//) { - return unless (&hasFlag("o")); + return unless (&hasFlag('o')); my ($chan,$msg) = (lc $1, $2); &DEBUG("chan => '$1', msg => '$msg'."); @@ -364,7 +364,7 @@ sub userDCC { # do. if ($message =~ s/^do\s+(\S+)\s+(.*)//) { - return unless (&hasFlag("o")); + return unless (&hasFlag('o')); my ($chan,$msg) = (lc $1, $2); &DEBUG("chan => '$1', msg => '$msg'."); @@ -376,7 +376,7 @@ sub userDCC { # die. if ($message =~ /^die$/) { - return unless (&hasFlag("n")); + return unless (&hasFlag('n')); &doExit(); @@ -387,7 +387,7 @@ sub userDCC { # global factoid substitution. if ($message =~ m|^\* =~ s([/,#])(.+?)\1(.*?)\1;?\s*$|) { my ($delim,$op,$np) = ($1, $2, $3); - return unless (&hasFlag("n")); + return unless (&hasFlag('n')); ### TODO: support flags to do full-on global. # incorrect format. @@ -398,8 +398,8 @@ sub userDCC { ### TODO: fix up $op to support mysql/sqlite/pgsql ### TODO: => add db/sql specific function to fix this. - my @list = &searchTable("factoids", "factoid_key", - "factoid_value", $op); + my @list = &searchTable('factoids', 'factoid_key', + 'factoid_value', $op); if (!scalar @list) { &performReply("Expression didn't match anything."); @@ -412,7 +412,7 @@ sub userDCC { } &status("gsubst: going to alter ".scalar(@list)." factoids."); - &performReply("going to alter ".scalar(@list)." factoids."); + &performReply('going to alter '.scalar(@list)." factoids."); my $error = 0; foreach (@list) { @@ -430,7 +430,7 @@ sub userDCC { &performReply("that's too long (or was long)"); return; } - &setFactInfo($faqtoid, "factoid_value", $result); + &setFactInfo($faqtoid, 'factoid_value', $result); &status("update: '$faqtoid' =is=> '$result'; was '$was'"); } else { &WARN("subst: that's weird... thought we found the string ($op) in '$faqtoid'."); @@ -443,17 +443,17 @@ sub userDCC { } &performReply("Ok... did s/$op/$np/ for ". - (scalar(@list) - $error)." factoids"); + (scalar(@list) - $error).' factoids'); return; } # jump. if ($message =~ /^jump(\s+(\S+))?$/i) { - return unless (&hasFlag("n")); + return unless (&hasFlag('n')); - if ($2 eq "") { - &help("jump"); + if ($2 eq '') { + &help('jump'); return; } @@ -476,7 +476,7 @@ sub userDCC { # reload. if ($message =~ /^reload$/i) { - return unless (&hasFlag("n")); + return unless (&hasFlag('n')); &status("USER reload $who"); &performStrictReply("reloading..."); @@ -488,7 +488,7 @@ sub userDCC { # reset. if ($message =~ /^reset$/i) { - return unless (&hasFlag("n")); + return unless (&hasFlag('n')); &msg($who,"resetting..."); my @done; @@ -501,26 +501,26 @@ sub userDCC { push(@done, $_); sleep 1; } - &DEBUG("before clearircvars"); + &DEBUG('before clearircvars'); &clearIRCVars(); - &DEBUG("before joinnextchan"); + &DEBUG('before joinnextchan'); &joinNextChan(); - &DEBUG("after joinnextchan"); + &DEBUG('after joinnextchan'); &status("USER reset $who"); - &msg($who,"reset complete"); + &msg($who,'reset complete'); return; } # rehash. if ($message =~ /^rehash$/) { - return unless (&hasFlag("n")); + return unless (&hasFlag('n')); &msg($who,"rehashing..."); - &restart("REHASH"); + &restart('REHASH'); &status("USER rehash $who"); - &msg($who,"rehashed"); + &msg($who,'rehashed'); return; } @@ -533,7 +533,7 @@ sub userDCC { my @args = split /[\s\t]+/, $2; # hrm. if (scalar @args != 1) { - &help("chaninfo"); + &help('chaninfo'); return; } @@ -568,14 +568,14 @@ sub userDCC { } if (!scalar @chans) { - push(@chans, "_default"); + push(@chans, '_default'); $no_chan = 1; } my($what,$val) = split /[\s\t]+/, $args, 2; ### TODO: "cannot set values without +m". - return unless (&hasFlag("n")); + return unless (&hasFlag('n')); # READ ONLY. if (defined $what and $what !~ /^[-+]/ and !defined $val and $no_chan) { @@ -602,17 +602,17 @@ sub userDCC { } ### TODO: move to UserDCC again. - if ($cmd eq "chanset" and !defined $what) { + if ($cmd eq 'chanset' and !defined $what) { &DEBUG("showing channel conf."); foreach $chan (@chans) { if ($chan eq '_default') { - &performStrictReply("Default channel settings"); + &performStrictReply('Default channel settings'); } else { &performStrictReply("chan: $chan (see _default also)"); } my @items; - my $str = ""; + my $str = ''; foreach (sort keys %{ $chanconf{$chan} }) { my $newstr = join(', ', @items); ### TODO: make length use channel line limit? @@ -642,12 +642,12 @@ sub userDCC { } if ($message =~ /^(chanunset|\-chan)(\s+(.*))?$/) { - return unless (&hasFlag("n")); + return unless (&hasFlag('n')); my $args = $3; my $no_chan = 0; if (!defined $args) { - &help("chanunset"); + &help('chanunset'); return; } @@ -658,7 +658,7 @@ sub userDCC { $delete = ($1) ? 1 : 0; } else { &VERB("no chan arg; setting to default.",2); - $chan = "_default"; + $chan = '_default'; $no_chan = 1; } @@ -667,7 +667,7 @@ sub userDCC { return; } - if ($args ne "") { + if ($args ne '') { if (!&getChanConf($args,$chan)) { &performStrictReply("$args does not exist for $chan"); @@ -676,7 +676,7 @@ sub userDCC { my @chans = &ChanConfList($args); &DEBUG("scalar chans => ".scalar(@chans) ); - if (scalar @chans == 1 and $chans[0] eq "_default" and !$no_chan) { + if (scalar @chans == 1 and $chans[0] eq '_default' and !$no_chan) { &performStrictReply("ok, $args was set only for _default; unsetting for _defaul but setting for other chans."); my $val = $chanconf{$_}{_default}; @@ -730,7 +730,7 @@ sub userDCC { my(@args) = split /[\s\t]+/, $2 || ''; if (scalar @args != 1) { - &help("newpass"); + &help('newpass'); return; } @@ -750,7 +750,7 @@ sub userDCC { my(@args) = split /[\s\t]+/, $2 || ''; if (!scalar @args) { - &help("chpass"); + &help('chpass'); return; } @@ -767,7 +767,7 @@ sub userDCC { if (scalar @args == 1) { # del pass. - if (!&IsFlag("n") and $who !~ /^\Q$verifyUser\E$/i) { + if (!&IsFlag('n') and $who !~ /^\Q$verifyUser\E$/i) { &performStrictReply("cannot remove passwd of others."); return; } @@ -801,7 +801,7 @@ sub userDCC { my(@args) = split /[\s\t]+/, $2 || ''; if (!scalar @args) { - &help("chattr"); + &help('chattr'); return; } @@ -832,9 +832,9 @@ sub userDCC { &DEBUG("who => $who"); &DEBUG("verifyUser => $verifyUser"); - if (!&IsFlag("n") and $who !~ /^\Q$verifyUser\E$/i) { + if (!&IsFlag('n') and $who !~ /^\Q$verifyUser\E$/i) { &performStrictReply("cannto change attributes of others."); - return "REPLY"; + return 'REPLY'; } my $state; @@ -852,7 +852,7 @@ sub userDCC { next if ($flags =~ /\Q$_\E/); $flags .= $_; } else { - if (&IsParam("owner") + if (&IsParam('owner') and $param{owner} =~ /^\Q$user\E$/i and $flags =~ /[nmo]/ ) { @@ -882,13 +882,13 @@ sub userDCC { if ($message =~ /^chnick(\s+(.*))?$/) { my(@args) = split /[\s\t]+/, $2 || ''; - if ($who eq "_default") { + if ($who eq '_default') { &WARN("$who or verifyuser tried to run chnick."); - return "REPLY"; + return 'REPLY'; } if (!scalar @args or scalar @args > 2) { - &help("chnick"); + &help('chnick'); return; } @@ -917,9 +917,9 @@ sub userDCC { return; } - if (!&IsFlag("n") and $who !~ /^\Q$verifyUser\E$/i) { + if (!&IsFlag('n') and $who !~ /^\Q$verifyUser\E$/i) { &performStrictReply("cannto change nick of others."); - return "REPLY" if ($who eq "_default"); + return 'REPLY' if ($who eq '_default'); return; } @@ -938,7 +938,7 @@ sub userDCC { } if ($message =~ /^([-+])host(\s+(.*))?$/) { - my $cmd = $1."host"; + my $cmd = $1.'host'; my(@args) = split /[\s\t]+/, $3 || ''; my $state = ($1 eq "+") ? 1 : 0; @@ -947,14 +947,14 @@ sub userDCC { return; } - if ($who eq "_default") { + if ($who eq '_default') { &WARN("$who or verifyuser tried to run $cmd."); - return "REPLY"; + return 'REPLY'; } my ($user,$mask); if ($args[0] =~ /^$mask{nick}$/i) { # - return unless (&hasFlag("n")); + return unless (&hasFlag('n')); $user = &getUser($args[0]); $mask = $args[1]; } else { # @@ -969,11 +969,11 @@ sub userDCC { } if (!defined $mask) { - &performStrictReply("Hostmasks for $user: " . join(" ", keys %{$users{$user}{HOSTS}})); + &performStrictReply("Hostmasks for $user: " . join(' ', keys %{$users{$user}{HOSTS}})); return; } - if (!&IsFlag("n") and $who !~ /^\Q$verifyUser\E$/i) { + if (!&IsFlag('n') and $who !~ /^\Q$verifyUser\E$/i) { &performStrictReply("cannto change masks of others."); return; } @@ -1021,7 +1021,7 @@ sub userDCC { } if ($message =~ /^([-+])ban(\s+(.*))?$/) { - my $cmd = $1."ban"; + my $cmd = $1.'ban'; my $flatarg = $3; my(@args) = split /[\s\t]+/, $3 || ''; my $state = ($1 eq "+") ? 1 : 0; @@ -1042,7 +1042,7 @@ sub userDCC { if ($flatarg =~ s/^($mask{chan})\s*//) { $chan = $1; } else { - $chan = "*"; # _default instead? + $chan = '*'; # _default instead? } if ($state == 0) { # delete. @@ -1081,7 +1081,7 @@ sub userDCC { $reason = $1; } - if (!&IsFlag("n") and $who !~ /^\Q$verifyUser\E$/i) { + if (!&IsFlag('n') and $who !~ /^\Q$verifyUser\E$/i) { &performStrictReply("cannto change masks of others."); return; } @@ -1103,7 +1103,7 @@ sub userDCC { my $arg = $2; if (!defined $arg) { - &help("whois"); + &help('whois'); return; } @@ -1118,7 +1118,7 @@ sub userDCC { foreach (keys %{ $users{$user} }) { my $ref = ref $users{$user}{$_}; - if ($ref eq "HASH") { + if ($ref eq 'HASH') { my $type = $_; ### DOES NOT WORK??? foreach (keys %{ $users{$user}{$type} }) { @@ -1138,7 +1138,7 @@ sub userDCC { my $arg = $2; if (defined $arg) { - if ($arg ne "_default" and !&validChan($arg) ) { + if ($arg ne '_default' and !&validChan($arg) ) { &performStrictReply("error: chan $chan is invalid."); return; } @@ -1158,7 +1158,7 @@ sub userDCC { foreach (keys %{ $bans{$c} }) { my $val = $bans{$c}{$_}; - if (ref $val eq "ARRAY") { + if (ref $val eq 'ARRAY') { my @array = @{ $val }; &performStrictReply(" $_: @array"); } else { @@ -1191,11 +1191,11 @@ sub userDCC { } if ($message =~ /^save$/) { - return unless (&hasFlag("o")); + return unless (&hasFlag('o')); &writeUserFile(); &writeChanFile(); - &performStrictReply("saved user and chan files"); + &performStrictReply('saved user and chan files'); return; } @@ -1206,9 +1206,9 @@ sub userDCC { # ignore. if ($message =~ /^(\+|\-)ignore(\s+(.*))?$/i) { - return unless (&hasFlag("o")); + return unless (&hasFlag('o')); my $state = ($1 eq "+") ? 1 : 0; - my $str = $1."ignore"; + my $str = $1.'ignore'; my $args = $3; if (!$args) { @@ -1243,7 +1243,7 @@ sub userDCC { if ($args =~ s/^($mask{chan}|\*)\s*//) { $chan = $1; } else { - $chan = "*"; + $chan = '*'; } # time. @@ -1300,7 +1300,7 @@ sub userDCC { foreach (keys %{ $ignore{$c} }) { my $ref = ref $ignore{$c}{$_}; - if ($ref eq "ARRAY") { + if ($ref eq 'ARRAY') { my @array = @{ $ignore{$c}{$_} }; &performStrictReply(" $_: @array"); } else { @@ -1316,7 +1316,7 @@ sub userDCC { # adduser/deluser. if ($message =~ /^(add|del)user(\s+(.*))?$/i) { my $str = $1; - my $strstr = $1."user"; + my $strstr = $1.'user'; my @args = split /\s+/, $3 || ''; my $args = $3; my $state = ($str =~ /^(add)$/) ? 1 : 0; @@ -1402,7 +1402,7 @@ sub userDCC { my @time; foreach (sort { $a <=> $b } keys %time) { - my $str = join(", ", sort keys %{ $time{$_} }); + my $str = join(', ', sort keys %{ $time{$_} }); &DEBUG("time => $_, str => $str"); push(@time, "$str (".&Time2String($_).")"); } @@ -1415,7 +1415,7 @@ sub userDCC { } # quite a cool hack: reply in DCC CHAT. - $msgType = "chat" if (exists $dcc{'CHAT'}{$who}); + $msgType = 'chat' if (exists $dcc{'CHAT'}{$who}); my $done = 0; $done++ if &parseCmdHook($message); @@ -1426,7 +1426,7 @@ sub userDCC { return; } - return "REPLY"; + return 'REPLY'; } 1; diff --git a/blootbot/src/Modules/UserInfo.pl b/blootbot/src/Modules/UserInfo.pl index e35373b..b26b34e 100644 --- a/blootbot/src/Modules/UserInfo.pl +++ b/blootbot/src/Modules/UserInfo.pl @@ -9,13 +9,13 @@ use strict; -my $orderOfInfo = "RN,J,C,W,D"; +my $orderOfInfo = 'RN,J,C,W,D'; my %infoDesc = ( - "RN" => "Real Name", - "J" => "Occupation", - "C" => "Contact", - "W" => "URL", - "D" => "Description", + 'RN' => 'Real Name', + 'J' => 'Occupation', + 'C' => 'Contact', + 'W' => 'URL', + 'D' => 'Description', ); sub UserInfo2Hash { @@ -61,7 +61,7 @@ sub UserInfoGet { } my $result; - if ($result = &getFactoid($query." info")) { + if ($result = &getFactoid($query.' info')) { # good. } else { # bad. &performReply("No User Information on \002$query\002"); @@ -160,7 +160,7 @@ sub UserInfoSet { $userInfo{$info} = $what; } - &setFactInfo($who." info", "factoid_value", &Hash2UserInfo(%userInfo)); + &setFactInfo($who.' info', 'factoid_value', &Hash2UserInfo(%userInfo)); if ($new) { &DEBUG("UIS: locking '$who info'."); &DEBUG("UIS: nuh => '$nuh'."); diff --git a/blootbot/src/Modules/W3Search.pl b/blootbot/src/Modules/W3Search.pl index 4ce8474..9935c05 100644 --- a/blootbot/src/Modules/W3Search.pl +++ b/blootbot/src/Modules/W3Search.pl @@ -44,7 +44,7 @@ sub W3Search { # search_parse_debug => 2, } ); - $Search->http_proxy($::param{'httpProxy'}) if (&::IsParam("httpProxy")); + $Search->http_proxy($::param{'httpProxy'}) if (&::IsParam('httpProxy')); #my $max = $Search->maximum_to_retrieve(10); # DOES NOT WORK. my (@results, $count, $r); diff --git a/blootbot/src/Modules/Weather.pl b/blootbot/src/Modules/Weather.pl index ecf37cf..d21e74e 100644 --- a/blootbot/src/Modules/Weather.pl +++ b/blootbot/src/Modules/Weather.pl @@ -51,7 +51,7 @@ sub queryText { } my $ua = new LWP::UserAgent; - $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam("httpProxy")); + $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam('httpProxy')); $ua->timeout(10); my $request = new HTTP::Request('GET', "http://weather.noaa.gov/weather/current/$station.html"); @@ -64,7 +64,7 @@ sub queryText { . " or http://www.nws.noaa.gov/tg/siteloc.shtml" . " for ICAO locations codes)."; } else { - return "Something failed in connecting to the NOAA web" + return 'Something failed in connecting to the NOAA web' . " server. Try again later."; } } @@ -105,7 +105,7 @@ sub queryText { if ($time) { if ($wxmode eq 'metar' && defined($feat{'ob'})) { - return ("METAR " . $place . ": " . $feat{'ob'}); + return ('METAR ' . $place . ": " . $feat{'ob'}); } $result = "$place; $id; last updated: $time"; diff --git a/blootbot/src/Modules/Wingate.pl b/blootbot/src/Modules/Wingate.pl index bb93593..da9deed 100644 --- a/blootbot/src/Modules/Wingate.pl +++ b/blootbot/src/Modules/Wingate.pl @@ -73,7 +73,7 @@ sub Wingate { &::status("Wingate: RUNNING ON $host BY $::who."); if (&::IsChanConf('wingateBan') > 0) { - &::ban("*!*\@$host", ""); + &::ban("*!*\@$host", ''); } my $reason = &::getChanConf('wingateKick'); diff --git a/blootbot/src/Modules/Zippy.pl b/blootbot/src/Modules/Zippy.pl index d496537..51c7403 100644 --- a/blootbot/src/Modules/Zippy.pl +++ b/blootbot/src/Modules/Zippy.pl @@ -13,7 +13,7 @@ my $no_zippy; # Can't think of any situation in which this won't work.. sub zippy::get { my @yows; - &::DEBUG("Reading zippy data"); + &::DEBUG('Reading zippy data'); while () { chomp; push @yows, $_; diff --git a/blootbot/src/Modules/babelfish.pl b/blootbot/src/Modules/babelfish.pl index 850292b..e7774cc 100644 --- a/blootbot/src/Modules/babelfish.pl +++ b/blootbot/src/Modules/babelfish.pl @@ -63,7 +63,7 @@ sub babelfishParam { $to = $lang_code{$to}; my $ua = new LWP::UserAgent; - $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam("httpProxy")); + $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam('httpProxy')); # Let's pretend $ua->agent("Mozilla/5.0 " . $ua->agent); $ua->timeout(5); diff --git a/blootbot/src/Modules/botmail.pl b/blootbot/src/Modules/botmail.pl index 97d4e52..be246d0 100644 --- a/blootbot/src/Modules/botmail.pl +++ b/blootbot/src/Modules/botmail.pl @@ -15,7 +15,7 @@ sub parse { my($what) = @_; if (!defined $what or $what =~ /^\s*$/) { - &::help("botmail"); + &::help('botmail'); return; } @@ -36,8 +36,8 @@ sub parse { } sub stats { - my $botmail = &::countKeys("botmail"); - &::msg($::who, "I have \002$botmail\002 ". &::fixPlural("message", $botmail). "."); + my $botmail = &::countKeys('botmail'); + &::msg($::who, "I have \002$botmail\002 ". &::fixPlural('message', $botmail). "."); } ##### @@ -46,7 +46,7 @@ sub check { my($recipient, $always) = @_; $recipient ||= $::who; - my %from = &::sqlSelectColHash("botmail", "srcwho,time", { + my %from = &::sqlSelectColHash('botmail', "srcwho,time", { dstwho => lc $recipient } ); my $t = keys %from; @@ -64,7 +64,7 @@ sub check { sub next { my($recipient) = @_; - my %hash = &::sqlSelectRowHash("botmail", "*", { + my %hash = &::sqlSelectRowHash('botmail', '*', { dstwho => lc $recipient } ); @@ -75,7 +75,7 @@ sub next { my $ago = &::Time2String(time() - $hash{'time'}); &::msg($recipient, "From $hash{srcwho} ($hash{srcuh}) on $date ($ago ago):"); &::msg($recipient, $hash{'msg'}); - &::sqlDelete("botmail", { 'dstwho'=>$hash{dstwho}, 'srcwho'=>$hash{srcwho}}); + &::sqlDelete('botmail', { 'dstwho'=>$hash{dstwho}, 'srcwho'=>$hash{srcwho}}); } } @@ -91,7 +91,7 @@ sub add { # only support 1 botmail with unique dstwho/srcwho to have same # functionality as botmail from infobot. # Note: I removed the &::sqlQuote reference. Seems to be working and inserting fine without it here. -- troubled - my %hash = &::sqlSelectRowHash("botmail", "*", { + my %hash = &::sqlSelectRowHash('botmail', '*', { srcwho => lc $::who, dstwho => lc $recipient } ); @@ -101,7 +101,7 @@ sub add { return; } - &::sqlInsert("botmail", { + &::sqlInsert('botmail', { 'dstwho' => lc $recipient, 'srcwho' => lc $::who, 'srcuh' => $::nuh, diff --git a/blootbot/src/Modules/insult.pl b/blootbot/src/Modules/insult.pl index e39fbcc..a09beae 100644 --- a/blootbot/src/Modules/insult.pl +++ b/blootbot/src/Modules/insult.pl @@ -14,12 +14,12 @@ sub Insult { my @adjs; my @amts; my @nouns; - &::DEBUG("Reading insult data"); + &::DEBUG('Reading insult data'); while () { chomp; - push(@adjs, split(" ", $1)) if /^adj\s*(.*)/; - push(@amts, split(" ", $1)) if /^amt\s*(.*)/; - push(@nouns, split(" ", $1)) if /^noun\s*(.*)/; + push(@adjs, split(' ', $1)) if /^adj\s*(.*)/; + push(@amts, split(' ', $1)) if /^amt\s*(.*)/; + push(@nouns, split(' ', $1)) if /^noun\s*(.*)/; } grep(s/\|/ /g, @adjs); grep(s/\|/ /g, @amts); @@ -32,7 +32,7 @@ sub Insult { my $adj2 = @adjs[rand(@adjs)]; my $noun = @nouns[rand(@nouns)]; my $whois = "$insultwho is"; - $whois = "You are" if ($insultwho eq $::who or $insultwho eq "me"); + $whois = 'You are' if ($insultwho eq $::who or $insultwho eq 'me'); &::performStrictReply("$whois nothing but a$n $adj $amt of $adj2 $noun"); } diff --git a/blootbot/src/Modules/md5.pl b/blootbot/src/Modules/md5.pl index 440e603..7bf1b51 100644 --- a/blootbot/src/Modules/md5.pl +++ b/blootbot/src/Modules/md5.pl @@ -9,7 +9,7 @@ package md5; sub md5 { my($message) = @_; - return unless &::loadPerlModule("Digest::MD5"); + return unless &::loadPerlModule('Digest::MD5'); &::performStrictReply(&Digest::MD5::md5_hex($message)); } diff --git a/blootbot/src/Modules/nickometer.pl b/blootbot/src/Modules/nickometer.pl index 881153e..6fe7fd0 100644 --- a/blootbot/src/Modules/nickometer.pl +++ b/blootbot/src/Modules/nickometer.pl @@ -46,7 +46,7 @@ sub query { ### TODO: compact with map? my @list; foreach (sort {$b <=> $a} keys %nickometer) { - my $str = join(", ", sort keys %{ $nickometer{$_} }); + my $str = join(', ', sort keys %{ $nickometer{$_} }); push(@list, "$str ($_%)"); } @@ -58,7 +58,7 @@ sub query { my $percentage = &nickometer($term); if ($percentage =~ /NaN/) { - $percentage = "off the scale"; + $percentage = 'off the scale'; } else { $percentage = sprintf("%0.4f", $percentage); $percentage =~ s/(\.\d+)0+$/$1/; @@ -143,7 +143,7 @@ sub nickometer ($) { $text =~ s/^([^\[\]]*) (\[) (.*) (\]) ([^\[\]]*) $/$1$3$5/x) { print "Removed $2$4 outside parentheses; nick now $_\n" if $verbose; - &punish(15, "brackets"); + &punish(15, 'brackets'); } my $parentheses = $text =~ tr/(){}[]/(){}[]/; &punish(&slow_pow(10, $parentheses), diff --git a/blootbot/src/Modules/pager.pl b/blootbot/src/Modules/pager.pl index 3d21175..c0e3285 100644 --- a/blootbot/src/Modules/pager.pl +++ b/blootbot/src/Modules/pager.pl @@ -64,14 +64,14 @@ sub pager::page { } my $channel = $::chan || 'infobot'; - # TODO disallow use from private message? $chan="_default" + # TODO disallow use from private message? $chan='_default' &::status("pager: from $from <$fromaddr>, to $to <$toaddr>, msg \"$msg\""); my %headers = ( To => "$to <$toaddr>", From => "$from <$fromaddr>", Subject => "Message from $channel!", - 'X-Mailer' => "blootbot", + 'X-Mailer' => 'blootbot', ); # my $logmsg; @@ -98,5 +98,5 @@ sub pager::page { &::performStrictReply($retval); } -"pager"; +'pager'; # vim: ts=2 sw=2 diff --git a/blootbot/src/Modules/piglatin.pl b/blootbot/src/Modules/piglatin.pl index d15135b..799ae77 100644 --- a/blootbot/src/Modules/piglatin.pl +++ b/blootbot/src/Modules/piglatin.pl @@ -14,7 +14,7 @@ sub piglatin # FIXME: does not handle: # non-trailing punctuation and hyphens - # y as vowel "style" -> "ylestay" + # y as vowel 'style' -> 'ylestay' # contractions for my $word (split /\s+/, $text) { my ($pigword, $postfix); diff --git a/blootbot/src/Modules/reverse.pl b/blootbot/src/Modules/reverse.pl index a6e2fd6..9790e1a 100644 --- a/blootbot/src/Modules/reverse.pl +++ b/blootbot/src/Modules/reverse.pl @@ -9,7 +9,7 @@ package reverse; sub reverse { my($message) = @_; - &::performStrictReply(join("",reverse(split("",$message)))); + &::performStrictReply(join('',reverse(split('',$message)))); } 1; diff --git a/blootbot/src/Modules/scramble.pl b/blootbot/src/Modules/scramble.pl index fbe91c5..6316148 100644 --- a/blootbot/src/Modules/scramble.pl +++ b/blootbot/src/Modules/scramble.pl @@ -44,7 +44,7 @@ sub scramble } # shuffle the middle letters - $new_middle = join "", List::Util::shuffle(split //, $middle); + $new_middle = join '', List::Util::shuffle(split //, $middle); } while (($cnt < 10) && ($middle eq $new_middle)); @@ -56,7 +56,7 @@ sub scramble # been included in the original string $scrambled =~ s/\s+$//; - &::performStrictReply($scrambled||"Unknown Error Condition"); + &::performStrictReply($scrambled||'Unknown Error Condition'); } 1; diff --git a/blootbot/src/Modules/slashdot.pl b/blootbot/src/Modules/slashdot.pl index 7b94b09..523a428 100644 --- a/blootbot/src/Modules/slashdot.pl +++ b/blootbot/src/Modules/slashdot.pl @@ -37,7 +37,7 @@ sub Slashdot { my $retval = "i could not get the headlines."; if (scalar @results) { - my $prefix = "Slashdot Headlines "; + my $prefix = 'Slashdot Headlines '; my @list = &slashdotParse(@results); $retval = &::formListReply(0, $prefix, @list); } diff --git a/blootbot/src/Modules/spell.pl b/blootbot/src/Modules/spell.pl index f6ff889..705854d 100644 --- a/blootbot/src/Modules/spell.pl +++ b/blootbot/src/Modules/spell.pl @@ -15,7 +15,7 @@ use strict; sub spell::spell { my $query = shift; if ($query =~ m/[^[:alpha:]]/) { - return("only one word of alphabetic characters supported"); + return('only one word of alphabetic characters supported'); } my $binary; @@ -33,11 +33,11 @@ sub spell::spell { } if (!$binary) { - return("no binary found."); + return('no binary found.'); } if (!&::validExec($query)) { - return("argument appears to be fuzzy."); + return('argument appears to be fuzzy.'); } my $reply = "I can't find alternate spellings for '$query'"; diff --git a/blootbot/src/Modules/wikipedia.pl b/blootbot/src/Modules/wikipedia.pl index 9117b87..13ce1bf 100644 --- a/blootbot/src/Modules/wikipedia.pl +++ b/blootbot/src/Modules/wikipedia.pl @@ -50,7 +50,7 @@ sub wikipedia_lookup { &::DEBUG("wikipedia($phrase)"); my $ua = new LWP::UserAgent; - $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam("httpProxy")); + $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam('httpProxy')); # Let's pretend $ua->agent("Mozilla/5.0 " . $ua->agent); $ua->timeout(5); @@ -137,7 +137,7 @@ sub wikipedia_lookup { #$text = substr($text, 0, 330); #$text =~ s/(.+)\.([^.]*)$/$1./g; - return("At " . $url . " (URL), Wikipedia explains: " . $text, + return('At ' . $url . " (URL), Wikipedia explains: " . $text, 1); } } @@ -150,7 +150,7 @@ sub wikipedia_get_text { &::DEBUG("wikipedia_get_text($article)"); my $ua = new LWP::UserAgent; - $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam("httpProxy")); + $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam('httpProxy')); # Let's pretend $ua->agent("Mozilla/5.0 " . $ua->agent); $ua->timeout(5); @@ -174,19 +174,19 @@ sub wikipedia_get_text { } elsif (/#REDIRECT\s*\[\[(.*?)\]\]/i) { $redirect = $1; $redirect =~ tr/ /_/; - &::DEBUG("wiki redirect to " . $redirect); + &::DEBUG('wiki redirect to ' . $redirect); last; } elsif (/]*>(.*)/) { $text = '"' . $1; } elsif (/(.*)<\/text>/) { - $text = $text . " " . $1 . '"'; + $text = $text . ' ' . $1 . '"'; last; } elsif ($text) { - $text = $text . " " . $_; + $text = $text . ' ' . $_; } } &::DEBUG("wikipedia returned text: " . $text . - ", redirect " . $redirect. "\n"); + ', redirect ' . $redirect. "\n"); if (!$redirect and !$text) { return ($res->as_string); diff --git a/blootbot/src/Modules/wtf.pl b/blootbot/src/Modules/wtf.pl index e654f36..554ac2c 100644 --- a/blootbot/src/Modules/wtf.pl +++ b/blootbot/src/Modules/wtf.pl @@ -35,7 +35,7 @@ sub wtf::wtf { return("argument appears to be fuzzy."); } - my $reply =""; + my $reply =''; foreach (`$binary '$query' 2>&1`){ $reply .= $_; } diff --git a/blootbot/src/Modules/zfi.pl b/blootbot/src/Modules/zfi.pl index 103f56f..dee9f5f 100644 --- a/blootbot/src/Modules/zfi.pl +++ b/blootbot/src/Modules/zfi.pl @@ -45,7 +45,7 @@ sub queryText { my $res_return = 5; my $ua = new LWP::UserAgent; - $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam("httpProxy")); + $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam('httpProxy')); $ua->timeout(10); diff --git a/blootbot/src/Modules/zsi.pl b/blootbot/src/Modules/zsi.pl index b11c277..778b549 100644 --- a/blootbot/src/Modules/zsi.pl +++ b/blootbot/src/Modules/zsi.pl @@ -45,7 +45,7 @@ sub queryText { my $res_return = 5; my $ua = new LWP::UserAgent; - $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam("httpProxy")); + $ua->proxy('http', $::param{'httpProxy'}) if (&::IsParam('httpProxy')); $ua->timeout(10); diff --git a/blootbot/src/Net.pl b/blootbot/src/Net.pl index 035ceba..2050c9e 100644 --- a/blootbot/src/Net.pl +++ b/blootbot/src/Net.pl @@ -84,10 +84,10 @@ sub ftpGet { my $delta_time = &timedelta($start_time); if ($delta_time > 0 and $verbose_ftp) { &status(sprintf("FTP: %.02f sec to complete.", $delta_time)); - my ($rateunit,$rate) = ("B", $size / $delta_time); + my ($rateunit,$rate) = ('B', $size / $delta_time); if ($rate > 1024) { $rate /= 1024; - $rateunit = "kB"; + $rateunit = 'kB'; } &status(sprintf("FTP: %.01f ${rateunit}/sec.", $rate)); } @@ -153,7 +153,7 @@ sub getURL { return unless &loadPerlModule("LWP::UserAgent"); $ua = new LWP::UserAgent; - $ua->proxy('http', $param{'httpProxy'}) if &IsParam("httpProxy"); + $ua->proxy('http', $param{'httpProxy'}) if &IsParam('httpProxy'); if (defined $post) { $req = new HTTP::Request('POST',$url); @@ -189,7 +189,7 @@ sub getURLAsFile { } $ua = new LWP::UserAgent; - $ua->proxy('http', $param{'httpProxy'}) if &IsParam("httpProxy"); + $ua->proxy('http', $param{'httpProxy'}) if &IsParam('httpProxy'); $req = HTTP::Request->new('GET', $url); &status("getURLAsFile: getting '$url' as '$file'"); $res = $ua->request($req, $file); diff --git a/blootbot/src/Shm.pl b/blootbot/src/Shm.pl index cebe4dc..170811b 100644 --- a/blootbot/src/Shm.pl +++ b/blootbot/src/Shm.pl @@ -13,7 +13,7 @@ sub openSHM { my $IPC_PRIVATE = 0; my $size = 2000; - if (&IsParam("noSHM")) { + if (&IsParam('noSHM')) { &status("Shared memory: Disabled. WARNING: bot may become unreliable"); return 0; } @@ -45,7 +45,7 @@ sub shmRead { my $size = 3*80; my $retval = ''; - return '' if (&IsParam("noSHM")); + return '' if (&IsParam('noSHM')); if (shmread($key,$retval,$position,$size)) { #&DEBUG("shmRead($key): $retval"); @@ -63,7 +63,7 @@ sub shmWrite { my $position = 0; my $size = 80*3; - return if (&IsParam("noSHM")); + return if (&IsParam('noSHM')); if (length($str) > $size) { &status("ERROR: length(str) (..)>$size..."); @@ -81,7 +81,7 @@ sub shmWrite { my $read = &shmRead($key); $read =~ s/\0+//g; - if ($read eq "") { + if ($read eq '') { $str = sprintf("%s:%d:%d: ", $param{ircUser}, $bot_pid, time()); } else { $str = $read ."||". $str; @@ -229,8 +229,8 @@ sub shmFlush { return if ($$ != $::bot_pid); # fork protection. if (@_) { - &ScheduleThis(15, "shmFlush"); - return if ($_[0] eq "2"); + &ScheduleThis(15, 'shmFlush'); + return if ($_[0] eq '2'); } my $time; @@ -272,7 +272,7 @@ sub shmFlush { } } - &shmWrite($shm,"") if ($shmmsg ne ""); + &shmWrite($shm,'') if ($shmmsg ne ''); } 1; diff --git a/blootbot/src/UserExtra.pl b/blootbot/src/UserExtra.pl index 7be8132..f672f16 100644 --- a/blootbot/src/UserExtra.pl +++ b/blootbot/src/UserExtra.pl @@ -552,7 +552,7 @@ sub userCommands { my $reply = $3; if (!defined $reply) { - &help("rot13"); + &help('rot13'); return; } my $num = $1 % 26; diff --git a/blootbot/src/core.pl b/blootbot/src/core.pl index ecbcee5..1b7a68c 100644 --- a/blootbot/src/core.pl +++ b/blootbot/src/core.pl @@ -47,8 +47,8 @@ $SIG{'__WARN__'} = 'doWarn'; # initialize variables. $last{buflen} = 0; -$last{say} = ""; -$last{msg} = ""; +$last{say} = ''; +$last{msg} = ''; $userHandle = "_default"; $wingaterun = time(); $firsttime = 1; @@ -79,22 +79,22 @@ $notsize = 0; $notcount = 0; ### $bot_release = "1.3.3"; -if ( -d "CVS" ) { +if ( -d 'CVS' ) { use POSIX qw(strftime); - $bot_release .= strftime(" cvs (%Y%m%d)", gmtime( (stat("CVS"))[9] ) ); + $bot_release .= strftime(" cvs (%Y%m%d)", gmtime( (stat('CVS'))[9] ) ); } $bot_version = "blootbot $bot_release -- $^O"; -$noreply = "NOREPLY"; +$noreply = 'NOREPLY'; ########## ### misc commands. ### sub whatInterface { - if (!&IsParam("Interface") or $param{'Interface'} =~ /IRC/) { - return "IRC"; + if (!&IsParam('Interface') or $param{'Interface'} =~ /IRC/) { + return 'IRC'; } else { - return "CLI"; + return 'CLI'; } } @@ -113,7 +113,7 @@ sub doExit { &status("parent caught SIG$sig (pid $$).") if (defined $sig); &status("--- Start of quit."); - $ident ||= "blootbot"; # lame hack. + $ident ||= 'blootbot'; # lame hack. &status("Memory Usage: $memusage KiB"); @@ -131,13 +131,13 @@ sub doExit { &sqlCloseDB(); &closeSHM($shm); - if (&IsParam("dumpvarsAtExit")) { + if (&IsParam('dumpvarsAtExit')) { &loadMyModule('DumpVars'); &dumpallvars(); } - &symdumpAll() if (&IsParam("symdumpAtExit")); + &symdumpAll() if (&IsParam('symdumpAtExit')); &closeLog(); - &closeSQLDebug() if (&IsParam("SQLDebug")); + &closeSQLDebug() if (&IsParam('SQLDebug')); &status("--- QUIT."); } else { # child. @@ -206,7 +206,7 @@ sub getChanConfList { &WARN("multiple items found?"); } - if ($chanconf{$chan}{$param} eq "0") { + if ($chanconf{$chan}{$param} eq '0') { $chan{$chan} = -1; } else { $chan{$chan} = 1; @@ -224,7 +224,7 @@ sub IsChanConf { my($param) = shift; # knocked tons of bugs with this! :) - my $debug = 0; # 1 if ($param eq "whatever"); + my $debug = 0; # 1 if ($param eq 'whatever'); if (!defined $param) { &WARN("IsChanConf: param == NULL."); @@ -251,7 +251,7 @@ sub IsChanConf { if (!defined $msgType) { $nomatch++; } else { - $nomatch++ if ($msgType eq ""); + $nomatch++ if ($msgType eq ''); $nomatch++ unless ($msgType =~ /^(public|private)$/i); } @@ -317,7 +317,7 @@ sub getChanConf { if (!defined $chanconf{$c[0]}{$param} and ($c ne '_default')) { return &getChanConf($param, '_default'); } - #&DEBUG("gCC: $param,$c \"" . $chanconf{$c[0]}{$param} . '"'); + &DEBUG("gCC: $param,$c \"" . $chanconf{$c[0]}{$param} . '"'); return $chanconf{$c[0]}{$param}; } @@ -372,9 +372,9 @@ sub findChanConf { } sub showProc { - my ($prefix) = $_[0] || ""; + my ($prefix) = $_[0] || ''; - if ($^O eq "linux") { + if ($^O eq 'linux') { if (!open(IN, "/proc/$$/status")) { &ERROR("cannot open '/proc/$$/status'."); return; @@ -385,7 +385,7 @@ sub showProc { } close IN; - } elsif ($^O eq "netbsd") { + } elsif ($^O eq 'netbsd') { $memusage = int( (stat "/proc/$$/mem")[7]/1024 ); } elsif ($^O =~ /^(free|open)bsd$/) { @@ -393,11 +393,11 @@ sub showProc { $memusage = $info[20]; } else { - $memusage = "UNKNOWN"; + $memusage = 'UNKNOWN'; return; } - if (defined $memusageOld and &IsParam("DEBUG")) { + if (defined $memusageOld and &IsParam('DEBUG')) { # it's always going to be increase. my $delta = $memusage - $memusageOld; my $str; @@ -435,18 +435,18 @@ sub setup { &loadMyModulesNow(); # must be after chan file. $shm = &openSHM(); - &openSQLDebug() if (&IsParam("SQLDebug")); + &openSQLDebug() if (&IsParam('SQLDebug')); &sqlOpenDB($param{'DBName'}, $param{'DBType'}, $param{'SQLUser'}, $param{'SQLPass'}); &checkTables(); - &status("Setup: ". &countKeys("factoids") ." factoids."); - &getChanConfDefault("sendPrivateLimitLines", 3, $chan); - &getChanConfDefault("sendPrivateLimitBytes", 1000, $chan); - &getChanConfDefault("sendPublicLimitLines", 3, $chan); - &getChanConfDefault("sendPublicLimitBytes", 1000, $chan); - &getChanConfDefault("sendNoticeLimitLines", 3, $chan); - &getChanConfDefault("sendNoticeLimitBytes", 1000, $chan); + &status("Setup: ". &countKeys('factoids') ." factoids."); + &getChanConfDefault('sendPrivateLimitLines', 3, $chan); + &getChanConfDefault('sendPrivateLimitBytes', 1000, $chan); + &getChanConfDefault('sendPublicLimitLines', 3, $chan); + &getChanConfDefault('sendPublicLimitBytes', 1000, $chan); + &getChanConfDefault('sendNoticeLimitLines', 3, $chan); + &getChanConfDefault('sendNoticeLimitBytes', 1000, $chan); $param{tempDir} =~ s#\~/#$ENV{HOME}/#; @@ -484,7 +484,7 @@ sub setupConfig { } sub startup { - if (&IsParam("DEBUG")) { + if (&IsParam('DEBUG')) { &status("enabling debug diagnostics."); # I thought disabling this reduced memory usage by 1000 KiB. use diagnostics; @@ -502,7 +502,7 @@ sub shutdown { &status("--- shutdown called."); # hack. - $ident ||= "blootbot"; + $ident ||= 'blootbot'; if (!&isFileUpdated("$bot_state_dir/blootbot.users", $wtime_userfile)) { &writeUserFile() @@ -537,10 +537,10 @@ sub restart { &ircCheck(); # heh, evil! - &DCCBroadcast("-HUP called.","m"); + &DCCBroadcast("-HUP called.",'m'); &shutdown($sig); &loadConfig($bot_config_dir."/blootbot.config"); - &reloadAllModules() if (&IsParam("DEBUG")); + &reloadAllModules() if (&IsParam('DEBUG')); &setup(); &status("--- End of $sig."); @@ -566,7 +566,7 @@ sub loadConfig { next unless /\S/; my ($set,$key,$val) = split(/\s+/, $_, 3); - if ($set ne "set") { + if ($set ne 'set') { &status("loadConfig: invalid line '$_'."); next; } diff --git a/blootbot/src/dbi.pl b/blootbot/src/dbi.pl index 3bdedb7..a732856 100644 --- a/blootbot/src/dbi.pl +++ b/blootbot/src/dbi.pl @@ -23,15 +23,15 @@ sub sqlOpenDB { $db = "dbname=$db.sqlite"; } elsif ($type =~ /^pg/i) { $db = "dbname=$db"; - $type = "Pg"; + $type = 'Pg'; } my $dsn = "DBI:$type:$db"; - my $hoststr = ""; + my $hoststr = ''; # SQLHost should be unset for SQLite if (exists $param{'SQLHost'} and $param{'SQLHost'}) { - # PostgreSQL requires ";" and keyword "host". See perldoc Pg -- troubled - if ($type eq "Pg") { + # PostgreSQL requires ";" and keyword 'host'. See perldoc Pg -- troubled + if ($type eq 'Pg') { $dsn .= ";host=$param{SQLHost}"; } else { $dsn .= ":$param{SQLHost}"; @@ -61,7 +61,7 @@ sub sqlCloseDB { return 0 unless ($dbh); my $x = $param{SQLHost}; - my $hoststr = ($x) ? " to $x" : ""; + my $hoststr = ($x) ? " to $x" : ''; &status("Closed DBI connection$hoststr."); $dbh->disconnect(); @@ -232,7 +232,7 @@ sub sqlSet { return; } - if (!defined $data_href or ref($data_href) ne "HASH") { + if (!defined $data_href or ref($data_href) ne 'HASH') { &WARN("sqlSet: data_href == NULL."); return; } @@ -265,7 +265,7 @@ sub sqlSet { sub sqlUpdate { my ($table, $data_href, $where_href) = @_; - if (!defined $data_href or ref($data_href) ne "HASH") { + if (!defined $data_href or ref($data_href) ne 'HASH') { &WARN("sqlSet: data_href == NULL."); return 0; } @@ -273,7 +273,7 @@ sub sqlUpdate { my $where = &hashref2where($where_href) if ($where_href); my $update = &hashref2update($data_href) if ($data_href); - &sqlRaw("Update", "UPDATE $table SET $update WHERE $where"); + &sqlRaw('Update', "UPDATE $table SET $update WHERE $where"); return 1; } @@ -282,10 +282,10 @@ sub sqlUpdate { # Usage: &sqlInsert($table, $data_href, $other); sub sqlInsert { my ($table, $data_href, $other) = @_; - # note: if $other == 1, add "DELAYED" to function instead. + # note: if $other == 1, add 'DELAYED' to function instead. # note: ^^^ doesnt actually do anything lol. Need code to s/1/DELAYED/ below -- troubled - if (!defined $data_href or ref($data_href) ne "HASH") { + if (!defined $data_href or ref($data_href) ne 'HASH') { &WARN("sqlInsert: data_href == NULL."); return; } @@ -301,7 +301,7 @@ sub sqlInsert { return &sqlRaw("Insert($table)", sprintf( "INSERT %s INTO %s (%s) VALUES (%s)", - ($other || ""), $table, join(',',@k), join(',',@v) + ($other || ''), $table, join(',',@k), join(',',@v) ) ); } @@ -310,7 +310,7 @@ sub sqlInsert { sub sqlReplace { my ($table, $data_href, $pkey) = @_; - if (!defined $data_href or ref($data_href) ne "HASH") { + if (!defined $data_href or ref($data_href) ne 'HASH') { &WARN("sqlReplace: data_href == NULL."); return; } @@ -356,14 +356,14 @@ sub sqlReplace { sub sqlDelete { my ($table, $where_href) = @_; - if (!defined $where_href or ref($where_href) ne "HASH") { + if (!defined $where_href or ref($where_href) ne 'HASH') { &WARN("sqlDelete: where_href == NULL."); return; } my $where = &hashref2where($where_href); - &sqlRaw("Delete", "DELETE FROM $table WHERE $where"); + &sqlRaw('Delete', "DELETE FROM $table WHERE $where"); return 1; } @@ -443,7 +443,7 @@ sub hashref2where { return; } - if (ref($href) ne "HASH") { + if (ref($href) ne 'HASH') { &WARN("hashref2where: href is not HASH ref (href => $href)"); return; } @@ -466,7 +466,7 @@ sub hashref2where { sub hashref2update { my ($href) = @_; - if (ref($href) ne "HASH") { + if (ref($href) ne 'HASH') { &WARN("hashref2update: href is not HASH ref."); return; } @@ -492,7 +492,7 @@ sub hashref2update { sub hashref2array { my ($href) = @_; - if (ref($href) ne "HASH") { + if (ref($href) ne 'HASH') { &WARN("hashref2update: href is not HASH ref."); return; } @@ -520,7 +520,7 @@ sub hashref2array { # Usage: &countKeys($table, [$col]); sub countKeys { my ($table, $col) = @_; - $col ||= "*"; + $col ||= '*'; return (&sqlRawReturn("SELECT count($col) FROM $table"))[0]; } diff --git a/blootbot/src/logger.pl b/blootbot/src/logger.pl index 0eaf0a8..9f110e6 100644 --- a/blootbot/src/logger.pl +++ b/blootbot/src/logger.pl @@ -16,7 +16,7 @@ use vars qw(%param %file %cache); $logtime = time(); $logcount = 0; $logrepeat = 0; -$logold = ""; +$logold = ''; $param{VEBOSITY} ||= 1; # lame fix for preload @@ -73,7 +73,7 @@ sub cl { # logging support. sub openLog { - return unless (&IsParam("logfile")); + return unless (&IsParam('logfile')); $file{log} = $param{'logfile'}; my $error = 0; @@ -90,7 +90,7 @@ sub openLog { $error++; } - if (&IsParam("logType") and $param{'logType'} =~ /DAILY/i) { + if (&IsParam('logType') and $param{'logType'} =~ /DAILY/i) { my ($day,$month,$year) = (gmtime time())[3,4,5]; $logDate = sprintf("%04d%02d%02d",$year+1900,$month+1,$day); $file{log} .= $logDate; @@ -106,7 +106,7 @@ sub openLog { sub closeLog { # lame fix for paramlogfile. - return unless (&IsParam("logfile")); + return unless (&IsParam('logfile')); return unless (defined fileno LOG); close LOG; @@ -148,7 +148,7 @@ sub compress { } sub DEBUG { - return unless (&IsParam("DEBUG")); + return unless (&IsParam('DEBUG')); &status("${b_green}!DEBUG!$ob $_[0]"); } @@ -158,7 +158,7 @@ sub ERROR { } sub WARN { - return unless (&IsParam("WARN")); + return unless (&IsParam('WARN')); return if ($_[0] =~ /^PERL: Subroutine \S+ redefined at/); @@ -174,11 +174,11 @@ sub TODO { } sub VERB { - if (!&IsParam("VERBOSITY")) { + if (!&IsParam('VERBOSITY')) { # NOTHING. - } elsif ($param{'VERBOSITY'} eq "1" and $_[1] <= 1) { + } elsif ($param{'VERBOSITY'} eq '1' and $_[1] <= 1) { &status($_[0]); - } elsif ($param{'VERBOSITY'} eq "2" and $_[1] <= 2) { + } elsif ($param{'VERBOSITY'} eq '2' and $_[1] <= 2) { &status($_[0]); } } @@ -206,10 +206,10 @@ sub status { # if it's not a scalar, attempt to warn and fix. my $ref = ref $input; - if (defined $ref and $ref ne "") { + if (defined $ref and $ref ne '') { &WARN("status: 'input' is not scalar ($ref)."); - if ($ref eq "ARRAY") { + if ($ref eq 'ARRAY') { foreach (@$input) { &WARN("status: '$_'."); } @@ -277,12 +277,12 @@ sub status { $status = "[$statcount] ".$input; } - if (&IsParam("backlog")) { + if (&IsParam('backlog')) { push(@backlog, $status); # append to end. shift(@backlog) if (scalar @backlog > $param{'backlog'}); } - if (&IsParam("VERBOSITY")) { + if (&IsParam('VERBOSITY')) { if ($statcountfix) { printf $_red."!%6d!".$ob." ", $statcount; } else { @@ -337,19 +337,19 @@ sub status { } # log the line into a file. - return unless (&IsParam("logfile")); + return unless (&IsParam('logfile')); return unless (defined fileno LOG); # remove control characters from logging to LOGFILE. for ($input) { - last if (&IsParam("logColors")); + last if (&IsParam('logColors')); s/\e\[[0-9;]+m//g; # escape codes. s/[\cA-\c_]//g; # control chars. } $input = "FORK($$) ".$input if ($statcountfix); my $date; - if (&IsParam("logType") and $param{'logType'} =~ /DAILY/i) { + if (&IsParam('logType') and $param{'logType'} =~ /DAILY/i) { $date = sprintf("%02d:%02d.%02d", (gmtime $time)[2,1,0]); my ($day,$month,$year) = (gmtime $time)[3,4,5]; @@ -424,7 +424,7 @@ sub closeSQLDebug { } sub SQLDebug { - return unless (&IsParam("SQLDebug")); + return unless (&IsParam('SQLDebug')); return unless (fileno SQLDEBUG); diff --git a/blootbot/src/modules.pl b/blootbot/src/modules.pl index bcbd328..1da1e1e 100644 --- a/blootbot/src/modules.pl +++ b/blootbot/src/modules.pl @@ -44,7 +44,7 @@ sub loadCoreModules { } $moduleAge{$mod} = (stat $mod)[9]; - &showProc(" ($_)") if (&IsParam("DEBUG")); + &showProc(" ($_)") if (&IsParam('DEBUG')); } } @@ -71,7 +71,7 @@ sub loadDBModules { } sub loadFactoidsModules { - if (!&IsParam("factoids")) { + if (!&IsParam('factoids')) { &status("Factoid support DISABLED."); return; } @@ -88,7 +88,7 @@ sub loadFactoidsModules { } $moduleAge{$mod} = (stat $mod)[9]; - &showProc(" ($_)") if (&IsParam("DEBUG")); + &showProc(" ($_)") if (&IsParam('DEBUG')); } } @@ -115,7 +115,7 @@ sub loadIRCModules { # hrm... use another config option besides DEBUG to display # change in memory usage. - &status("Loading Modules \"$mod\"") if (!&IsParam("DEBUG")); + &status("Loading Modules \"$mod\"") if (!&IsParam('DEBUG')); eval "require \"$mod\""; if ($@) { &ERROR("require \"$mod\" => $@"); @@ -124,7 +124,7 @@ sub loadIRCModules { } $moduleAge{$mod} = (stat $mod)[9]; - &showProc(" ($_)") if (&IsParam("DEBUG")); + &showProc(" ($_)") if (&IsParam('DEBUG')); } } @@ -154,7 +154,7 @@ sub loadMyModulesNow { ### rename to moduleReloadAll? sub reloadAllModules { - my $retval = ""; + my $retval = ''; &VERB("Module: reloading all.",2); @@ -171,7 +171,7 @@ sub reloadAllModules { sub reloadModule { my ($mod) = @_; my $file = (grep /\/$mod/, keys %INC)[0]; - my $retval = ""; + my $retval = ''; # don't reload if it's not our module. if ($mod =~ /::/ or $mod !~ /pl$/) { -- 2.39.2