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:
parent
2999749c36
commit
7d37587a77
@ -198,15 +198,14 @@ mailHops.getRoute = function(){
|
||||
for( var h=0; h < headReceivedArr.length; h++ ) {
|
||||
//build the received line by concat until semi-colon ; date/time
|
||||
rline += headReceivedArr[h];
|
||||
if(headReceivedArr[h].indexOf(';')==-1)
|
||||
if(headReceivedArr[h].indexOf(';') === -1)
|
||||
continue;
|
||||
|
||||
// first and last dates are used to calculate time traveled
|
||||
if(rline.indexOf(';') !== -1){
|
||||
if(!firstDate)
|
||||
firstDate = rline.substring(rline.indexOf(';')+1).trim();
|
||||
if(!lastDate)
|
||||
lastDate = rline.substring(rline.indexOf(';')+1).trim();
|
||||
else
|
||||
firstDate = rline.substring(rline.indexOf(';')+1).trim();
|
||||
}
|
||||
|
||||
// parse IPs out of Received line
|
||||
@ -394,7 +393,6 @@ mailHops.LOG(lookupURL);
|
||||
xmlhttp.onreadystatechange=function() {
|
||||
if (xmlhttp.readyState===4){
|
||||
try {
|
||||
mailHops.LOG(xmlhttp.status);
|
||||
var data = JSON.parse(xmlhttp.responseText);
|
||||
if(xmlhttp.status===200){
|
||||
var d = new Date();
|
||||
@ -431,7 +429,7 @@ mailHops.saveResults = function(results,route){
|
||||
msgHdr.setStringProperty( "MH-Route", results );
|
||||
|
||||
//Add tag
|
||||
if(!!route){
|
||||
if(!!route && !!mailHops.options.api_key){
|
||||
try {
|
||||
var countryCode = mailHopsUtils.getOriginatingCountryCode(route);
|
||||
var msg = Components.classes["@mozilla.org/array;1"].createInstance(Components.interfaces.nsIMutableArray);
|
||||
|
@ -308,7 +308,7 @@ var mailHopsDisplay =
|
||||
else if(message.time<3600) //something is wrong if it takes this long
|
||||
distanceText += ' in '+Math.round(message.time/60)+' min.';
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user