3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-10-04 18:38:47 +02:00

Channels: add get_meta() convenience subroutine

This commit is contained in:
Pragmatic Software 2018-08-05 22:44:46 -07:00
parent 4e996717c8
commit 1f43e003d8

View File

@ -107,25 +107,28 @@ sub list {
sub is_active {
my ($self, $channel) = @_;
return exists $self->{channels}->hash->{$channel} && $self->{channels}->hash->{$channel}->{enabled};
}
sub is_active_op {
my ($self, $channel) = @_;
return $self->is_active($channel) && $self->{channels}->hash->{$channel}->{chanop};
}
sub get_meta {
my ($self, $channel, $key) = @_;
my $index = $self->{channels}->find_hash($channel);
return undef if not defined $index;
return $self->{channels}->{hash}->{$index}->{$key};
}
sub load_channels {
my $self = shift;
$self->{channels}->load();
}
sub save_channels {
my $self = shift;
$self->{channels}->save();
}