1
This commit is contained in:
eleksir
2016-10-04 02:51:25 +03:00
parent aba2920bf8
commit 1167d619e9

View File

@@ -1,4 +1,3 @@
# TODO: a bit more code cleanup, refactor enable|disable sub-commands
use strict; use strict;
use warnings "all"; use warnings "all";
use HexChat qw(:all); use HexChat qw(:all);
@@ -24,7 +23,7 @@ my $help = 'Usage:
/notify show - shows whitelists and their statuses /notify show - shows whitelists and their statuses
'; ';
register($script_name, '0.7rc1', 'Sends *nix desktop notifications', \&freehooks); register($script_name, '0.7', 'Sends *nix desktop notifications', \&freehooks);
HexChat::print("$script_name loaded\n"); HexChat::print("$script_name loaded\n");
my @hooks; my @hooks;
@@ -158,21 +157,15 @@ sub notify_cmd {
return HexChat::EAT_ALL; return HexChat::EAT_ALL;
} elsif ($cmd eq 'enable') { } elsif ($cmd eq 'enable') {
if($entity eq 'nick') { if($entity eq 'nick') {
if (HexChat::plugin_pref_set('nicklist', '1') == 0) { if (defined(savesetting('nicklist', '1'))) {
HexChat::print("Unable to save settings for $script_name\n");
} else {
HexChat::print("Nicks whitelist now enabled\n"); HexChat::print("Nicks whitelist now enabled\n");
} }
} elsif ($entity eq 'chan') { } elsif ($entity eq 'chan') {
if (HexChat::plugin_pref_set('chanlist', '1') == 0) { if (defined(savesetting('chanlist', '1'))) {
HexChat::print("Unable to save settings for $script_name\n");
} else {
HexChat::print("Channel whitelist now enabled\n"); HexChat::print("Channel whitelist now enabled\n");
} }
} elsif ($entity eq 'net') { } elsif ($entity eq 'net') {
if (HexChat::plugin_pref_set('netlist', '1') == 0) { if (defined(savesetting('netlist', '1'))) {
HexChat::print("Unable to save settings for $script_name\n");
} else {
HexChat::print("Networks whitelist now enabled\n"); HexChat::print("Networks whitelist now enabled\n");
} }
} }
@@ -180,21 +173,15 @@ sub notify_cmd {
return HexChat::EAT_ALL; return HexChat::EAT_ALL;
} elsif ($cmd eq 'disable') { } elsif ($cmd eq 'disable') {
if($entity eq 'nick') { if($entity eq 'nick') {
if (HexChat::plugin_pref_set('nicklist', '0') == 0) { if (defined(savesetting('nicklist', '0'))) {
HexChat::print("Unable to save settings for $script_name]n");
} else {
HexChat::print("Nicks whitelist now disabled\n"); HexChat::print("Nicks whitelist now disabled\n");
} }
} elsif ($entity eq 'chan') { } elsif ($entity eq 'chan') {
if (HexChat::plugin_pref_set('chanlist', '0') == 0) { if (defined(savesetting('chanlist', '0'))) {
HexChat::print("Unable to save settings for $script_name\n");
} else {
HexChat::print("Channel whitelist now disabled\n"); HexChat::print("Channel whitelist now disabled\n");
} }
} elsif ($entity eq 'net') { } elsif ($entity eq 'net') {
if (HexChat::plugin_pref_set('netlist', '0') == 0) { if (defined(savesetting('netlist', '0'))) {
HexChat::print("Unable to save settings for $script_name\n");
} else {
HexChat::print("Networks whitelist now disabled\n"); HexChat::print("Networks whitelist now disabled\n");
} }
} }