- my ($nick,$user,$host,$chan) = @_;
- my $n = lc $nick;
- my $attempt = &dbGet("rootwarn", "attempt", "nick=".&dbQuote($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");
- } else {
- &status("rootwarn: Detected root user; notifying nick and channel.");
- rawout("PRIVMSG $chan :ROO".("O" x int(rand 68))."T has landed!");
- }
-
- if ($_ = &getFactoid("root")) {
- &msg($nick, "root is $_");
- } else {
- &status("root needs to be defined in database.");
- }
-
- } elsif ($attempt < 2) { # 2nd/3rd time occurrance.
- &status("RootWarn: not first time root user; msg'ing $nick.");
- if ($_ = &getFactoid("root again")) {
- &msg($nick, $_);
- } else {
- &status("root again needs to be defined in database.");
- }
-
- } else { # >3rd time occurrance.
-
- # disable this for the time being.
- if (0 and $warnmode =~ /aggressive/i) {
- if ($channels{$chan}{'o'}{$ident}) {
- &status("RootWarn: $nick... sigh... bye bye.");
- rawout("MODE $chan +b *!root\@$host"); # ban
- &kick($chan,$nick,"bye bye");
- }
- }
+ my ( $nick, $user, $host, $chan ) = @_;
+ my $n = lc $nick;
+ 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');
+ }
+ else {
+ &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 : $_" );
+ }
+ else {
+ &status('"root" needs to be defined in database.');
+ }
+
+ }
+ elsif ( $attempt < 2 ) { # 2nd/3rd time occurrance.
+ if ( $_ = &getFactoid('root again') ) {
+ &status("RootWarn: not first time root user; msg'ing $nick.");
+ &msg( $nick, "RootWarn: $attempt : $_" );
+ }
+ else {
+ &status('"root again" needs to be defined in database.');
+ }
+
+ }
+ else { # >3rd time occurrance.
+ # disable this for the time being.
+ if ( 0 and $warnmode =~ /aggressive/i ) {
+ if ( $channels{$chan}{'o'}{$ident} ) {
+ &status("RootWarn: $nick... sigh... bye bye.");
+ rawout("MODE $chan +b *!root\@$host"); # ban
+ &kick( $chan, $nick, 'bye bye' );
+ }
+ }
+ elsif ( $_ = &getFactoid('root again') ) {
+ &status("RootWarn: $attempt times; msg'ing $nick.");
+ &msg( $nick, "RootWarn: $attempt : $_" );
+ }
+ else {
+ &status("root again needs to be defined in database.");
+ }