1
0
mirror of https://github.com/MailHops/mailhops-plugin.git synced 2025-05-17 23:00:10 -07:00

Fixed date logic on time travel

This commit is contained in:
Andrew Van Tassel 2016-10-03 22:23:19 -06:00
parent 2999749c36
commit 7d37587a77
2 changed files with 8 additions and 10 deletions

View File

@ -198,15 +198,14 @@ mailHops.getRoute = function(){
for( var h=0; h < headReceivedArr.length; h++ ) { for( var h=0; h < headReceivedArr.length; h++ ) {
//build the received line by concat until semi-colon ; date/time //build the received line by concat until semi-colon ; date/time
rline += headReceivedArr[h]; rline += headReceivedArr[h];
if(headReceivedArr[h].indexOf(';')==-1) if(headReceivedArr[h].indexOf(';') === -1)
continue; continue;
// first and last dates are used to calculate time traveled // first and last dates are used to calculate time traveled
if(rline.indexOf(';') !== -1){ if(rline.indexOf(';') !== -1){
if(!firstDate)
firstDate = rline.substring(rline.indexOf(';')+1).trim();
if(!lastDate) if(!lastDate)
lastDate = rline.substring(rline.indexOf(';')+1).trim(); lastDate = rline.substring(rline.indexOf(';')+1).trim();
else
firstDate = rline.substring(rline.indexOf(';')+1).trim();
} }
// parse IPs out of Received line // parse IPs out of Received line
@ -394,7 +393,6 @@ mailHops.LOG(lookupURL);
xmlhttp.onreadystatechange=function() { xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState===4){ if (xmlhttp.readyState===4){
try { try {
mailHops.LOG(xmlhttp.status);
var data = JSON.parse(xmlhttp.responseText); var data = JSON.parse(xmlhttp.responseText);
if(xmlhttp.status===200){ if(xmlhttp.status===200){
var d = new Date(); var d = new Date();
@ -431,7 +429,7 @@ mailHops.saveResults = function(results,route){
msgHdr.setStringProperty( "MH-Route", results ); msgHdr.setStringProperty( "MH-Route", results );
//Add tag //Add tag
if(!!route){ if(!!route && !!mailHops.options.api_key){
try { try {
var countryCode = mailHopsUtils.getOriginatingCountryCode(route); var countryCode = mailHopsUtils.getOriginatingCountryCode(route);
var msg = Components.classes["@mozilla.org/array;1"].createInstance(Components.interfaces.nsIMutableArray); var msg = Components.classes["@mozilla.org/array;1"].createInstance(Components.interfaces.nsIMutableArray);

View File

@ -308,7 +308,7 @@ var mailHopsDisplay =
else if(message.time<3600) //something is wrong if it takes this long else if(message.time<3600) //something is wrong if it takes this long
distanceText += ' in '+Math.round(message.time/60)+' min.'; distanceText += ' in '+Math.round(message.time/60)+' min.';
else //something is wrong if it takes this long else //something is wrong if it takes this long
distanceText += ' in '+Math.round(message.time/60/60)+' hrs.'; distanceText += ' in '+Math.round(message.time/60/60)+' hr.';
} }
if(header_route) if(header_route)