+ 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;
+ delete $cache{ircTextCounters} if $what eq 'ircTextCounters';
+
+ $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};
+}