diff --git a/fleprocess/adif_write.go b/fleprocess/adif_write.go index 1222112..132a274 100644 --- a/fleprocess/adif_write.go +++ b/fleprocess/adif_write.go @@ -68,6 +68,9 @@ func buildAdif(fullLog []LogLine, isWWFF bool, isSOTA bool) (adifList []string) if isWWFF { adifLine.WriteString(adifElement("MY_SIG", "WWFF")) adifLine.WriteString(adifElement("MY_SIG_INFO", logLine.MyWWFF)) + if logLine.WWFF != "" { + adifLine.WriteString(adifElement("SIG_INFO",logLine.WWFF)) + } } if isSOTA { adifLine.WriteString(adifElement("MY_SOTA_REF", logLine.MySOTA)) diff --git a/fleprocess/parse_line.go b/fleprocess/parse_line.go index addaf06..8d21cef 100644 --- a/fleprocess/parse_line.go +++ b/fleprocess/parse_line.go @@ -190,12 +190,16 @@ func ParseLine(inputStr string, previousLine LogLine) (logLine LogLine, errorMsg } // Is it a call sign ? + //FIXME: if validCallRegexp.MatchString(strings.ToUpper(element)) { - callErrorMsg := "" - logLine.Call, callErrorMsg = ValidateCall(element) - errorMsg = errorMsg + callErrorMsg - isRightOfCall = true - continue + //If it starts with "#",it is a grid definition and not a call + if element[0] != '#' { + callErrorMsg := "" + logLine.Call, callErrorMsg = ValidateCall(element) + errorMsg = errorMsg + callErrorMsg + isRightOfCall = true + continue + } } // Is it a "full" time ? diff --git a/fleprocess/parse_line_test.go b/fleprocess/parse_line_test.go index 4e91301..95ae8b2 100644 --- a/fleprocess/parse_line_test.go +++ b/fleprocess/parse_line_test.go @@ -52,6 +52,12 @@ func TestParseLine(t *testing.T) { args{inputStr: "15 g3noh", previousLine: LogLine{Time: "1200", Mode: "SSB"}}, LogLine{Time: "1215", ActualTime: "1215", Call: "G3NOH", Mode: "SSB", RSTsent: "59", RSTrcvd: "59"}, "", }, + // + { + "Parse suspecious line", + args{inputStr: "1029 Sm/dl8mf 559 579", previousLine: LogLine{Time: "1200", Mode: "CW", ModeType: "CW"}}, + LogLine{Time: "1029", ActualTime: "1029", Call: "SM/DL8MF", Mode: "CW", ModeType: "CW", RSTsent: "559", RSTrcvd: "579"}, "", + }, { "Parse partial time - 3", args{inputStr: "4 g3noh", previousLine: LogLine{Time: "1200", Mode: "SSB"}}, diff --git a/fleprocess/validate.go b/fleprocess/validate.go index 4647f5a..d3ee276 100644 --- a/fleprocess/validate.go +++ b/fleprocess/validate.go @@ -82,7 +82,7 @@ func ValidateGridLocator(grid string) (processedGrid, errorMsg string) { return processedGrid, errorMsg } -var validCallRegexp = regexp.MustCompile(`^[\d]{0,1}[A-Z]{1,2}\d([A-Z]{1,4}|\d{3,3}|\d{1,3}[A-Z])[A-Z]{0,5}`) +var validCallRegexp = regexp.MustCompile(`[\d]{0,1}[A-Z]{1,2}\d([A-Z]{1,4}|\d{3,3}|\d{1,3}[A-Z])[A-Z]{0,5}`) var validPrefixRegexp = regexp.MustCompile(`\A[a-zA-Z0-9]{1,3}$`) // ValidateCall verifies whether the supplied string is a valid callsign. diff --git a/fleprocess/validate_test.go b/fleprocess/validate_test.go index 93ae59a..35b4c1b 100644 --- a/fleprocess/validate_test.go +++ b/fleprocess/validate_test.go @@ -182,6 +182,16 @@ func TestValidateCall(t *testing.T) { args{sign: "DL/on4KJm/qrpp "}, "DL/ON4KJM/QRPP", "", }, + { + "Valid call from activation", + args{sign: "sm1/dl6jz/p"}, + "SM1/DL6JZ/P", "", + }, + { + "Valid call from activation (case 2)", + args{sign: "Sm/dl8mf"}, + "SM/DL8MF", "", + }, { "Valid prefix (issue #2)", args{sign: "e7/z35m/p"},