+ } elsif (defined $val) {
+ ### ".chanset blah testing"
+
+ my $was = $chanconf{$chan}{$what};
+ if (defined $was and $was eq $val) {
+ &performStrictReply("setting $what for $chan already '$val'.");
+ return;
+ }
+ $was = ($was) ? "; was '$was'" : "";
+ &performStrictReply("Setting $what for $chan to '$val'$was.");
+
+ $chanconf{$chan}{$what} = $val;
+
+ $update++;
+
+ } else { # read only.
+ ### ".chanset"
+ ### ".chanset blah"
+
+ if (!defined $what) {
+ &WARN("chanset/DC: what == undefine.");
+ return;
+ }
+
+ if (exists $chanconf{$chan}{$what}) {
+ &performStrictReply("$what for $chan is '$chanconf{$chan}{$what}'");
+ } else {
+ &performStrictReply("$what for $chan is not set.");
+ }
+ }
+
+ if ($update) {
+ $utime_chanfile = time();
+ $ucount_chanfile++;
+ }
+
+ return;
+}
+
+sub rehashConfVars {
+ # this is an attempt to fix where an option is enabled but the module
+ # has been not loaded. it also can be used for other things.
+
+ foreach (keys %{ $cache{confvars} }) {
+ my $i = $cache{confvars}{$_};
+ &DEBUG("rehashConfVars: _ => $_");
+
+ if (/^news$/ and $i) {
+ &loadMyModule('News');
+ delete $cache{confvars}{$_};
+ }
+
+ if (/^uptime$/ and $i) {
+ &loadMyModule('Uptime');
+ delete $cache{confvars}{$_};
+ }
+
+ if (/^rootwarn$/i and $i) {
+ &loadMyModule('RootWarn');
+ delete $cache{confvars}{$_};
+ }
+
+ if (/^onjoin$/i and $i) {
+ &loadMyModule('OnJoin');
+ delete $cache{confvars}{$_};
+ }
+ }
+
+ &DEBUG("end of rehashConfVars");
+
+ delete $cache{confvars};
+}
+
+my @regFlagsUser = (
+ # 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.
+);