From 9514f09ee10a2cd694755466c813994e09ec3a40 Mon Sep 17 00:00:00 2001 From: dms Date: Sat, 26 May 2001 13:34:15 +0000 Subject: [PATCH] - fixed dns lookup - fixed "tell blah about literal x" - getChanConf() overwrote $chan - fixed. git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@497 c11ca15a-4712-0410-83d8-924469b57eb5 --- src/Factoids/Question.pl | 5 +++++ src/IRC/Schedulers.pl | 2 +- src/Modules/RootWarn.pl | 6 +++--- src/Process.pl | 5 ----- src/UserExtra.pl | 9 +++++---- src/core.pl | 15 +++++++++++---- src/db_mysql.pl | 5 +++++ 7 files changed, 30 insertions(+), 17 deletions(-) diff --git a/src/Factoids/Question.pl b/src/Factoids/Question.pl index eab0d5f..0abb9bb 100644 --- a/src/Factoids/Question.pl +++ b/src/Factoids/Question.pl @@ -45,6 +45,11 @@ sub doQuestion { return if (exists $bots{$nuh}); } + if ($query =~ s/^literal\s+//i) { + &status("literal ask of '$query'."); + $literal = 1; + } + # convert to canonical reference form my $x; my @query; diff --git a/src/IRC/Schedulers.pl b/src/IRC/Schedulers.pl index eee0c59..9b91507 100644 --- a/src/IRC/Schedulers.pl +++ b/src/IRC/Schedulers.pl @@ -1078,7 +1078,7 @@ sub factoidCheck { my $fix = $_; $fix =~ s/ #DEL#$//g; my $agestr = &Time2String($time - $age); - &DEBUG("safedel: Removing '$_' for good. [$agestr old]"); + &status("safedel: Removing '$_' for good. [$agestr old]"); &delFactoid($_); } diff --git a/src/Modules/RootWarn.pl b/src/Modules/RootWarn.pl index 185130f..05e9d3f 100644 --- a/src/Modules/RootWarn.pl +++ b/src/Modules/RootWarn.pl @@ -13,11 +13,11 @@ sub rootWarn { my $warnmode = &getChanConf("rootWarnMode"); if ($attempt == 0) { # first timer. - if ($warnmode =~ /aggressive/i) { - &status(">>> Detected root user; notifying nick and channel."); + if (defined $warnmode and $warnmode =~ /aggressive/i) { + &status("rootwarn: Detected root user; notifying nick and channel."); rawout("PRIVMSG $chan :R".("O" x int(rand 80 + 2))."T has landed!"); } else { - &status(">>> Detected root user; notifying user"); + &status("rootwarn: Detected root user; notifying user"); } if ($_ = &getFactoid("root")) { diff --git a/src/Process.pl b/src/Process.pl index 925ae96..4988e67 100644 --- a/src/Process.pl +++ b/src/Process.pl @@ -271,11 +271,6 @@ sub process { ### bot commands... ### - if ($message =~ s/^literal\s+//i) { - &status("literal ask of '$message'."); - $literal = 1; - } - # karma. set... if ($message =~ /^(\S+)(--|\+\+)\s*$/ and $addressed) { return '' unless (&hasParam("karma")); diff --git a/src/UserExtra.pl b/src/UserExtra.pl index 2467660..b48158c 100644 --- a/src/UserExtra.pl +++ b/src/UserExtra.pl @@ -356,7 +356,7 @@ sub tell { $message = $tell_obj; $done++ unless (&Modules()); - &VERB("teel: setting old values of who and msgType.",2); + &VERB("tell: setting old values of who and msgType.",2); $who = $oldwho; $msgType = $oldmtype; @@ -390,6 +390,7 @@ sub DNS { my $dns = shift; my($match, $x, $y, $result); my $pid; + $dns =~ s/^\s+|\s+$//g; if ($dns =~ /(\d+\.\d+\.\d+\.\d+)/) { &status("DNS query by IP address: $in"); @@ -406,11 +407,11 @@ sub DNS { } else { - &status("DNS query by name: $in"); - $x = join('.',unpack('C4',(gethostbyname($in))[4])); + &status("DNS query by name: $dns"); + $x = join('.',unpack('C4',(gethostbyname($dns))[4])); if ($x !~ /^\s*$/) { - $result = $in." is ".$x; + $result = $dns." is ".$x; } else { $result = "I can\'t find that machine name"; } diff --git a/src/core.pl b/src/core.pl index 87ebb64..36e8c76 100644 --- a/src/core.pl +++ b/src/core.pl @@ -268,23 +268,30 @@ sub IsChanConf { # About: Retrieve value for 'param' value in current/default chan. # Return: scalar for success, undef for failure. sub getChanConf { - my($param,$chan) = @_; + my($param,$c) = @_; if (!defined $param) { &WARN("param == NULL."); return 0; } - $chan ||= "_default"; - my @c = grep /^$chan$/i, keys %chanconf; + # this looks evil... + if (0 and !defined $chan) { + &DEBUG("gCC: ok !chan... doing _default instead."); + } + + $c ||= $chan; + $c ||= "_default"; + my @c = grep /^$c$/i, keys %chanconf; if (@c) { - if ($c[0] ne $chan) { + if (0 and $c[0] ne $c) { &WARN("c ne chan ($c[0] ne $chan)"); } return $chanconf{$c[0]}{$param}; } +# &DEBUG("gCC: returning _default... "); return $chanconf{"_default"}{$param}; } diff --git a/src/db_mysql.pl b/src/db_mysql.pl index 38b1229..4c31e5a 100644 --- a/src/db_mysql.pl +++ b/src/db_mysql.pl @@ -234,6 +234,11 @@ sub dbReplace { } } + if (0) { + &DEBUG("REPLACE INTO $table (".join(',',@keys). + ") VALUES (". join(',',@vals). ")" ); + } + &dbRaw("Replace($table)", "REPLACE INTO $table (".join(',',@keys). ") VALUES (". join(',',@vals). ")" ); -- 2.39.5