diff --git a/chrome/content/images/host.png b/chrome/content/images/host.png new file mode 100644 index 0000000..720a237 Binary files /dev/null and b/chrome/content/images/host.png differ diff --git a/chrome/content/images/secure.png b/chrome/content/images/secure.png new file mode 100644 index 0000000..3d37f2e Binary files /dev/null and b/chrome/content/images/secure.png differ diff --git a/chrome/content/images/secure_host.png b/chrome/content/images/secure_host.png new file mode 100644 index 0000000..ecd5174 Binary files /dev/null and b/chrome/content/images/secure_host.png differ diff --git a/chrome/content/mailhops.js b/chrome/content/mailhops.js index c019ab3..a95994a 100644 --- a/chrome/content/mailhops.js +++ b/chrome/content/mailhops.js @@ -20,9 +20,13 @@ var mailHops = mailhopsListContainer: null, mailhopsAuthContainer: null, resultListDataPane: null, + + resultMeta: null, + isLoaded: false, options: {'map':'goog','unit':'mi','api_url':'http://api.mailhops.com'}, - appVersion: 'MailHops Postbox 0.7' + appVersion: 'MailHops Postbox 0.7.1', + message: {secure:[]}, } mailHops.init = function() @@ -38,9 +42,10 @@ mailHops.init = function() mailHops.resultDetailsLink = document.getElementById ( "mailhopsDataPaneDetailsLink"); mailHops.resultContainerDetails = document.getElementById ( "mailhopsDetailsContainer"); - mailHops.resultDetails = document.getElementById ( "mailhopsDataPaneDetails"); - - mailHops.resultMapLink = document.getElementById ( "mailhopsDataPaneMapLink"); + mailHops.resultDetails = document.getElementById ( "mailhopsDataPaneDetails"); + mailHops.resultMeta = document.getElementById ( "mailhopsDataPaneMeta"); + mailHops.resultMapLink = document.getElementById ( "mailhopsDataPaneMapLink"); + //auth mailHops.mailhopsAuthContainer = document.getElementById ( "dataPaneMailHopsAuthContainer"); mailHops.mailhopsDataPaneSPF = document.getElementById ( "mailhopsDataPaneSPF"); @@ -51,7 +56,7 @@ mailHops.init = function() mailHops.mailhopsListContainer = document.getElementById ( "dataPaneMailHopsListContainer"); mailHops.resultListDataPane = document.getElementById ( "mailhopsListDataPane"); - + //event listner for route click to launch map mailHops.resultMapLink.addEventListener("click", function () { if(this.hasAttribute("data-route")) @@ -75,7 +80,11 @@ mailHops.init = function() mailHops.launchSpamHausURL(this.getAttribute('data-ip')); } , false); - + + document.getElementById("mailhopsDataPanePrefsLink").addEventListener("click", function () { + window.openDialog("chrome://mailhops/content/preferences.xul","mailHopsPreferences",null,null); + } + , false); }; mailHops.loadPref = function() @@ -86,12 +95,14 @@ mailHops.loadPref = function() //Display Boxes mailHops.options.show_details = mailHops.getCharPref('mail.mailHops.show_details','false')=='true'?true:false; + mailHops.options.show_meta = mailHops.getCharPref('mail.mailHops.show_meta','false')=='true'?true:false; mailHops.options.show_auth = mailHops.getCharPref('mail.mailHops.show_auth','true')=='true'?true:false; mailHops.options.show_lists = mailHops.getCharPref('mail.mailHops.show_lists','true')=='true'?true:false; //Details options mailHops.options.show_host = mailHops.getCharPref('mail.mailHops.show_host','false')=='true'?true:false; mailHops.options.show_weather = mailHops.getCharPref('mail.mailHops.show_weather','false')=='true'?true:false; + mailHops.options.show_secure = mailHops.getCharPref('mail.mailHops.show_secure','false')=='true'?true:false; //Auth options mailHops.options.show_dkim = mailHops.getCharPref('mail.mailHops.show_dkim','true')=='true'?true:false; @@ -203,7 +214,9 @@ var regexAllIp = /(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{ var received_ips; var all_ips = new Array(); var rline=''; - + //empty secure + mailHops.message.secure = []; + //loop through the received headers and parse for IP addresses if ( headReceived ){ var headReceivedArr = headReceived.split('\n'); @@ -256,11 +269,22 @@ mailHops.testIP = function(ip,header){ retval = null; else if(lastchar.match(/\.|\d|\-/)) retval = null; - - if(header.indexOf('['+ip+']') != -1) + + if(firstchar == '?' && lastchar == '?') + retval = null; + else if(header.indexOf('['+ip+']') != -1) retval = true; else if(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) + mailHops.message.secure.push(ip+':'+header.substring(header.indexOf('using SSL'),11)); + else if(header.indexOf('using TLS') != -1) + mailHops.message.secure.push(ip+':'+header.substring(header.indexOf('using TLS'),11)); + else if(header.indexOf('version=TLSv1/SSLv3') != -1) + mailHops.message.secure.push(ip+':'+'using TLSv1/SSLv3'); + } } catch(ex) { retval = true; @@ -273,7 +297,7 @@ mailHops.displayResultLists = function( header_unsubscribe ){ while(mailHops.resultListDataPane.firstChild) { mailHops.resultListDataPane.removeChild(mailHops.resultListDataPane.firstChild); } - + mailHops.mailhopsListContainer.style.display=''; if(header_unsubscribe){ var listArr=header_unsubscribe.split(','); var href=''; @@ -306,6 +330,7 @@ mailHops.displayResultLists = function( header_unsubscribe ){ mailHops.displayResultAuth = function( header_xmailer, header_useragent, header_xmimeole, header_auth, header_spf ){ + mailHops.mailhopsAuthContainer.style.display=''; //SPF if(header_spf){ header_spf=header_spf.replace(/^\s+/,""); @@ -515,7 +540,7 @@ mailHops.authExplainDNSBL_server = function(result){ } }; -mailHops.displayResult = function ( header_route, response ){ +mailHops.displayResult = function ( header_route, response, meta, lookup_url ){ var displayText=''; var distanceText=''; var image='chrome://mailhops/content/images/local.png'; @@ -523,12 +548,34 @@ mailHops.displayResult = function ( header_route, response ){ var state; var countryName; var gotFirst=false; + var secureToolTipText=false; //remove child details - while(mailHops.resultDetails.firstChild) { + while(mailHops.resultDetails.firstChild) { mailHops.resultDetails.removeChild(mailHops.resultDetails.firstChild); - } + } + //append meta + if(mailHops.options.show_meta){ + document.getElementById('dataPaneMailHopsMetaContainer').style.display=''; + while(mailHops.resultMeta.firstChild) { + mailHops.resultMeta.removeChild(mailHops.resultMeta.firstChild); + } + for(var index in meta){ + var mlabel = document.createElement('label'); + mlabel.setAttribute('value',index+': '+meta[index]); + mailHops.resultMeta.appendChild(mlabel); + } + var mlabel = document.createElement('label'); + mlabel.setAttribute('value','api url'); + mlabel.setAttribute('class','text-link'); + mlabel.setAttribute('href',lookup_url); + mailHops.resultMeta.appendChild(mlabel); + + } else { + document.getElementById('dataPaneMailHopsMetaContainer').style.display='none'; + } + if(response){ for(var i=0; i7 && d.getHours()<19) return true; else return false; -} +}; + //display the connection error message mailHops.displayError = function(data){ mailHops.resultMapLink.removeAttribute("route"); @@ -729,7 +802,7 @@ mailHops.clearRoute = function(){ //remove child details while(mailHops.resultDetails.firstChild) { mailHops.resultDetails.removeChild(mailHops.resultDetails.firstChild); - } + } }; mailHops.setupEventListener = function(){ @@ -807,7 +880,7 @@ mailHops.lookup = function(header_route){ var data = JSON.parse(xmlhttp.responseText); if(data && data.meta.code==200){ //display the result - mailHops.displayResult(header_route,data.response); + mailHops.displayResult(header_route,data.response,data.meta, lookupURL); } else { //display the error mailHops.displayError(data); diff --git a/chrome/content/msgHdrViewOverlay.xul b/chrome/content/msgHdrViewOverlay.xul index 1bc9d84..cb08959 100644 --- a/chrome/content/msgHdrViewOverlay.xul +++ b/chrome/content/msgHdrViewOverlay.xul @@ -11,7 +11,7 @@ - + @@ -23,6 +23,7 @@ + @@ -34,7 +35,7 @@ - + @@ -48,14 +49,20 @@ - + - - - + + + + + + + + + diff --git a/chrome/content/preferences.js b/chrome/content/preferences.js index d9fb9a4..5052c68 100644 --- a/chrome/content/preferences.js +++ b/chrome/content/preferences.js @@ -34,6 +34,11 @@ var mailHopPreferences = document.getElementById("mailhop.show_details").checked = true; else document.getElementById("mailhop.show_details").checked = false; + + if(pref.getCharPref("mail.mailHops.show_meta",'false')=='true') + document.getElementById("mailhop.show_meta").checked = true; + else + document.getElementById("mailhop.show_meta").checked = false; if(pref.getCharPref("mail.mailHops.show_lists",'true')=='true') document.getElementById("mailhop.show_lists").checked = true; @@ -54,7 +59,12 @@ var mailHopPreferences = if(pref.getCharPref("mail.mailHops.show_host",'false')=='true') document.getElementById("mailhop.show_host").checked = true; else - document.getElementById("mailhop.show_host").checked = false; + document.getElementById("mailhop.show_host").checked = false; + + if(pref.getCharPref("mail.mailHops.show_secure",'false')=='true') + document.getElementById("mailhop.show_secure").checked = true; + else + document.getElementById("mailhop.show_secure").checked = false; //Auth Options if(pref.getCharPref("mail.mailHops.show_spf",'true')=='true') @@ -100,8 +110,10 @@ var mailHopPreferences = pref.setCharPref("mail.mailHops.map", document.getElementById("mailhop.map").selectedItem.value) ; pref.setCharPref("mail.mailHops.unit", document.getElementById("mailhop.unit").selectedItem.value) ; pref.setCharPref("mail.mailHops.show_details", String(document.getElementById("mailhop.show_details").checked)) ; + pref.setCharPref("mail.mailHops.show_meta", String(document.getElementById("mailhop.show_meta").checked)) ; pref.setCharPref("mail.mailHops.show_weather", String(document.getElementById("mailhop.show_weather").checked)) ; pref.setCharPref("mail.mailHops.show_host", String(document.getElementById("mailhop.show_host").checked)) ; + pref.setCharPref("mail.mailHops.show_secure", String(document.getElementById("mailhop.show_secure").checked)) ; pref.setCharPref("mail.mailHops.show_spf", String(document.getElementById("mailhop.show_spf").checked)) ; pref.setCharPref("mail.mailHops.show_dkim", String(document.getElementById("mailhop.show_dkim").checked)) ; pref.setCharPref("mail.mailHops.show_mailer", String(document.getElementById("mailhop.show_mailer").checked)) ; diff --git a/chrome/content/preferences.xul b/chrome/content/preferences.xul index 10ea5a5..fb9bb66 100644 --- a/chrome/content/preferences.xul +++ b/chrome/content/preferences.xul @@ -44,11 +44,13 @@ + - - + + + diff --git a/chrome/skin/classic/mailhops.css b/chrome/skin/classic/mailhops.css index 7d73f6f..ed28af7 100644 --- a/chrome/skin/classic/mailhops.css +++ b/chrome/skin/classic/mailhops.css @@ -49,11 +49,40 @@ padding: 4px; } -.mailhopsWeather{ +.mailhopsWeather, .mailhopsHost, .mailhopsSecureHost, .mailhopsSecure{ margin-left: 30px; padding-bottom: 2px; } +.mailhopsSecureHost{ + background-image: url(chrome://mailhops/content/images/secure_host.png); + background-repeat: no-repeat; +} + +.mailhopsHost, .mailhopsHostPref{ + background-image: url(chrome://mailhops/content/images/host.png); + background-repeat: no-repeat; +} + +.mailhopsSecure, .mailhopsSecurePref{ + background-image: url(chrome://mailhops/content/images/secure.png); + background-repeat: no-repeat; +} + +.mailhopsWeatherPref{ + background-image: url(chrome://mailhops/content/images/weather/sun.png); + background-repeat: no-repeat; +} + +.mailhopsWeatherPref checkbox, .mailhopsHostPref checkbox, .mailhopsSecurePref checkbox{ + margin-left: 20px; + margin-top: 0px; +} + .auth-item{ display: none; } + +#mailhopsDataPaneMeta label{ + padding-left: 20px; +} \ No newline at end of file diff --git a/install.rdf b/install.rdf index d87a20c..2944f98 100644 --- a/install.rdf +++ b/install.rdf @@ -7,7 +7,7 @@ postbox@mailhops.com 2 MailHops - 0.7 + 0.7.1 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. chrome://mailhops/content/images/mailhops32.png http://mailhops.com diff --git a/mailhops-0.7-pb.xpi b/mailhops-0.7-pb.xpi new file mode 100644 index 0000000..b42c93e Binary files /dev/null and b/mailhops-0.7-pb.xpi differ diff --git a/mailhops-0.7.1-pb.xpi b/mailhops-0.7.1-pb.xpi new file mode 100644 index 0000000..a4a8946 Binary files /dev/null and b/mailhops-0.7.1-pb.xpi differ