+ my ( $param, $c ) = @_;
+
+ if ( !defined $param ) {
+ &WARN('gCC: param == NULL.');
+ return 0;
+ }
+
+ # this looks evil...
+ if ( 0 and !defined $chan ) {
+ &DEBUG('gCC: ok !chan... doing _default instead.');
+ }
+
+ $c ||= $chan;
+ $c ||= '_default';
+ $c = '_default' if ( $c eq '*' ); # FIXME
+ my @c = grep /^\Q$c\E$/i, keys %chanconf;
+
+ if (@c) {
+ if ( 0 and $c[0] ne $c ) {
+ &WARN("c ne chan ($c[0] ne $chan)");
+ }
+ if ( !defined $chanconf{ $c[0] }{$param} and ( $c ne '_default' ) ) {
+ return &getChanConf( $param, '_default' );
+ }
+ &DEBUG( "gCC: $param,$c \"" . $chanconf{ $c[0] }{$param} . '"' );
+ return $chanconf{ $c[0] }{$param};
+ }
+
+ #&DEBUG('gCC: returning _default... ' . $chanconf{'_default'}{$param});
+ return $chanconf{'_default'}{$param};
+}
+
+sub getChanConfDefault {
+ my ( $what, $default, $chan ) = @_;
+ $chan ||= '_default';
+
+ if ( exists $param{$what} ) {
+ if ( !exists $cache{config}{$what} ) {
+ &status(
+"config ($chan): backward-compatible option: found param{$what} ($param{$what}) instead of chan option"
+ );
+ $cache{config}{$what} = 1;
+ }