Skip to content

Commit

Permalink
decoder: Fixes for malformed NAVADMIN IDs and start of body text.
Browse files Browse the repository at this point in the history
More slight fixups to better detect NAVADMIN IDs and body text.

See NAVADMINs 258/24, 260/24, 008/24 as examples.
  • Loading branch information
mpyne-navy committed Jan 1, 2025
1 parent d1eda81 commit e1bb59d
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions modules/MsgReader.pm
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ sub split_up_navadmin($text)
# say "cur line: $line (", scalar @lines, " more to read)";

if ($in_head && (
$line =~ m,^(GENTEXT/)?[rR][mM][kK][sS]/, ||
$line =~ m,^(AMPN/|GENTEXT/)?[rR][mM][kK][sS]/, ||
$line =~ m,^(GENTEXT/)?REMARKS/, ||
# maybe they just started with the text...
$line =~ m,^RMKS1\., ||
$line =~ m,^RMKS *1\., ||
$line =~ m,^1\.,
))
{
Expand Down Expand Up @@ -146,6 +146,14 @@ sub decode_msg_head($head)
}
} else {
$val =~ s,//$,,; # Remove any stray trailing slashes still stuck on
if ($field eq 'NAVADMIN' && $val =~ m,^0[0-9]/[0-9]+$,) {
my ($id, $yr) = split('/', $val, 2);

# if not 3 digits, make it so
if ($id !~ /^[0-9]{3}$/) {
$val = sprintf("%03d/%02d", int($id), int($yr));
}
}
$fields{$field} = $val;
}
};
Expand Down

0 comments on commit e1bb59d

Please sign in to comment.