]> git.donarmstrong.com Git - infobot.git/blobdiff - src/CommandStubs.pl
old
[infobot.git] / src / CommandStubs.pl
index b007d36c6093c93b73e50d70dafdd5390f436cda..eb8e7df4adcbe0395d27f16a947c53ae5817fc27 100644 (file)
@@ -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.
@@ -280,6 +280,9 @@ sub parseCmdHook {
 &addCmdHook("extra", '[ia]?spell', ('CODEREF' => 'spell::query',
        'Identifier' => 'spell', 'Cmdstats' => 'spell',
        'Forker' => 1, 'Help' => 'spell') );
+&addCmdHook("extra", 'dns|d?nslookup|host', ('CODEREF' => 'dns::query',
+       'Identifier' => 'dns', 'Cmdstats' => 'dns',
+       'Forker' => 1, 'Help' => 'dns') );
 ###
 ### END OF ADDING HOOKS.
 ###
@@ -295,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) {
@@ -309,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); } );
 
@@ -326,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 || "";
@@ -359,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;
 
@@ -394,7 +397,7 @@ sub Modules {
                push(@list, "$str ($_%)");
            }
 
-           &pSReply( &formListReply(0, "Nickometer list for $term ", @list) );
+           &performStrictReply( &formListReply(0, "Nickometer list for $term ", @list) );
            &DEBUG("test.");
 
            return;
@@ -422,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 || "";
@@ -469,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";
@@ -479,7 +482,7 @@ sub Modules {
            $reply .= ".  Started the scan ".&Time2String(time() - $wingaterun)." ago";
        }
 
-       &pSReply("$reply.");
+       &performStrictReply("$reply.");
 
        return;
     }
@@ -568,7 +571,7 @@ sub seen {
                 "saying\002:\002 '$seen[4]'.";
     }
 
-    &pSReply($reply);
+    &performStrictReply($reply);
     return;
 }
 
@@ -652,7 +655,7 @@ sub convert {
 
 sub lart {
     my ($target) = &fixString($_[0]);
-    my $extra  = 0;
+    my $extra  = 0;
     my $chan   = $talkchannel;
     my ($for);
 
@@ -725,7 +728,7 @@ sub DebianNew {
     }
     close IDX1;
 
-    &::pSReply( &::formListReply(0, "New debian packages:", @new) );
+    &::performStrictReply( &::formListReply(0, "New debian packages:", @new) );
 }
 
 sub do_verstats {
@@ -802,7 +805,7 @@ sub do_verstats {
 
        # hack. this is one major downside to scheduling.
        $chan = $c;
-       &pSReply( &formListReply(0, "IRC Client versions for $c ", @list) );
+       &performStrictReply( &formListReply(0, "IRC Client versions for $c ", @list) );
 
        # clean up not-needed data structures.
        undef %ver;
@@ -888,9 +891,9 @@ sub do_text_counters {
        }
 
        if (defined $sum) {
-           &pSReply("total count of \037$type\037 on \002$c\002: $sum$topstr");
+           &performStrictReply("total count of \037$type\037 on \002$c\002: $sum$topstr");
        } else {
-           &pSReply("zero counter for \037$type\037.");
+           &performStrictReply("zero counter for \037$type\037.");
        }
     } else {
        # TODO: convert $where to hash and use a sqlSelect
@@ -898,7 +901,7 @@ sub do_text_counters {
                        " WHERE $where AND nick=".&sqlQuote($arg) ))[0];
 
        if (!defined $x) {      # !defined.
-           &pSReply("$arg has not said $type yet.");
+           &performStrictReply("$arg has not said $type yet.");
            return 1;
        }
 
@@ -924,7 +927,7 @@ sub do_text_counters {
        }
 
        my $pct1 = sprintf("%.01f", 100*$x/$sum);
-       &pSReply("\002$arg\002 has said \037$type\037 \002$x\002 times (\002$pct1\002 %)$xtra");
+       &performStrictReply("\002$arg\002 has said \037$type\037 \002$x\002 times (\002$pct1\002 %)$xtra");
     }
 
     return 1;
@@ -969,9 +972,9 @@ sub textstats_main {
        }
 
        if (defined $sum) {
-           &pSReply("total count of \037$type\037 on \002$c\002: $sum$topstr");
+           &performStrictReply("total count of \037$type\037 on \002$c\002: $sum$topstr");
        } else {
-           &pSReply("zero counter for \037$type\037.");
+           &performStrictReply("zero counter for \037$type\037.");
        }
 
        return;
@@ -1010,7 +1013,7 @@ sub textstats_main {
 #    return;
 
     if (!defined $x) { # !defined.
-       &pSReply("$arg has not said $type yet.");
+       &performStrictReply("$arg has not said $type yet.");
        return;
     }
 
@@ -1021,7 +1024,7 @@ sub textstats_main {
     }
 
     my $pct1 = sprintf("%.01f", 100*$x/$sum);
-    &pSReply("\002$arg\002 has said \037$type\037 \002$x\002 times (\002$pct1\002 %)$xtra");
+    &performStrictReply("\002$arg\002 has said \037$type\037 \002$x\002 times (\002$pct1\002 %)$xtra");
 }
 
 sub nullski {