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

Added host and fixed not showing duplicate ips

This commit is contained in:
Andrew Van Tassel 2012-03-01 23:59:41 -07:00
parent 184f573083
commit d2858eb09c
5 changed files with 37 additions and 18 deletions

View File

@ -22,9 +22,10 @@ var mailHops =
isLoaded: false, isLoaded: false,
showDetails: false, showDetails: false,
showWeather: false, showWeather: false,
showHost: false,
map: 'goog', map: 'goog',
unit: 'mi', unit: 'mi',
appVersion: 'MailHops Postbox 0.6.9' appVersion: 'MailHops Postbox 0.6.9.2'
} }
mailHops.init = function() mailHops.init = function()
@ -72,7 +73,7 @@ mailHops.init = function()
, false); , false);
mailHops.mailhopsDataPaneDNSBL.addEventListener("click", function () { mailHops.mailhopsDataPaneDNSBL.addEventListener("click", function () {
var ip = this.getAttribute('ip'); var ip = this.getAttribute('data-ip');
mailHops.launchSpamHausURL(ip); mailHops.launchSpamHausURL(ip);
} }
, false); , false);
@ -86,6 +87,7 @@ mailHops.loadPref = function()
mailHops.unit = mailHops.getCharPref('mail.mailHops.unit','mi'); mailHops.unit = mailHops.getCharPref('mail.mailHops.unit','mi');
mailHops.showDetails = mailHops.getCharPref('mail.mailHops.show_details','false')=='true'?true:false; 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.showWeather = mailHops.getCharPref('mail.mailHops.show_weather','false')=='true'?true:false;
mailHops.showHost = mailHops.getCharPref('mail.mailHops.show_host','false')=='true'?true:false;
}; };
mailHops.StreamListener = mailHops.StreamListener =
@ -190,12 +192,12 @@ var regexAllIp = /(1\d{0,2}|2(?:[0-4]\d{0,1}|[6789]|5[0-5]?)?|[3-9]\d?|0)\.(1\d{
if(received_ips != null && received_ips.length !=0){ if(received_ips != null && received_ips.length !=0){
for( var r=0; r<received_ips.length; r++ ){ for( var r=0; r<received_ips.length; r++ ){
//only look at the first IP //only look at the first IP
if(regexIp.test(received_ips[r]) && all_ips.indexOf(received_ips[r])==-1 && mailHops.testIP(received_ips[r],rline)){ if(regexIp.test(received_ips[r]) && mailHops.testIP(received_ips[r],rline)){
all_ips.unshift( received_ips[r] ); all_ips.unshift( received_ips[r] );
break; break;
} }
} }
} }
//reset the line //reset the line
rline=''; rline='';
} }
@ -257,7 +259,6 @@ mailHops.displayResultLists = function( header_unsubscribe ){
if(href.indexOf('mailto:')!=-1){ if(href.indexOf('mailto:')!=-1){
label.setAttribute('value','Unsubscribe via Email'); label.setAttribute('value','Unsubscribe via Email');
if(href.toLowerCase().indexOf('subject=')==-1){ if(href.toLowerCase().indexOf('subject=')==-1){
if(href.indexOf('?')==-1) if(href.indexOf('?')==-1)
href+='?subject=Unsubscribe'; href+='?subject=Unsubscribe';
@ -266,8 +267,9 @@ mailHops.displayResultLists = function( header_unsubscribe ){
} }
} }
else{ else{
label.setAttribute('value','Unsubscribe'); label.setAttribute('value','Unsubscribe via Web');
} }
label.setAttribute('tooltiptext',href);
label.setAttribute('href',href); label.setAttribute('href',href);
mailHops.resultListDataPane.appendChild(label); mailHops.resultListDataPane.appendChild(label);
} }
@ -535,18 +537,28 @@ mailHops.displayResult = function ( header_route, response ){
//build tooltip //build tooltip
var tiptext = response.route[i].ip; var tiptext = response.route[i].ip;
if(response.route[i].host)
tiptext+=' '+response.route[i].host; if(!mailHops.showHost){
if(response.route[i].whois && response.route[i].whois.descr) if(response.route[i].host)
tiptext+=' '+response.route[i].whois.descr; tiptext+=' '+response.route[i].host;
if(response.route[i].whois && response.route[i].whois.netname) if(response.route[i].whois && response.route[i].whois.descr)
tiptext+=' '+response.route[i].whois.netname; tiptext+=' '+response.route[i].whois.descr;
if(response.route[i].whois && response.route[i].whois.netname)
tiptext+=' '+response.route[i].whois.netname;
}
label.setAttribute('tooltiptext','Click for whois '+tiptext); label.setAttribute('tooltiptext','Click for whois '+tiptext);
//append details //append details
mailHops.resultDetails.appendChild(label); mailHops.resultDetails.appendChild(label);
//append host
if(mailHops.showHost && response.route[i].host){
var host = document.createElement('label');
host.setAttribute('value',response.route[i].host);
mailHops.resultDetails.appendChild(host);
}
//append weather //append weather
if(mailHops.showWeather && response.route[i].weather){ if(mailHops.showWeather && response.route[i].weather){
var weather = document.createElement('label'); var weather = document.createElement('label');
@ -569,7 +581,7 @@ mailHops.displayResult = function ( header_route, response ){
//auth & dnsbl //auth & dnsbl
if(!response.route[i].private && response.route[i].dnsbl && response.route[i].dnsbl.listed){ if(!response.route[i].private && response.route[i].dnsbl && response.route[i].dnsbl.listed){
mailHops.mailhopsDataPaneDNSBL.setAttribute('value','Blacklisted '+mailHops.authExplainDNSBL_server(response.route[i].dnsbl.record)); mailHops.mailhopsDataPaneDNSBL.setAttribute('value','Blacklisted '+mailHops.authExplainDNSBL_server(response.route[i].dnsbl.record));
mailHops.mailhopsDataPaneDNSBL.setAttribute('ip',response.route[i].ip); mailHops.mailhopsDataPaneDNSBL.setAttribute('data-ip',response.route[i].ip);
if(response.route[i].dnsbl.record) if(response.route[i].dnsbl.record)
mailHops.mailhopsDataPaneDNSBL.setAttribute('tooltiptext','Click for more details.\n'+mailHops.authExplainDNSBL(response.route[i].dnsbl.record)); mailHops.mailhopsDataPaneDNSBL.setAttribute('tooltiptext','Click for more details.\n'+mailHops.authExplainDNSBL(response.route[i].dnsbl.record));
else else

View File

@ -27,6 +27,11 @@ var mailHopPreferences =
else else
document.getElementById("mailhop.show_weather").checked = false; document.getElementById("mailhop.show_weather").checked = false;
if(pref.getCharPref("mail.mailHops.show_host",'false')=='true')
document.getElementById("mailhop.show_host").checked = true;
else
document.getElementById("mailhop.show_host").checked = false;
} , } ,
savePreferences: function() savePreferences: function()
{ {
@ -34,5 +39,6 @@ var mailHopPreferences =
pref.setCharPref("mail.mailHops.unit", document.getElementById("mailhop.unit").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_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_weather", String(document.getElementById("mailhop.show_weather").checked)) ;
pref.setCharPref("mail.mailHops.show_host", String(document.getElementById("mailhop.show_host").checked)) ;
} }
} }

View File

@ -34,6 +34,7 @@
<caption label="Display Options"/> <caption label="Display Options"/>
<checkbox id="mailhop.show_details" label="Show Details" checked="false"/> <checkbox id="mailhop.show_details" label="Show Details" checked="false"/>
<checkbox id="mailhop.show_weather" label="Show Weather" checked="false"/> <checkbox id="mailhop.show_weather" label="Show Weather" checked="false"/>
<checkbox id="mailhop.show_host" label="Show Host" checked="false"/>
</groupbox> </groupbox>
</vbox> </vbox>

View File

@ -7,7 +7,7 @@
<em:id>postbox@mailhops.com</em:id> <em:id>postbox@mailhops.com</em:id>
<em:type>2</em:type> <em:type>2</em:type>
<em:name>MailHops</em:name> <em:name>MailHops</em:name>
<em:version>0.6.9</em:version> <em:version>0.6.9.2</em:version>
<em:description>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.</em:description> <em:description>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.</em:description>
<em:iconURL>chrome://mailhops/content/images/mailhops32.png</em:iconURL> <em:iconURL>chrome://mailhops/content/images/mailhops32.png</em:iconURL>
<em:homepageURL>http://mailhops.com</em:homepageURL> <em:homepageURL>http://mailhops.com</em:homepageURL>

Binary file not shown.