diff --git a/chrome/content/mailhops.js b/chrome/content/mailhops.js index 241bfa7..4e19502 100644 --- a/chrome/content/mailhops.js +++ b/chrome/content/mailhops.js @@ -13,10 +13,14 @@ var mailHops = resultContainerDetails: null, resultDetails: null, resultMapLink: null, - messageContainer: null, + mailhopsDataPaneSPF: null, + mailhopsDataPaneDKIM: null, + mailhopsDataPaneMailer: null, + mailhopsAuthContainer: null, isLoaded: false, showDetails: false, showWeather: false, + showAuth: true, map: 'goog', unit: 'mi', appVersion: 'MailHops Postbox 0.5' @@ -39,8 +43,10 @@ mailHops.init = function() mailHops.resultMapLink = document.getElementById ( "mailhopsDataPaneMapLink"); - mailHops.messageContainer = document.getElementById ( "message-container"); - + mailHops.mailhopsAuthContainer = document.getElementById ( "dataPaneMailHopsAuthContainer"); + mailHops.mailhopsDataPaneSPF = document.getElementById ( "mailhopsDataPaneSPF"); + mailHops.mailhopsDataPaneDKIM = document.getElementById ( "mailhopsDataPaneDKIM"); + mailHops.mailhopsDataPaneMailer = document.getElementById ( "mailhopsDataPaneMailer"); //event listner for route click to launch map mailHops.resultMapLink.addEventListener("click", function () { @@ -60,6 +66,7 @@ mailHops.init = function() } } , false); + }; mailHops.loadPref = function() @@ -69,6 +76,10 @@ mailHops.loadPref = function() mailHops.unit = mailHops.getCharPref('mail.mailHops.unit','mi'); mailHops.showDetails = mailHops.getCharPref('mail.mailHops.show_details','false')=='true'?true:false; mailHops.showWeather = mailHops.getCharPref('mail.mailHops.show_weather','false')=='true'?true:false; + mailHops.showAuth = mailHops.getCharPref('mail.mailHops.show_auth','true')=='true'?true:false; + + if(!mailHops.showAuth) + mailHops.mailhopsAuthContainer.style.display = 'none'; }; mailHops.StreamListener = @@ -140,6 +151,17 @@ var regexAllIp = /(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{ var headReceived = mailHops.headers.extractHeader ( "Received" , true ) ; var headXOrigIP = mailHops.headers.extractHeader ( "X-Originating-IP" , false ) ; + + var headXMailer = mailHops.headers.extractHeader ( "X-Mailer" , false ) ; + var headUserAgent = mailHops.headers.extractHeader ( "User-Agent" , false ) ; + var headReceivedSPF = mailHops.headers.extractHeader ( "Received-SPF" , false ) ; + var headAuth = mailHops.headers.extractHeader ( "Authentication-Results" , false ) ; + + + //display auth + if(mailHops.showAuth) + mailHops.displayResultAuth(headXMailer,headUserAgent,headAuth,headReceivedSPF); + var received_ips; var all_ips = new Array(); var rline=''; @@ -208,6 +230,107 @@ mailHops.testIP = function(ip,header){ return retval; }; +mailHops.displayResultAuth = function( header_xmailer, header_useragent, header_auth, header_spf ){ + + //SPF + if(header_spf){ + header_spf=header_spf.replace(/^\s+/,""); + var headerSPFArr=header_spf.split(' '); + mailHops.mailhopsDataPaneSPF.setAttribute('value','SPF: '+headerSPFArr[0]); + mailHops.mailhopsDataPaneSPF.style.backgroundImage = 'url(chrome://mailhops/content/images/auth/'+headerSPFArr[0]+'.png)'; + mailHops.mailhopsDataPaneSPF.setAttribute('tooltiptext',header_spf); + } + else{ + mailHops.mailhopsDataPaneSPF.setAttribute('value','SPF: Missing'); + mailHops.mailhopsDataPaneSPF.style.backgroundImage = 'url(chrome://mailhops/content/images/auth/none.png)'; + } + //Authentication-Results + //http://tools.ietf.org/html/rfc5451 + if(header_auth){ + var headerAuthArr=header_auth.split(';'); + var dkim_result; + for(var h=0;h - + - - + + - + + + + + + + + + + + + + + diff --git a/chrome/content/preferences.js b/chrome/content/preferences.js index d82fc38..342a1d3 100644 --- a/chrome/content/preferences.js +++ b/chrome/content/preferences.js @@ -26,6 +26,11 @@ var mailHopPreferences = document.getElementById("mailhop.show_weather").checked = true; else document.getElementById("mailhop.show_weather").checked = false; + + if(pref.getCharPref("mail.mailHops.show_auth",'true')=='true') + document.getElementById("mailhop.show_auth").checked = true; + else + document.getElementById("mailhop.show_auth").checked = false; } , savePreferences: function() @@ -34,5 +39,6 @@ var mailHopPreferences = 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_weather", String(document.getElementById("mailhop.show_weather").checked)) ; + pref.setCharPref("mail.mailHops.show_auth", String(document.getElementById("mailhop.show_auth").checked)) ; } } diff --git a/chrome/content/preferences.xul b/chrome/content/preferences.xul index 3af6321..0f45d3a 100644 --- a/chrome/content/preferences.xul +++ b/chrome/content/preferences.xul @@ -34,6 +34,7 @@ + diff --git a/chrome/skin/classic/mailhops.css b/chrome/skin/classic/mailhops.css index ff1cdf0..b28c796 100644 --- a/chrome/skin/classic/mailhops.css +++ b/chrome/skin/classic/mailhops.css @@ -24,6 +24,14 @@ padding-right: 14px; } +#dataPaneMailHopsAuthContainer{ + display: none; +} + +#mailhopsDataPane{ + padding-bottom: 4px; +} + .mailhopsDetail{ padding-bottom: 2px; } @@ -32,24 +40,16 @@ padding-bottom: 4px; } -#mailhopsDetailsContainer{ +.mailhopsContainer{ margin-left: 10px; margin-right: 10px; - display: none; border: 1px solid #e1e2e5; background-color: #f7f8f9; -moz-border-radius: 5px; -webkit-border-radius: 5px; -khtml-border-radius: 5px; border-radius: 5px; -} - -#mailhopsDataPaneDetails{ - padding: 4px; -} - -#mailhopsDataPane{ - padding-bottom: 4px; + padding: 4px; } .mailhopsWeather{