]> git.donarmstrong.com Git - infobot.git/blobdiff - src/DynaConfig.pl
major re-organisation of the different SQL files; cleanup and fixing of the postgres...
[infobot.git] / src / DynaConfig.pl
index bf18ed358bfae66c84ddbcdc08ee2724038d2360..f4ba9c3f207fd3d489a62a3672921fa5b480e471 100644 (file)
@@ -136,7 +136,7 @@ sub writeUserFile {
 
     my $time           = scalar(gmtime);
 
-    print OUT "#v1: \$" . "Id: blootbot -- $ident -- written $time \$\n\n";
+    print OUT "#v1: blootbot -- $ident -- written $time\n\n";
 
     ### USER LIST.
     my $cusers = 0;
@@ -226,7 +226,7 @@ sub writeUserFile {
     $wtime_userfile = time();
     &status("--- Saved USERFILE ($cusers users; $cbans bans; $cignore ignore) at $time");
     if (defined $msgType and $msgType =~ /^chat$/) {
-       &pSReply("--- Writing user file...");
+       &performStrictReply("--- Writing user file...");
     }
 }
 
@@ -271,12 +271,10 @@ sub readChanFile {
            $chanconf{$chan}{$1} = 1;
 
        } elsif (/^[\s\t]+\-(\S+)$/) {          # bool, false.
-           &DEBUG("deprecated support of negative options.") unless ($cache{negative});
            # although this is supported in run-time configuration.
-           $cache{negative} = 1;
-#          $chanconf{$chan}{$1} = 0;
+           $chanconf{$chan}{$1} = 0;
 
-       } elsif (/^[\s\t]+(\S+)[\ss\t]+(.*)$/) {# what = val.
+       } elsif (/^[\s\t]+(\S+)[\s\t]+(.*)$/) {# what = val.
            $chanconf{$chan}{$1} = $2;
 
        } else {
@@ -297,8 +295,6 @@ sub readChanFile {
        }
     }
 
-    delete $cache{negative};
-
     &status("CHANFILE: Loaded: ".(scalar(keys %chanconf)-1)." chans");
 }
 
@@ -314,7 +310,7 @@ sub writeChanFile {
     }
 
     my $time           = scalar(gmtime);
-    print OUT "#v1: \$" . "Id: blootbot -- $ident -- written $time \$\n\n";
+    print OUT "#v1: blootbot -- $ident -- written $time\n\n";
 
     if ($flag_quit) {
 
@@ -399,7 +395,7 @@ sub writeChanFile {
                " chans) at $time");
 
     if (defined $msgType and $msgType =~ /^chat$/) {
-       &pSReply("--- Writing chan file...");
+       &performStrictReply("--- Writing chan file...");
     }
 }
 
@@ -503,7 +499,7 @@ sub hasFlag {
        return 1;
     } else {
        &status("DCC CHAT: <$who> $message -- not enough flags.");
-       &pSReply("error: you do not have enough flags for that. ($flag required)");
+       &performStrictReply("error: you do not have enough flags for that. ($flag required)");
        return 0;
     }
 }
@@ -699,20 +695,20 @@ sub chanSet {
 
     if ($cmd eq "+chan") {
        if (exists $chanconf{$chan}) {
-           &pSReply("chan $chan already exists.");
+           &performStrictReply("chan $chan already exists.");
            return;
        }
        $chanconf{$chan}{_time_added}   = time();
        $chanconf{$chan}{autojoin}      = $conn->nick();
 
-       &pSReply("Joining $chan...");
+       &performStrictReply("Joining $chan...");
        &joinchan($chan);
 
        return;
     }
 
     if (!exists $chanconf{$chan}) {
-       &pSReply("no such channel $chan");
+       &performStrictReply("no such channel $chan");
        return;
     }
 
@@ -722,12 +718,12 @@ sub chanSet {
        ### ".chanset +blah"
        ### ".chanset +blah 10"         -- error.
 
-       my $state       = ($1 eq "+") ? 1 : 0;
+       my $set = ($1 eq "+") ? 1 : 0;
        my $was         = $chanconf{$chan}{$what};
 
-       if ($state) {                   # add/set.
+       if ($set) {                     # add/set.
            if (defined $was and $was eq "1") {
-               &pSReply("setting $what for $chan already 1.");
+               &performStrictReply("setting $what for $chan already 1.");
                return;
            }
 
@@ -735,12 +731,7 @@ sub chanSet {
 
        } else {                        # delete/unset.
            if (!defined $was) {
-               &pSReply("setting $what for $chan is not set.");
-               return;
-           }
-
-           if ($was eq "0") {
-               &pSReply("setting $what for $chan already 0.");
+               &performStrictReply("setting $what for $chan is not set.");
                return;
            }
 
@@ -748,13 +739,13 @@ sub chanSet {
        }
 
        # alter for cosmetic (print out) reasons only.
-       $was    = ($was) ? "; was '$was'" : "";
+       $was    = (defined $was) ? "; was '$was'" : "";
 
        if ($val eq "0") {
-           &pSReply("Unsetting $what for $chan$was.");
+           &performStrictReply("Unsetting $what for $chan$was.");
            delete $chanconf{$chan}{$what};
        } else {
-           &pSReply("Setting $what for $chan to '$val'$was.");
+           &performStrictReply("Setting $what for $chan to '$val'$was.");
            $chanconf{$chan}{$what}     = $val;
        }
 
@@ -765,11 +756,11 @@ sub chanSet {
 
        my $was = $chanconf{$chan}{$what};
        if (defined $was and $was eq $val) {
-           &pSReply("setting $what for $chan already '$val'.");
+           &performStrictReply("setting $what for $chan already '$val'.");
            return;
        }
        $was    = ($was) ? "; was '$was'" : "";
-       &pSReply("Setting $what for $chan to '$val'$was.");
+       &performStrictReply("Setting $what for $chan to '$val'$was.");
 
        $chanconf{$chan}{$what} = $val;
 
@@ -785,9 +776,9 @@ sub chanSet {
        }
 
        if (exists $chanconf{$chan}{$what}) {
-           &pSReply("$what for $chan is '$chanconf{$chan}{$what}'");
+           &performStrictReply("$what for $chan is '$chanconf{$chan}{$what}'");
        } else {
-           &pSReply("$what for $chan is not set.");
+           &performStrictReply("$what for $chan is not set.");
        }
     }
 
@@ -821,6 +812,11 @@ sub rehashConfVars {
            &loadMyModule('RootWarn');
            delete $cache{confvars}{$_};
        }
+
+       if (/^onjoin$/i and $i) {
+           &loadMyModule('OnJoin');
+           delete $cache{confvars}{$_};
+       }
     }
 
     &DEBUG("end of rehashConfVars");
@@ -828,16 +824,6 @@ sub rehashConfVars {
     delete $cache{confvars};
 }
 
-# registered flags... not used yet.
-my @regFlagsChan = (
-       "autojoin",
-       "limitcheckInterval",
-       "limitcheckPlus",
-       "allowConv",
-       "allowDNS",
-### TODO: finish off this list.
-);
-
 my @regFlagsUser = (
        # possible chars to include in FLAG
        "A",    # bot administration over /msg