CVS: blootbot/src CommandStubs.pl,1.82,1.83 Process.pl,1.55,1.56 logger.pl,1.26,1.27 core.pl,1.71,1.
Brought to you by:
timriker
From: David <dm...@us...> - 2003-03-06 19:21:41
|
Update of /cvsroot/blootbot/blootbot/src In directory sc8-pr-cvs1:/tmp/cvs-serv18694 Modified Files: CommandStubs.pl Process.pl logger.pl core.pl Log Message: - nice patch from Phil Edwards <pm...@de...>. Thanks! - W3Search regex now doesn't catch "smile for me" for example. - allow +o users to have no restrictions on factoid searching. - updated comments for user flags. - join: check validity of channel name. - karma: update if statement and comment. - core: if channel contains regex, *boom*. fixed. - rename factoids: logic fixed. - irc: prevent perl warnings in flood check code. - norm: cosmetic clean up. - added config check ("logColors") to retain control characters in log files. - forgot to commit a fix for learn == HUNGRY. Index: CommandStubs.pl =================================================================== RCS file: /cvsroot/blootbot/blootbot/src/CommandStubs.pl,v retrieving revision 1.82 retrieving revision 1.83 diff -u -r1.82 -r1.83 --- CommandStubs.pl 18 Dec 2002 00:57:24 -0000 1.82 +++ CommandStubs.pl 6 Mar 2003 19:21:32 -0000 1.83 @@ -14,6 +14,7 @@ use vars qw($total $x $type $i $good); $babel_lang_regex = "fr|sp|es|po|pt|it|ge|de|gr|en|zh|ja|jp|ko|kr|ru"; +$w3search_regex = "google"; ### COMMAND HOOK IMPLEMENTATION. # addCmdHook("SECTION", 'TEXT_HOOK', @@ -294,7 +295,7 @@ } # google searching. Simon++ - if ($message =~ /^(?:search\s+)?(\S+)\s+for\s+['"]?(.*?)["']?\s*\?*$/i) { + if ($message =~ /^(?:search\s+)?($w3search_regex)\s+for\s+['"]?(.*?)["']?\s*\?*$/i) { return unless (&hasParam("wwwsearch")); &Forker("wwwsearch", sub { &W3Search::W3Search($1,$2); } ); @@ -431,8 +432,8 @@ $args =~ s/^["']|["']$//g; } - if (length $args == 1) { - &msg($who,"search string is too short."); + if (length $args < 2 && &IsFlag("o") ne "o") { + &msg($who, "search string is too short."); return; } Index: Process.pl =================================================================== RCS file: /cvsroot/blootbot/blootbot/src/Process.pl,v retrieving revision 1.55 retrieving revision 1.56 diff -u -r1.55 -r1.56 --- Process.pl 30 Jan 2003 23:47:35 -0000 1.55 +++ Process.pl 6 Mar 2003 19:21:34 -0000 1.56 @@ -24,7 +24,12 @@ return 'addressedother set' if ($addressedother); $talkok = ($param{'addressing'} =~ /^OPTIONAL$/i or $addressed); - $learnok = ($param{'learn'} =~ /^HUNGRY$/i or $addressed); + $learnok = 1 if ($addressed); + if ($param{'learn'} =~ /^HUNGRY$/i) { + $learnok = 1; + $addressed = 1; + $talkok = 1; + } &shmFlush(); # hack. @@ -70,6 +75,11 @@ return; } + if ($thischan !~ /^$mask{chan}$/) { + &msg($who, "$thischan is not a valid channel name."); + return; + } + if (&IsFlag("o") ne "o") { if (!exists $chanconf{$thischan}) { &msg($who, "I am not allowed to join $thischan."); @@ -77,8 +87,7 @@ } if (&validChan($thischan)) { - &msg($who,"warn: I'm already on $thischan, joining anyway..."); -# return; + &msg($who,"warn: I'm already on $thischan, joining anyway..."); } } $cache{join}{$thischan} = $who; # used for on_join self. @@ -290,18 +299,11 @@ ### # karma. set... - if ($message =~ /^(\S+)(--|\+\+)\s*$/ and $addressed) { - return '' unless (&hasParam("karma")); - # well... since it is policy to do bot functions before factoids - # karma gets hit if, for example, "g++" is issued. - # only way to request it is to put a question mark at the end. - - my($term,$inc) = (lc $1,$2); - - if ($msgType !~ /public/i) { - &msg($who, "karma must be done in public!"); - return; - } + if ($message =~ /^(\S+)(--|\+\+)\s*$/ && $addressed && + &hasParam("karma") && $msgType =~ /public/i + ) { + # to request factoids such as "g++" or "libstdc++", append "?" to the query. + my ($term,$inc) = (lc $1,$2); if (lc $term eq lc $who) { &msg($who, "please don't karma yourself"); Index: logger.pl =================================================================== RCS file: /cvsroot/blootbot/blootbot/src/logger.pl,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- logger.pl 22 Nov 2002 06:57:39 -0000 1.26 +++ logger.pl 6 Mar 2003 19:21:34 -0000 1.27 @@ -347,6 +347,7 @@ # remove control characters from logging to LOGFILE. for ($input) { + last if (&IsParam("logColors")); s/\e\[[0-9;]+m//g; # escape codes. s/[\cA-\c_]//g; # control chars. } Index: core.pl =================================================================== RCS file: /cvsroot/blootbot/blootbot/src/core.pl,v retrieving revision 1.71 retrieving revision 1.72 diff -u -r1.71 -r1.72 --- core.pl 23 Feb 2003 18:28:03 -0000 1.71 +++ core.pl 6 Mar 2003 19:21:34 -0000 1.72 @@ -301,7 +301,7 @@ $c ||= $chan; $c ||= "_default"; $c = "_default" if ($c eq "*"); # fix! - my @c = grep /^$c$/i, keys %chanconf; + my @c = grep /^\Q$c\E$/i, keys %chanconf; if (@c) { if (0 and $c[0] ne $c) { |