FTNMAIL: commend, whitespace, return value fixes
authorSebastian <basti@notizbuch>
Tue, 30 Jun 2015 20:24:58 +0000 (22:24 +0200)
committerSebastian <basti@notizbuch>
Tue, 30 Jun 2015 20:24:58 +0000 (22:24 +0200)
modules/FTNMAIL.pm

index 8a606af1a9bec19c8483735d5e39e3e853e4fc28..c5a46fff48d193056ba9db002875ba7ef1aa42be 100644 (file)
@@ -11,7 +11,7 @@ use v5.010;
 #
 #  @mails  = unpack_packet($filename)     (see FTS-0001, F.1 / FSC-0048)
 #    reads a packet file and returns an array of mails
-#    returns undef on error, dies on file error
+#    returns empty list on error
 # =========================================================================
 package FTNMAIL;
 
@@ -29,7 +29,7 @@ sub pack_mail($$)
        my $tname = encode($charset, $mail->{tname});
        my $subj  = encode($charset, $mail->{subj});
        my $body  = encode($charset, $mail->{body});
-       $body    =~ s/\n/\x0D/g;
+       $body     =~ s/\n/\x0D/g;
 
        # generate kludge lines
        my @kludges;
@@ -152,7 +152,7 @@ sub unpack_body($$$$)
 
        # find FROM and TO addresses
        if(!$mail{area}) {
-       # --> NETMAIL: use INTL/FMPT/TOPT (fallback to packet headers)
+       # --> NETMAIL: use INTL/FMPT/TOPT (with fallback in unpack_packet())
                if($intl && $intl=~/^(\d+):(\d+)\/(\d+) (\d+):(\d+)\/(\d+)$/) {
                        if($fmpt) {
                                $mail{from} = "$4:$5/$6.$fmpt";
@@ -302,7 +302,7 @@ sub str2datetime($)
                ($hour, $minute, $second) = ($5, $6, 0);
        } else {
                LOG::warn("Unknown date format '$str'!");
-               return(undef);
+               return;
        }
 
        if($year < 80) {
@@ -340,7 +340,7 @@ sub str2ftn($)
        }
 
        LOG::warn("Invalid FTN string '$str'!");
-       return(undef);
+       return;
 }
 
 sub ftn2str(@)
@@ -354,10 +354,10 @@ sub ftn2str(@)
                }
        } elsif($fido[0]) {
                LOG::warn("Invalid FTN address: " . join(":", @fido) . "!");
-               return(undef);
+               return;
        }
 
-       return(undef);
+       return;
 }
 
 # === Charset conversion ==================================================
@@ -386,7 +386,7 @@ my %charsets = (
                'UTF-8 2' => 'utf-8', 'UTF-8 4' => 'utf-8',
        },
        'to' => {
-               # if not listed here, inverse 'from' mappings
+               # if not listed here, use inverse 'from' mappings
                'cp437' => 'CP437 2', 'cp866' => 'CP866 2',
                'utf-8' => 'UTF-8 4', 'ascii' => 'ASCII 1',
        },