mirror of
https://github.com/pragma-/pbot.git
synced 2024-12-24 03:33:06 +01:00
Do not override pre-existing registry with default values
This commit is contained in:
parent
0d70d85506
commit
b4e8302f32
@ -74,6 +74,10 @@ sub add {
|
||||
$section = lc $section;
|
||||
$item = lc $item;
|
||||
|
||||
if ($is_default) {
|
||||
return if exists $self->{registry}->hash->{$section} and exists $self->{registry}->hash->{$section}->{$item};
|
||||
}
|
||||
|
||||
$self->{registry}->hash->{$section}->{$item}->{value} = $value;
|
||||
$self->{registry}->hash->{$section}->{$item}->{type} = $type;
|
||||
|
||||
@ -108,6 +112,12 @@ sub set {
|
||||
$item = lc $item;
|
||||
$key = lc $key if defined $key;
|
||||
|
||||
if ($is_default) {
|
||||
return if exists $self->{registry}->hash->{$section}
|
||||
and exists $self->{registry}->hash->{$section}->{$item}
|
||||
and exists $self->{registry}->hash->{$section}->{$item}->{$key};
|
||||
}
|
||||
|
||||
my $oldvalue = $self->get_value($section, $item, 1) if defined $value;
|
||||
$oldvalue = '' if not defined $oldvalue;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user