1

fix coding style

This commit is contained in:
eleksir
2017-12-11 16:10:33 +03:00
parent 51b905cb70
commit d8a1e41eb2
5 changed files with 25 additions and 25 deletions

View File

@@ -89,7 +89,7 @@ sub hookfn {
next unless(defined($_)); next unless(defined($_));
next if($_ eq ''); next if($_ eq '');
if ($_ eq $network){ if ($_ eq $network) {
$flag = 1; $flag = 1;
last; last;
} }
@@ -175,7 +175,7 @@ sub notify_cmd {
else { $msg .= "Networks whitelist: enabled\n"; } else { $msg .= "Networks whitelist: enabled\n"; }
} }
} elsif ($cmd eq 'enable') { } elsif ($cmd eq 'enable') {
if($entity eq 'nick') { if ($entity eq 'nick') {
if (defined(savesetting('nicklist', '1'))) { if (defined(savesetting('nicklist', '1'))) {
$msg = "Nicks whitelist now enabled\n"; $msg = "Nicks whitelist now enabled\n";
} }
@@ -189,7 +189,7 @@ sub notify_cmd {
} }
} }
} elsif ($cmd eq 'disable') { } elsif ($cmd eq 'disable') {
if($entity eq 'nick') { if ($entity eq 'nick') {
if (defined(savesetting('nicklist', '0'))) { if (defined(savesetting('nicklist', '0'))) {
$msg = "Nicks whitelist now disabled\n"; $msg = "Nicks whitelist now disabled\n";
} }
@@ -425,7 +425,7 @@ sub notify_cmd {
} }
} }
unless(defined($msg)) { unless (defined($msg)) {
HexChat::print($help); HexChat::print($help);
} else { } else {
HexChat::print($msg); HexChat::print($msg);
@@ -434,7 +434,7 @@ sub notify_cmd {
return HexChat::EAT_ALL; return HexChat::EAT_ALL;
} }
sub loadliststatus($){ sub loadliststatus($) {
my $listtype = shift; my $listtype = shift;
my $list = HexChat::plugin_pref_get($listtype); my $list = HexChat::plugin_pref_get($listtype);
@@ -447,7 +447,7 @@ sub loadliststatus($){
return $list; return $list;
} }
sub loadlist($){ sub loadlist($) {
my $setting = shift; my $setting = shift;
my $val = HexChat::plugin_pref_get($setting); my $val = HexChat::plugin_pref_get($setting);

View File

@@ -71,7 +71,7 @@ sub cdlfunc($) {
$fname =~ s/[^\w!., -#]/_/g; $fname =~ s/[^\w!., -#]/_/g;
$savepath = $savepath . "/" . $fname . ".$extension"; $savepath = $savepath . "/" . $fname . ".$extension";
if ( (lc($url) =~ /\.(gif|jpeg|png|webm|mp4)$/) and ($1 eq $extension) ){ if ( (lc($url) =~ /\.(gif|jpe?g|png|webm|mp4)$/) and ($1 eq $extension) ) {
$savepath = $ENV{'HOME'} . "/imgsave/" . $fname; $savepath = $ENV{'HOME'} . "/imgsave/" . $fname;
} }
@@ -104,7 +104,7 @@ sub dlfunc(@) {
if (($^O ne 'cygwin') and defined($IMAGEMAGICK)) { if (($^O ne 'cygwin') and defined($IMAGEMAGICK)) {
eval { eval {
if ($file =~ /(png|jpe?g|gif)$/i){ if ($file =~ /(png|jpe?g|gif)$/i) {
my $im = Image::Magick->new(); my $im = Image::Magick->new();
my $rename = 1; my $rename = 1;
my (undef, undef, undef, $format) = $im->Ping($file); my (undef, undef, undef, $format) = $im->Ping($file);

View File

@@ -112,7 +112,7 @@ sub hookfn {
return HexChat::EAT_NONE; return HexChat::EAT_NONE;
} }
sub loadliststatus($){ sub loadliststatus($) {
my $listtype = shift; my $listtype = shift;
my $list = HexChat::plugin_pref_get($listtype); my $list = HexChat::plugin_pref_get($listtype);
@@ -125,7 +125,7 @@ sub loadliststatus($){
return $list; return $list;
} }
sub loadlist($){ sub loadlist($) {
my $setting = shift; my $setting = shift;
my $val = HexChat::plugin_pref_get($setting); my $val = HexChat::plugin_pref_get($setting);
@@ -284,6 +284,7 @@ sub dl_cmd {
} else { } else {
HexChat::print($msg); HexChat::print($msg);
} }
undef $cmd; undef $entity; undef $value; undef $msg; undef $cmd; undef $entity; undef $value; undef $msg;
return HexChat::EAT_ALL; return HexChat::EAT_ALL;
} }

View File

@@ -81,7 +81,6 @@ sub hookfn {
} }
undef $nicklist; undef $nicklist;
my @words = split(/\s+/, $text); my @words = split(/\s+/, $text);
foreach (@words) { foreach (@words) {
@@ -151,7 +150,7 @@ sub dlfunc($) {
mkdir ($savepath) unless (-d $savepath); mkdir ($savepath) unless (-d $savepath);
if ( (lc($url) =~ /\.(gif|jpeg|png|webm|mp4)$/) and ($1 eq $extension) ){ if ( (lc($url) =~ /\.(gif|jpe?g|png|webm|mp4)$/) and ($1 eq $extension) ) {
$savepath = $savepath . "/" . s/[^\w!., -#\:\?]/_/gr; $savepath = $savepath . "/" . s/[^\w!., -#\:\?]/_/gr;
} else { } else {
$savepath = $savepath . "/" . s/[^\w!., -#]\:\?/_/gr . ".$extension"; $savepath = $savepath . "/" . s/[^\w!., -#]\:\?/_/gr . ".$extension";
@@ -164,7 +163,7 @@ sub dlfunc($) {
if (($^O ne 'cygwin') and defined($IMAGEMAGICK)) { if (($^O ne 'cygwin') and defined($IMAGEMAGICK)) {
eval { eval {
if ((-f $savepath) and ($savepath =~ /(png|jpe?g|gif)$/i)){ if ((-f $savepath) and ($savepath =~ /(png|jpe?g|gif)$/i)) {
my $im = Image::Magick->new(); my $im = Image::Magick->new();
my $rename = 1; my $rename = 1;
my (undef, undef, undef, $format) = $im->Ping($savepath); my (undef, undef, undef, $format) = $im->Ping($savepath);
@@ -219,7 +218,7 @@ sub urlencode($) {
return $url; return $url;
} }
sub loadliststatus($){ sub loadliststatus($) {
my $listtype = shift; my $listtype = shift;
my $list = HexChat::plugin_pref_get($listtype); my $list = HexChat::plugin_pref_get($listtype);
@@ -232,7 +231,7 @@ sub loadliststatus($){
return $list; return $list;
} }
sub loadlist($){ sub loadlist($) {
my $setting = shift; my $setting = shift;
my $val = HexChat::plugin_pref_get($setting); my $val = HexChat::plugin_pref_get($setting);
@@ -278,7 +277,7 @@ sub dl_cmd {
if (defined($cmd)) { if (defined($cmd)) {
if ($cmd eq 'enable') { if ($cmd eq 'enable') {
if($entity eq 'nick') { if ($entity eq 'nick') {
if (defined(savesetting('dl_nicklist', '1'))) { if (defined(savesetting('dl_nicklist', '1'))) {
$msg = "Nicks blacklist now enabled\n"; $msg = "Nicks blacklist now enabled\n";
} }
@@ -288,7 +287,7 @@ sub dl_cmd {
} }
} }
} elsif ($cmd eq 'disable') { } elsif ($cmd eq 'disable') {
if($entity eq 'nick') { if ($entity eq 'nick') {
if (defined(savesetting('dl_nicklist', '0'))) { if (defined(savesetting('dl_nicklist', '0'))) {
$msg = "Nicks blacklist now disabled\n"; $msg = "Nicks blacklist now disabled\n";
} }
@@ -306,7 +305,7 @@ sub dl_cmd {
$msg .= "Nicks blacklist: enabled\n"; $msg .= "Nicks blacklist: enabled\n";
} }
$msg .= "Blacklisted nicks = " . join( ', ', loadlist('dl_nicks')) ."\n"; $msg .= "Blacklisted nicks = " . join( ', ', loadlist('dl_nicks')) . "\n";
if (loadliststatus('dl_domainlist') == 0) { if (loadliststatus('dl_domainlist') == 0) {
$msg .= "Domains blacklist: disabled\n"; $msg .= "Domains blacklist: disabled\n";
@@ -386,11 +385,12 @@ sub dl_cmd {
} }
} }
unless(defined($msg)) { unless (defined($msg)) {
HexChat::print($help); HexChat::print($help);
} else { } else {
HexChat::print($msg); HexChat::print($msg);
} }
undef $cmd; undef $entity; undef $value; undef $msg; undef $cmd; undef $entity; undef $value; undef $msg;
return HexChat::EAT_ALL; return HexChat::EAT_ALL;
} }

View File

@@ -78,7 +78,6 @@ sub hookfn {
} }
undef $nicklist; undef $nicklist;
my @words = split(/\s+/, $text); my @words = split(/\s+/, $text);
foreach (@words) { foreach (@words) {
@@ -239,7 +238,7 @@ sub urlencode($) {
return $url; return $url;
} }
sub loadliststatus($){ sub loadliststatus($) {
my $listtype = shift; my $listtype = shift;
my $list = HexChat::plugin_pref_get($listtype); my $list = HexChat::plugin_pref_get($listtype);
@@ -252,7 +251,7 @@ sub loadliststatus($){
return $list; return $list;
} }
sub loadlist($){ sub loadlist($) {
my $setting = shift; my $setting = shift;
my $val = HexChat::plugin_pref_get($setting); my $val = HexChat::plugin_pref_get($setting);
@@ -298,7 +297,7 @@ sub dl_cmd {
if (defined($cmd)) { if (defined($cmd)) {
if ($cmd eq 'enable') { if ($cmd eq 'enable') {
if($entity eq 'nick') { if ($entity eq 'nick') {
if (defined(savesetting('dl_nicklist', '1'))) { if (defined(savesetting('dl_nicklist', '1'))) {
$msg = "Nicks blacklist now enabled\n"; $msg = "Nicks blacklist now enabled\n";
} }
@@ -308,7 +307,7 @@ sub dl_cmd {
} }
} }
} elsif ($cmd eq 'disable') { } elsif ($cmd eq 'disable') {
if($entity eq 'nick') { if ($entity eq 'nick') {
if (defined(savesetting('dl_nicklist', '0'))) { if (defined(savesetting('dl_nicklist', '0'))) {
$msg = "Nicks blacklist now disabled\n"; $msg = "Nicks blacklist now disabled\n";
} }
@@ -406,7 +405,7 @@ sub dl_cmd {
} }
} }
unless(defined($msg)) { unless (defined($msg)) {
HexChat::print($help); HexChat::print($help);
} else { } else {
HexChat::print($msg); HexChat::print($msg);