diff --git a/package.nw/lib/adif.js b/package.nw/lib/adif.js index db3180c..0f719bb 100644 --- a/package.nw/lib/adif.js +++ b/package.nw/lib/adif.js @@ -86,6 +86,36 @@ function onAdiLoadComplete(adiBuffer, saveAdifFile, adifFileName, newFile) { let finalMode = ""; + let appLoTW_RXQSO = findAdiField( + activeAdifArray[x], + "APP_LoTW_RXQSO" + ); + + if (appLoTW_RXQSO != "") + { + let dRXQSO = Date.parse(appLoTW_RXQSO); + let dLastLOTW_QSO = Date.parse(g_adifLogSettings.lastFetch.lotw_qso); + if ((isNaN(dRXQSO) == false) && (isNaN(dLastLOTW_QSO) == false) && (dRXQSO > dLastLOTW_QSO)) + { + g_adifLogSettings.lastFetch.lotw_qso = appLoTW_RXQSO; + } + } + + let appLoTW_RXQSL = findAdiField( + activeAdifArray[x], + "APP_LoTW_RXQSL" + ); + + if (appLoTW_RXQSL != "") + { + let dRXQSL = Date.parse(appLoTW_RXQSL); + let dLastLOTW_QSL = Date.parse(g_adifLogSettings.lastFetch.lotw_qsl); + if ((isNaN(dRXQSL) == false) && (isNaN(dLastLOTW_QSL) == false) && (dRXQSL > dLastLOTW_QSL)) + { + g_adifLogSettings.lastFetch.lotw_qso = appLoTW_RXQSO; + } + } + if (activeAdifArray[x].length > 3) { if (activeAdifLogMode) @@ -577,6 +607,7 @@ function lotwCallback(buffer, flag) if (lotwQSHeader !== null) { if (lotwQSHeader[1].toUpperCase() == "QSORX") +<<<<<<< HEAD { g_adifLogSettings.lastFetch.lotw_qso = lotwQSHeader[2] } @@ -584,6 +615,11 @@ function lotwCallback(buffer, flag) { g_adifLogSettings.lastFetch.lotw_qsl = lotwQSHeader[2]; } +======= + { g_adifLogSettings.lastFetch.lotw_qso = lotwQSHeader[2] } + elseif(lotwQSHeader[1].toUpperCase() == "QSL") + g_adifLogSettings.lastFetch.lotw_qsl = lotwQSHeader[2]; +>>>>>>> 272892e... Initial workup for LoTW throttling & diff fetching } rawAdiBuffer = cleanAndPrepADIF( @@ -637,6 +673,7 @@ var g_isGettingLOTW = false; function grabLOtWLog(test) { +<<<<<<< HEAD var lastQSLDateString = ""; if (test == true && g_isGettingLOTW == false) @@ -645,6 +682,28 @@ function grabLOtWLog(test) lastQSLDateString = "&qso_qsosince=2100-01-01"; // Fetch Test Results +======= + var dLoTWQSO = Date.parse(g_adifLogSettings.lastFetch.lotw_qso); + var dLoTWQSL = Date.parse(g_adifLogSettings.lastFetch.lotw_qsl); + var tmpDate = ((new Date().getTime()) - 300); + + // Be nice to LoTW and only fetch if last fetch was > 5 mins ago + if ((g_isGettingLOTW == false) && + (((isNaN(dLoTWQSO) == false) && (dLoTWQSO < tmpDate)) || + ((isNaN(dLoTWQSL) == false) && (dLoTWQSL < tmpDate)) + )) + { + var lastQSLDateString = + "&qso_qsorxsince=" + g_adifLogSettings.lastFetch.lotw_qso + + "&qso_qslsince=" + g_adifLogSettings.lastFetch.lotw_qsl; + if (test == true) + { + lotwTestResult.innerHTML = "Testing"; + lastQSLDateString = "&qso_qsosince=2100-01-01"; + } + + // Fetch QSOs +>>>>>>> 272892e... Initial workup for LoTW throttling & diff fetching getABuffer( "https://lotw.arrl.org/lotwuser/lotwreport.adi?login=" + lotwLogin.value + @@ -719,6 +778,27 @@ function grabLoTWQSL() "g_isGettingLOTW", 120000 ); + + // Fetch QSLs + var tQSO = setTimeout(function() + { + if (test == false) lotwLogLoaded = true; + getABuffer( + "https://lotw.arrl.org/lotwuser/lotwreport.adi?login=" + + lotwLogin.value + + "&password=" + + encodeURIComponent(lotwPassword.value) + + "&qso_query=1&qso_qsl=yes&qso_qsldetail=yes&qso_withown=yes" + + lastQSLDateString, + lotwCallback, + test, + "https", + 443, + lotwLogImg, + "g_isGettingLOTW", + 120000 + ); + }, 10000); } } diff --git a/package.nw/lib/gt.js b/package.nw/lib/gt.js index b03b996..92180f9 100644 --- a/package.nw/lib/gt.js +++ b/package.nw/lib/gt.js @@ -5118,7 +5118,7 @@ function clearLogFilesAndCounts() g_adifLogSettings.downloads = {}; g_adifLogSettings.lastFetch.lotw_qso = "1940-01-01"; g_adifLogSettings.lastFetch.lotw_qsl = "1940-01-01"; - saveAdifSettings(); + localStorage.adifLogSettings = JSON.stringify(g_adifLogSettings); } function getCurrentBandModeHTML()