From f5fc4b293ece975252f82b4d8dafd2715fd9de45 Mon Sep 17 00:00:00 2001 From: timriker Date: Fri, 18 Feb 2005 03:32:04 +0000 Subject: [PATCH] s/hasParam/IsChanConfOrWarn/ git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1140 c11ca15a-4712-0410-83d8-924469b57eb5 --- scripts/findparam.pl | 6 +++--- src/CommandStubs.pl | 14 +++++++------- src/Misc.pl | 4 ++-- src/Modules/UserDCC.pl | 2 +- src/Process.pl | 2 +- src/UserExtra.pl | 6 +++--- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/scripts/findparam.pl b/scripts/findparam.pl index d079e20..077cac5 100644 --- a/scripts/findparam.pl +++ b/scripts/findparam.pl @@ -19,8 +19,8 @@ foreach (`find -name "*.pl"`) { next; } - if (/hasParam\(['"](\S+?)['"]\)/) { - print "File: $file: hasParam: $1\n" if $debug; + if (/IsChanConfOrWarn\(['"](\S+?)['"]\)/) { + print "File: $file: IsChanConfOrWarn: $1\n" if $debug; $param{$1}++; next; } @@ -43,7 +43,7 @@ foreach (`find -name "*.pl"`) { next; } - # command hooks => hasParam => both. + # command hooks => IsChanConfOrWarn => both. # note: this does not support multiple lines. if (/\'Identifier\'[\s\t]=>[\s\t]+\'(\S+?)\'/) { print "File: $file: command hook: $1\n" if $debug; diff --git a/src/CommandStubs.pl b/src/CommandStubs.pl index 054d02f..eb8e7df 100644 --- a/src/CommandStubs.pl +++ b/src/CommandStubs.pl @@ -104,7 +104,7 @@ sub parseCmdHook { ### IDENTIFIER. if (exists $hash{'Identifier'}) { - return 1 unless (&hasParam($hash{'Identifier'})); + return 1 unless (&IsChanConfOrWarn($hash{'Identifier'})); } ### USER FLAGS. @@ -298,7 +298,7 @@ sub Modules { $debiancmd .= '|recommends?|suggests?|maint|maintainer'; if ($message =~ /^($debiancmd)(\s+(.*))?$/i) { - return unless (&hasParam('Debian')); + return unless (&IsChanConfOrWarn('Debian')); my $package = lc $3; if (defined $package) { @@ -312,7 +312,7 @@ sub Modules { # google searching. Simon++ if ($message =~ /^(?:search\s+)?($w3search_regex)\s+(?:for\s+)?['"]?(.*?)["']?\s*\?*$/i) { - return unless (&hasParam('W3Search')); + return unless (&IsChanConfOrWarn('W3Search')); &Forker('W3Search', sub { &W3Search::W3Search($1,$2); } ); @@ -329,7 +329,7 @@ sub Modules { # list{keys|values}. xk++. Idea taken from #linuxwarez@EFNET if ($message =~ /^list(\S+)(\s+(.*))?$/i) { - return unless (&hasParam('Search')); + return unless (&IsChanConfOrWarn('Search')); my $thiscmd = lc $1; my $args = $3 || ""; @@ -362,7 +362,7 @@ sub Modules { # Nickometer. Adam Spiers++ if ($message =~ /^(?:lame|nick)ometer(?: for)? (\S+)/i) { - return unless (&hasParam("nickometer")); + return unless (&IsChanConfOrWarn("nickometer")); my $term = (lc $1 eq 'me') ? $who : $1; @@ -425,7 +425,7 @@ sub Modules { # Topic management. xk++ # may want to add a userflags for topic. -xk if ($message =~ /^topic(\s+(.*))?$/i) { - return unless (&hasParam('Topic')); + return unless (&IsChanConfOrWarn('Topic')); my $chan = $talkchannel; my @args = split / /, $2 || ""; @@ -472,7 +472,7 @@ sub Modules { # wingate. if ($message =~ /^wingate$/i) { - return unless (&hasParam('Wingate')); + return unless (&IsChanConfOrWarn('Wingate')); my $reply = "Wingate statistics: scanned \002" .scalar(keys %wingate)."\002 hosts"; diff --git a/src/Misc.pl b/src/Misc.pl index 30222f4..df95bc9 100644 --- a/src/Misc.pl +++ b/src/Misc.pl @@ -585,10 +585,10 @@ sub hasProfanity { return $profanity; } -sub hasParam { +sub IsChanConfOrWarn { my ($param) = @_; - if (&IsChanConf($param) or &IsParam($param)) { + if (&IsChanConf($param)) { return 1; } else { ### TODO: specific reason why it failed. diff --git a/src/Modules/UserDCC.pl b/src/Modules/UserDCC.pl index cec6291..da76b6e 100644 --- a/src/Modules/UserDCC.pl +++ b/src/Modules/UserDCC.pl @@ -105,7 +105,7 @@ sub userDCC { # backlog. if ($message =~ /^backlog(\s+(.*))?$/i) { return unless (&hasFlag("o")); - return unless (&hasParam("backlog")); + return unless (&IsChanConfOrWarn("backlog")); my $num = $2; my $max = $param{'backlog'}; diff --git a/src/Process.pl b/src/Process.pl index 84387ec..33c1d37 100644 --- a/src/Process.pl +++ b/src/Process.pl @@ -298,7 +298,7 @@ sub process { # karma. set... if ($msgType =~ /public/i && $message =~ /^(\S+)(--|\+\+)\s*$/ && - $addressed && &hasParam("karma") + $addressed && &IsChanConfOrWarn("karma") ) { # to request factoids such as "g++" or "libstdc++", append "?" to the query. my ($term,$inc) = (lc $1,$2); diff --git a/src/UserExtra.pl b/src/UserExtra.pl index 8253b89..aa72c52 100644 --- a/src/UserExtra.pl +++ b/src/UserExtra.pl @@ -410,7 +410,7 @@ sub userCommands { # conversion: ascii. if ($message =~ /^(asci*|chr) (\d+)$/) { &DEBUG("ascii/chr called ..."); - return unless (&hasParam("allowConv")); + return unless (&IsChanConfOrWarn("allowConv")); &DEBUG("ascii/chr called"); @@ -425,7 +425,7 @@ sub userCommands { # conversion: ord. if ($message =~ /^ord(\s+(.*))$/) { - return unless (&hasParam("allowConv")); + return unless (&IsChanConfOrWarn("allowConv")); $arg = $2; @@ -449,7 +449,7 @@ sub userCommands { # hex. if ($message =~ /^hex(\s+(.*))?$/i) { - return unless (&hasParam("allowConv")); + return unless (&IsChanConfOrWarn("allowConv")); my $arg = $2; if (!defined $arg) { -- 2.39.2