Notify config
This commit is contained in:
parent
52503dfebf
commit
fa55cd636b
@ -15,15 +15,16 @@ sub new {
|
|||||||
sub load {
|
sub load {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
my $file = $self->{_file};
|
my $file = $self->{_file};
|
||||||
|
|
||||||
my $tiny = Config::Tiny->new();
|
my $tiny = Config::Tiny->new();
|
||||||
$config = $tiny->read($file);
|
$config = $tiny->read($file);
|
||||||
|
|
||||||
my $key = $config->{auth}->{key};
|
my $key = $config->{auth}->{key};
|
||||||
my $nick = $config->{auth}->{nick};
|
my $nick = $config->{auth}->{nick};
|
||||||
my $host = $config->{node}->{host};
|
my $host = $config->{node}->{host};
|
||||||
my @echoareas = split /,/, $config->{node}->{echoareas};
|
my @echoareas = split /,/, $config->{node}->{echoareas};
|
||||||
my $name = $config->{node}->{name};
|
my $name = $config->{node}->{name};
|
||||||
|
my $notify = $config->{notify}->{enabled};
|
||||||
|
|
||||||
$c = {
|
$c = {
|
||||||
nick => $nick,
|
nick => $nick,
|
||||||
@ -31,6 +32,7 @@ sub load {
|
|||||||
host => $host,
|
host => $host,
|
||||||
echoareas => [@echoareas],
|
echoareas => [@echoareas],
|
||||||
name => $name,
|
name => $name,
|
||||||
|
notify => $notify,
|
||||||
};
|
};
|
||||||
|
|
||||||
return $c;
|
return $c;
|
||||||
@ -40,7 +42,7 @@ sub load {
|
|||||||
sub reload {
|
sub reload {
|
||||||
my ($self) = @_;
|
my ($self) = @_;
|
||||||
|
|
||||||
my $c = II::Config->new();
|
my $c = II::Config->new();
|
||||||
my $config = $c->load();
|
my $config = $c->load();
|
||||||
|
|
||||||
return $config;
|
return $config;
|
||||||
|
@ -148,7 +148,9 @@ sub get_echo {
|
|||||||
|
|
||||||
# Notify
|
# Notify
|
||||||
my @notify_cmd = ('notify-send', 'Сеть ii', 'Есть новые сообщения');
|
my @notify_cmd = ('notify-send', 'Сеть ii', 'Есть новые сообщения');
|
||||||
system(@notify_cmd) == 0 or warn "Cannot send notify: $!\n";
|
if ($notify == 1) {
|
||||||
|
system(@notify_cmd) == 0 or warn "Cannot send notify: $!\n";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return $msgs;
|
return $msgs;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user