X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=src%2FDynaConfig.pl;h=4e5153fb29e9d2a7968fa18503f0fe198ec70d56;hb=2c6eb8868eb5e0a36bedf9d2a491409c69baa8a0;hp=51496653bccbb3dc38c9967653306730a96f3cd5;hpb=a2b3be31bf664fe2cca6298b58e3c828a46a40f4;p=infobot.git diff --git a/src/DynaConfig.pl b/src/DynaConfig.pl index 5149665..4e5153f 100644 --- a/src/DynaConfig.pl +++ b/src/DynaConfig.pl @@ -32,7 +32,7 @@ sub readUserFile { my $s2 = -s "$f~"; if ($s2 > $s1*3) { - &DEBUG("rUF: backup file bigger than current file. FIXME"); + &FIXME("rUF: backup file bigger than current file."); } } @@ -160,6 +160,8 @@ sub writeUserFile { print OUT "--$what\t\t$_\n"; } + } elsif ($_ eq 'FLAGS') { + print OUT "--$_\t\t" . join('', sort split('', $val)) . "\n"; } else { print OUT "--$_\t\t$val\n"; } @@ -224,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..."); } } @@ -239,7 +241,7 @@ sub readChanFile { my $s2 = -s "$f~"; if ($s2 > $s1*3) { - &DEBUG("rCF: backup file bigger than current file. FIXME"); + &FIXME("rCF: backup file bigger than current file."); } } @@ -274,7 +276,7 @@ sub readChanFile { $cache{negative} = 1; # $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 { @@ -397,7 +399,7 @@ sub writeChanFile { " chans) at $time"); if (defined $msgType and $msgType =~ /^chat$/) { - &pSReply("--- Writing chan file..."); + &performStrictReply("--- Writing chan file..."); } } @@ -405,7 +407,8 @@ sub writeChanFile { ##### USER COMMANDS. ##### -# todo: support multiple flags. +# TODO: support multiple flags. +# TODO: return all flags for opers sub IsFlag { my $flags = shift; my ($ret, $f, $o) = ""; @@ -500,11 +503,12 @@ 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; } } +# expire is time in minutes sub ignoreAdd { my($mask,$chan,$expire,$comment) = @_; @@ -524,7 +528,7 @@ sub ignoreAdd { $ignore{$chan}{$mask} = [$expire, time(), $who, $comment]; - # todo: improve this. + # TODO: improve this. if ($expire == 0) { &status("ignore: Added $mask for $chan to NEVER expire, by $who, for $comment"); } else { @@ -695,20 +699,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} = 1; + $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; } @@ -723,7 +727,7 @@ sub chanSet { if ($state) { # add/set. if (defined $was and $was eq "1") { - &pSReply("setting $what for $chan already 1."); + &performStrictReply("setting $what for $chan already 1."); return; } @@ -731,12 +735,12 @@ sub chanSet { } else { # delete/unset. if (!defined $was) { - &pSReply("setting $what for $chan is not set."); + &performStrictReply("setting $what for $chan is not set."); return; } if ($was eq "0") { - &pSReply("setting $what for $chan already 0."); + &performStrictReply("setting $what for $chan already 0."); return; } @@ -747,10 +751,10 @@ sub chanSet { $was = ($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; } @@ -761,11 +765,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; @@ -781,9 +785,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."); } } @@ -804,17 +808,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}{$_}; } } @@ -824,25 +828,21 @@ sub rehashConfVars { delete $cache{confvars}; } -# registered flags... not used yet. -my @regFlagsChan = ( - "autojoin", - "limitcheckInterval", - "limitcheckPlus", - "allowConv", - "allowDNS", -### TODO: finish off this list. -); - my @regFlagsUser = ( - "m", # modify factoid. - "r", # remove factoid. - "t", # teach/add factoid. - "a", # ask/request factoid. - "n", # bot owner - "o", # master of bot (automatic +amrt) - "O", # dynamic ops (as on channel). (automatic +o) - "A", # bot administration over /msg (def: DCC CHAT) + # possible chars to include in FLAG + "A", # bot administration over /msg + # default is only via DCC CHAT + "O", # dynamic ops (as on channel). (automatic +o) + "T", # add topics. + "a", # ask/request factoid. + "m", # modify factoid. (includes renaming) + "n", # bot owner, can "reload" + "o", # master of bot (automatic +amrt) + # can search on factoid strings shorter than 2 chars + # can tell bot to join new channels + # can [un]lock factoids + "r", # remove factoid. + "t", # teach/add factoid. ); 1;