+ &performStrictReply("Joining $chan...");
+ &joinchan($chan);
+
+ return;
+ }
+
+ if ( !exists $chanconf{$chan} ) {
+ &performStrictReply("no such channel $chan");
+ return;
+ }
+
+ my $update = 0;
+
+ if ( defined $what and $what =~ s/^([+-])(\S+)/$2/ ) {
+ ### '.chanset +blah'
+ ### '.chanset +blah 10' -- error.
+
+ my $set = ( $1 eq '+' ) ? 1 : 0;
+ my $was = $chanconf{$chan}{$what};
+
+ if ($set) { # add/set.
+ if ( defined $was and $was eq '1' ) {
+ &performStrictReply("setting $what for $chan already 1.");
+ return;
+ }
+
+ $val = 1;
+
+ }
+ else { # delete/unset.
+ if ( !defined $was ) {
+ &performStrictReply("setting $what for $chan is not set.");
+ return;
+ }
+
+ $val = 0;
+ }
+
+ # alter for cosmetic (print out) reasons only.
+ $was = ( defined $was ) ? "; was '$was'" : '';
+
+ if ( $val eq '0' ) {
+ &performStrictReply("Unsetting $what for $chan$was.");
+ delete $chanconf{$chan}{$what};
+ delete $cache{ircTextCounters} if $what eq 'ircTextCounters';
+ }
+ else {
+ &performStrictReply("Setting $what for $chan to '$val'$was.");
+ $chanconf{$chan}{$what} = $val;
+ delete $cache{ircTextCounters} if $what eq 'ircTextCounters';
+ }
+
+ $update++;
+
+ }
+ 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;
+ 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};
+}