From 27cb2609b06671cb801705c7951ca7e15772ea40 Mon Sep 17 00:00:00 2001 From: timriker Date: Tue, 23 Nov 2004 04:55:09 +0000 Subject: [PATCH] root[wW]arn -> RootWarn git-svn-id: https://svn.code.sf.net/p/infobot/code/trunk/blootbot@1062 c11ca15a-4712-0410-83d8-924469b57eb5 --- files/sample/blootbot.chan | 6 ++++-- files/sample/blootbot.config | 2 +- src/CommandStubs.pl | 4 ++-- src/DynaConfig.pl | 6 +++--- src/IRC/IrcHooks.pl | 2 +- src/Modules/RootWarn.pl | 30 +++++++++++++++--------------- src/modules.pl | 8 +++----- 7 files changed, 29 insertions(+), 29 deletions(-) diff --git a/files/sample/blootbot.chan b/files/sample/blootbot.chan index caac647..065d7a1 100644 --- a/files/sample/blootbot.chan +++ b/files/sample/blootbot.chan @@ -1,10 +1,13 @@ -#v1: blootbot -- infobot -- written Tue Nov 23 04:38:38 2004 +#v1: blootbot -- infobot -- written Tue Nov 23 04:45:45 2004 #botpark + +RootWarn +autojoin + rootWarnMode aggressive #debian-bots +News + +RootWarn factoidDeleteDelay 7 ircTextCounters heh hah :) ? hi lol +joinfloodCheck @@ -51,7 +54,6 @@ _default +page randomFactoidInterval 60 randomQuoteInterval 60 - +rootWarn +search +seen seenFlushInterval 60 diff --git a/files/sample/blootbot.config b/files/sample/blootbot.config index 8646df5..6784113 100644 --- a/files/sample/blootbot.config +++ b/files/sample/blootbot.config @@ -232,7 +232,7 @@ set randomQuote true set randomFactoid true # [0/1] Warn users about root. -set rootWarn false +set RootWarn false # passive -- be polite plus stuff, compliant to OPN, heh. # aggressive -- ... set rootWarnMode passive diff --git a/src/CommandStubs.pl b/src/CommandStubs.pl index 77870bf..c9ca19e 100644 --- a/src/CommandStubs.pl +++ b/src/CommandStubs.pl @@ -207,8 +207,8 @@ sub parseCmdHook { &addCmdHook("extra", 'u(ser)?info', ('CODEREF' => 'userinfo', 'Identifier' => 'userinfo', 'Help' => 'userinfo', 'Module' => 'userinfo') ); -&addCmdHook("extra", 'rootWarn', ('CODEREF' => 'CmdrootWarn', - 'Identifier' => 'rootWarn', 'Module' => 'rootwarn') ); +&addCmdHook("extra", 'RootWarn', ('CODEREF' => 'CmdrootWarn', + 'Identifier' => 'RootWarn', 'Module' => 'RootWarn') ); &addCmdHook("extra", 'seen', ('CODEREF' => 'seen', 'Identifier' => 'seen') ); &addCmdHook("extra", 'Dict', ('CODEREF' => 'Dict::Dict', diff --git a/src/DynaConfig.pl b/src/DynaConfig.pl index 19c7cbd..dc710d4 100644 --- a/src/DynaConfig.pl +++ b/src/DynaConfig.pl @@ -806,17 +806,17 @@ sub rehashConfVars { &DEBUG("rehashConfVars: _ => $_"); if (/^news$/ and $i) { - &loadMyModule("news"); + &loadMyModule('News'); delete $cache{confvars}{$_}; } if (/^uptime$/ and $i) { - &loadMyModule("uptime"); + &loadMyModule('uptime'); delete $cache{confvars}{$_}; } if (/^rootwarn$/i and $i) { - &loadMyModule($_); + &loadMyModule('RootWarn'); delete $cache{confvars}{$_}; } } diff --git a/src/IRC/IrcHooks.pl b/src/IRC/IrcHooks.pl index d841df6..3ed802c 100644 --- a/src/IRC/IrcHooks.pl +++ b/src/IRC/IrcHooks.pl @@ -572,7 +572,7 @@ sub on_join { ### ROOTWARN: &rootWarn($who,$user,$host,$chan) if ( - &IsChanConf("rootWarn") && + &IsChanConf('RootWarn') && $user =~ /^~?r(oo|ew|00)t$/i ); diff --git a/src/Modules/RootWarn.pl b/src/Modules/RootWarn.pl index ae44676..fc30550 100644 --- a/src/Modules/RootWarn.pl +++ b/src/Modules/RootWarn.pl @@ -13,29 +13,29 @@ use vars qw($dbh $found $ident); sub rootWarn { my ($nick,$user,$host,$chan) = @_; my $n = lc $nick; - my $attempt = &sqlSelect("rootwarn", "attempt", { nick => $n } ) || 0; - my $warnmode = &getChanConf("rootWarnMode"); + my $attempt = &sqlSelect('rootwarn', 'attempt', { nick => $n } ) || 0; + my $warnmode = &getChanConf('rootWarnMode'); if ($attempt == 0) { # first timer. if (defined $warnmode and $warnmode =~ /quiet/i) { - &status("rootwarn: Detected root user; notifying user"); + &status('RootWarn: Detected root user; notifying user'); } else { - &status("rootwarn: Detected root user; notifying nick and channel."); + &status('RootWarn: Detected root user; notifying nick and channel.'); &msg($chan, "ROO".("O" x int(rand 8))."T has landed!"); } - if ($_ = &getFactoid("root")) { - &msg($nick, "rootwarn: $attempt : $_"); + if ($_ = &getFactoid('root')) { + &msg($nick, "RootWarn: $attempt : $_"); } else { - &status("root needs to be defined in database."); + &status('"root" needs to be defined in database.'); } } elsif ($attempt < 2) { # 2nd/3rd time occurrance. - if ($_ = &getFactoid("root again")) { + if ($_ = &getFactoid('root again')) { &status("RootWarn: not first time root user; msg'ing $nick."); - &msg($nick, "rootwarn: $attempt : $_"); + &msg($nick, "RootWarn: $attempt : $_"); } else { - &status("root again needs to be defined in database."); + &status('"root again" needs to be defined in database.'); } } else { # >3rd time occurrance. @@ -44,11 +44,11 @@ sub rootWarn { if ($channels{$chan}{'o'}{$ident}) { &status("RootWarn: $nick... sigh... bye bye."); rawout("MODE $chan +b *!root\@$host"); # ban - &kick($chan,$nick,"bye bye"); + &kick($chan,$nick,'bye bye'); } - } elsif ($_ = &getFactoid("root again")) { + } elsif ($_ = &getFactoid('root again')) { &status("RootWarn: $attempt times; msg'ing $nick."); - &msg($nick, "rootwarn: $attempt : $_"); + &msg($nick, "RootWarn: $attempt : $_"); } else { &status("root again needs to be defined in database."); } @@ -59,7 +59,7 @@ sub rootWarn { # ok... don't record the attempt if nick==root. return if ($nick eq "root"); - &sqlSet("rootwarn", { nick => lc($nick) }, { + &sqlSet('rootwarn', { nick => lc($nick) }, { attempt => $attempt, time => time(), host => $user."\@".$host, @@ -73,7 +73,7 @@ sub rootWarn { # TODO: support arguments to get info on a particular nick? sub CmdrootWarn { my $reply; - my $count = &countKeys("rootwarn"); + my $count = &countKeys('rootwarn'); if ($count == 0) { &performReply("no-one has been warned about root, woohoo"); diff --git a/src/modules.pl b/src/modules.pl index 263bd43..9429dfd 100644 --- a/src/modules.pl +++ b/src/modules.pl @@ -42,7 +42,7 @@ if ($@) { "Math" => "Math.pl", "Plug" => "Plug.pl", "Quote" => "Quote.pl", - "rootwarn" => "RootWarn.pl", + "RootWarn" => "RootWarn.pl", "rss" => "Rss.pl", "search" => "Search.pl", "slashdot" => "Slashdot3.pl", @@ -64,7 +64,7 @@ if ($@) { my @myModulesLoadNow; my @myModulesReloadNot; BEGIN { - @myModulesLoadNow = ('topic', 'uptime', 'News', 'rootWarn', 'symdump', 'botmail'); + @myModulesLoadNow = ('topic', 'uptime', 'News', 'RootWarn', 'symdump', 'botmail'); @myModulesReloadNot = ('IRC/Irc.pl','IRC/Schedulers.pl'); } @@ -190,9 +190,7 @@ sub loadMyModulesNow { next; } - # weird hack to get rootwarn to work. - # it may break on other cases though, any ideas? - &loadMyModule( $myModules{$_} || $myModules{lc $_} ); + &loadMyModule($myModules{$_}); $loaded++; } -- 2.39.2