diff --git a/chrome/content/mailhops.js b/chrome/content/mailhops.js index afdab72..1200276 100644 --- a/chrome/content/mailhops.js +++ b/chrome/content/mailhops.js @@ -8,7 +8,7 @@ var mailHops = { msgURI: null , isLoaded: false - , options: {'version':'MailHops Plugin 1.0.3','lan':'en','unit':'mi','api_url':'http://api.mailhops.com','debug':false} + , options: {'version':'MailHops Plugin 1.0.4','lan':'en','unit':'mi','api_url':'http://api.mailhops.com','debug':false} , message: { secure:[] } , client_location: null }; @@ -26,7 +26,7 @@ mailHops.init = function() { //load preferences mailHops.loadPref(); - + document.getElementById("mailhopsDataPanePrefsLink").addEventListener("click", function () { window.openDialog("chrome://mailhops/content/preferences.xul","","chrome, dialog, modal, centerscreen").focus(); }); @@ -36,7 +36,7 @@ mailHops.init = function() { }); mailHops.isLoaded = true; - + }; mailHops.loadPref = function() @@ -69,7 +69,7 @@ mailHops.loadPref = function() mailHops.options.api_url = mailHops.getCharPref('mail.mailHops.api_url','http://api.mailhops.com'); mailHops.options.map_provider = mailHops.getCharPref('mail.mailHops.map_provider','OpenStreetMap.Mapnik'); - + if(mailHops.options.client_location == ''){ mailHops.setClientLocation(function(response){ mailHops.options.client_location=response; @@ -142,12 +142,12 @@ mailHops.getRoute = function(){ //IP regex var regexIp=/(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)(\/(?:[012]\d?|3[012]?|[456789])){0,1}$/; var regexAllIp = /(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)(\/(?:[012]\d?|3[012]?|[456789])){0,1}/g; - + // TODO test IPV6 regex for Received headers, currently only used for X-Originating-IP // IPv6 addresses including compressed and IPv4-embedded variants (RFC 2373) // http://regexlib.com/REDetails.aspx?regexp_id=2919 var regexIPV6 = /(::|(([a-fA-F0-9]{1,4}):){7}(([a-fA-F0-9]{1,4}))|(:(:([a-fA-F0-9]{1,4})){1,6})|((([a-fA-F0-9]{1,4}):){1,6}:)|((([a-fA-F0-9]{1,4}):)(:([a-fA-F0-9]{1,4})){1,6})|((([a-fA-F0-9]{1,4}):){2}(:([a-fA-F0-9]{1,4})){1,5})|((([a-fA-F0-9]{1,4}):){3}(:([a-fA-F0-9]{1,4})){1,4})|((([a-fA-F0-9]{1,4}):){4}(:([a-fA-F0-9]{1,4})){1,3})|((([a-fA-F0-9]{1,4}):){5}(:([a-fA-F0-9]{1,4})){1,2}))/; - + var headReceived = mailHops.headers.extractHeader ( "Received" , true ) ; var headXOrigIP = mailHops.headers.extractHeader ( "X-Originating-IP" , false ) ; //auth box @@ -191,7 +191,7 @@ mailHops.getRoute = function(){ all_ips.unshift( received_ips[r] ); //don't want duplicate IPs from the same Received header if(r < received_ips.length && received_ips[r] == received_ips[r+1]) - break; + break; } } } @@ -232,14 +232,14 @@ mailHops.testIP = function(ip,header){ if(firstchar.match(/\.|\d|\-/) || lastchar.match(/\.|\d|\-/) - || ( firstchar == '?' && lastchar == '?' ) + || ( firstchar == '?' && lastchar == '?' ) || lastchar == ';'){ - return null; + return null; } else if(header.indexOf('['+ip+']') !== -1 || header.indexOf('('+ip+')') !== -1){ - retval = true; + retval = true; } - + //check if this IP was part of a secure transmission if(retval){ if(header.indexOf('using SSL') != -1){ @@ -363,9 +363,6 @@ mailHops.lookupRoute = function(header_route){ if(mailHops.options.fkey != '') lookupURL += '&fkey='+mailHops.options.fkey; - if(mailHops.options.client_location != '') - lookupURL+='&c=0'; - mailHops.LOG(lookupURL); //check for cache diff --git a/chrome/content/pb-overlay.js b/chrome/content/pb-overlay.js index b01c666..4727963 100644 --- a/chrome/content/pb-overlay.js +++ b/chrome/content/pb-overlay.js @@ -1,5 +1,5 @@ var mailHopsDisplay = -{ +{ resultTextDataPane: null, resultTextDataPane2: null, resultTextDataPane3: null, @@ -19,7 +19,7 @@ var mailHopsDisplay = options: null, init: function(options){ - + this.options = options; this.resultContainerDataPane = document.getElementById ( "mailhopsDataPane"); @@ -48,7 +48,7 @@ var mailHopsDisplay = document.getElementById('dataPaneMailHopsMetaContainer').style.display=''; else document.getElementById('dataPaneMailHopsMetaContainer').style.display='none'; - + //event listner for route click to launch map this.resultMapLink.addEventListener("click", function () { if(this.hasAttribute("data-route")) @@ -246,11 +246,11 @@ var mailHopsDisplay = if(no_ips){ this.resultTextDataPane.style.backgroundImage = 'url(chrome://mailhops/content/images/help.png)'; this.resultTextDataPane.value = ' No IPs'; - this.resultTextDataPane.setAttribute('tooltiptext','There were no received headers found'); + this.resultTextDataPane.setAttribute('tooltiptext','There were no received headers found'); } else { this.resultTextDataPane.style.backgroundImage = 'url(chrome://mailhops/content/images/loader.gif)'; this.resultTextDataPane.value = ' Looking Up Route'; - this.resultTextDataPane.setAttribute('tooltiptext','Looking Up Route'); + this.resultTextDataPane.setAttribute('tooltiptext','Looking Up Route'); } this.resultTextDataPane2.value = ''; @@ -258,7 +258,7 @@ var mailHopsDisplay = this.resultTextDataPane2.setAttribute('tooltiptext',''); this.resultTextDataPane3.style.display = 'none'; - this.resultTextDataPane3.value = ''; + this.resultTextDataPane3.value = ''; //remove child details while(this.resultDetails.firstChild) { @@ -267,7 +267,7 @@ var mailHopsDisplay = }, route: function(header_route, message, response, meta, lookup_url){ - + var displayText='' , distanceText='' , image='chrome://mailhops/content/images/local.png' @@ -296,13 +296,14 @@ var mailHopsDisplay = mlabel.setAttribute('href',lookup_url); this.resultMeta.appendChild(mlabel); - } + } if(response && response.route && response.route.length > 0){ if(this.options.client_location){ var client_location = JSON.parse(this.options.client_location); - response.route.push(client_location.route[0]); + if(response.route[response.route.length-1].ip != client_location.route[0].ip) + response.route.push(client_location.route[0]); } for(var i=0; i 2 thunderbird@mailhops.com - 1.0.3 + 1.0.4 MailHops MailHops maps the route an email traveled to get to you. Using GeoIP it also displays distance traveled along with the location (city, state and country) of the sender. @@ -16,16 +16,16 @@ - - + + postbox@postbox-inc.com 2.0 4.* - + - + {3550f703-e582-4d05-9a08-453d09bdfdc6} 3.0.* @@ -39,7 +39,7 @@ MailHops MailHops Karten die Route eine E-Mail gereist, um bei Ihnen melden. Verwendung GeoIP es zeigt auch zurückgelegte Strecke zusammen mit dem Standort ( Ort, Bundesland und Land) des Absenders. - + @@ -47,7 +47,7 @@ MailHops MailHops maps the route an email traveled to get to you. Using GeoIP it also displays distance traveled along with the location (city, state and country) of the sender. - + @@ -55,7 +55,7 @@ MailHops Mapas MailHops la ruta un correo electrónico viajó a llegar a usted. Usando GeoIP también muestra la distancia recorrida junto con la ubicación ( ciudad, estado y país) del remitente. - + @@ -63,7 +63,7 @@ MailHops MailHops mappe la route un email parcouru pour arriver à vous . Utilisation GeoIP il affiche aussi la distance parcourue avec le lieu (ville , état ​​et pays ) de l'expéditeur. - + @@ -71,7 +71,7 @@ MailHops MailHops電子メールがあなたに取得するために旅したルートをマップします。のGeoIPを使用しても距離が送信者の場所(都市、州や国)と一緒に旅に表示されます。 - + @@ -79,7 +79,7 @@ MailHops MailHops mapeia a rota um e-mail viajou para chegar até você . Usando GeoIP ele também exibe a distância percorrida , juntamente com a localização (cidade , estado e país ) do remetente. - + @@ -87,7 +87,7 @@ MailHops MailHops отображает маршрутэлектронной почты , пройденное , чтобы добраться до вас. Использование GeoIP также отображает расстояние вместе с места (город, штат и страна ) отправителя. - + @@ -95,8 +95,8 @@ MailHops MailHops映射電子郵件前往得到你的路線。使用GeoIP的它也顯示行駛距離隨著發送者的位置(城市,州和國家) - - + + - +