mirror of
https://github.com/MailHops/mailhops-plugin.git
synced 2025-05-17 14:50:08 -07:00
Added country column in message list
This commit is contained in:
parent
e5efbd1c15
commit
e995ae30f4
@ -1,5 +1,10 @@
|
|||||||
# Change Log
|
# Change Log
|
||||||
|
|
||||||
|
## 3.2 - 2019-04-03
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Country column to message list
|
||||||
|
|
||||||
## 3.1.4 - 2017-07-24
|
## 3.1.4 - 2017-07-24
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
@ -10,8 +10,9 @@ locale mailhops pt-BR jar:chrome/mailhops.jar!/locale/pt-BR/
|
|||||||
locale mailhops ru jar:chrome/mailhops.jar!/locale/ru/
|
locale mailhops ru jar:chrome/mailhops.jar!/locale/ru/
|
||||||
locale mailhops zh-CN jar:chrome/mailhops.jar!/locale/zh-CN/
|
locale mailhops zh-CN jar:chrome/mailhops.jar!/locale/zh-CN/
|
||||||
|
|
||||||
# Postbox
|
# Postbox 5
|
||||||
overlay chrome://messenger/content/mailWindowOverlay.xul chrome://mailhops/content/msgNotificationBar.xul application=postbox@postbox-inc.com
|
overlay chrome://messenger/content/mailWindowOverlay.xul chrome://mailhops/content/msgNotificationBar.xul application=postbox@postbox-inc.com
|
||||||
|
|
||||||
# Thunberbird
|
# Thunberbird
|
||||||
overlay chrome://messenger/content/mailWindowOverlay.xul chrome://mailhops/content/msgNotificationBar.xul application={3550f703-e582-4d05-9a08-453d09bdfdc6}
|
overlay chrome://messenger/content/mailWindowOverlay.xul chrome://mailhops/content/msgNotificationBar.xul application={3550f703-e582-4d05-9a08-453d09bdfdc6}
|
||||||
|
overlay chrome://messenger/content/messenger.xul chrome://mailhops/content/msgListColumn.xul application={3550f703-e582-4d05-9a08-453d09bdfdc6}
|
@ -405,7 +405,7 @@ mailHops.LOG(lookupURL);
|
|||||||
var d = new Date();
|
var d = new Date();
|
||||||
data.meta.cached = d.toISOString();
|
data.meta.cached = d.toISOString();
|
||||||
//save the result
|
//save the result
|
||||||
mailHops.saveResults(JSON.stringify(data),data.response.route);
|
mailHops.saveResults(data, data.response.route);
|
||||||
//display the result
|
//display the result
|
||||||
mailHopsDisplay.route(header_route, mailHops.message, data.response, data.meta, lookupURL);
|
mailHopsDisplay.route(header_route, mailHops.message, data.response, data.meta, lookupURL);
|
||||||
} else if(data.error){
|
} else if(data.error){
|
||||||
@ -422,7 +422,7 @@ mailHops.LOG(lookupURL);
|
|||||||
xmlhttp.send(null);
|
xmlhttp.send(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
mailHops.saveResults = function(results,route){
|
mailHops.saveResults = function(results, route){
|
||||||
|
|
||||||
if(!mailHops.msgURI)
|
if(!mailHops.msgURI)
|
||||||
return false;
|
return false;
|
||||||
@ -433,12 +433,22 @@ mailHops.saveResults = function(results,route){
|
|||||||
if(!msgHdr)
|
if(!msgHdr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
msgHdr.setStringProperty( "MH-Route", results );
|
if(!results){
|
||||||
|
msgHdr.setStringProperty( "MH-Route", '' );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var countryCode = mailHopsUtils.getOriginatingCountryCode(route);
|
||||||
|
|
||||||
|
if(!!countryCode){
|
||||||
|
results.sender = { countryCode: countryCode };
|
||||||
|
}
|
||||||
|
|
||||||
|
msgHdr.setStringProperty( "MH-Route", JSON.stringify(results) );
|
||||||
|
|
||||||
//Add tag
|
//Add tag
|
||||||
if(!!route && !!mailHops.options.api_key){
|
if(!!countryCode && !!mailHops.options.api_key){
|
||||||
try {
|
try {
|
||||||
var countryCode = mailHopsUtils.getOriginatingCountryCode(route);
|
|
||||||
var msg = Components.classes["@mozilla.org/array;1"].createInstance(Components.interfaces.nsIMutableArray);
|
var msg = Components.classes["@mozilla.org/array;1"].createInstance(Components.interfaces.nsIMutableArray);
|
||||||
msg.clear();
|
msg.clear();
|
||||||
msg.appendElement(msgHdr, false);
|
msg.appendElement(msgHdr, false);
|
||||||
@ -488,8 +498,8 @@ mailHops.getResults = function(){
|
|||||||
};
|
};
|
||||||
|
|
||||||
mailHops.refreshCache = function(){
|
mailHops.refreshCache = function(){
|
||||||
mailHops.saveResults('');
|
mailHops.saveResults();
|
||||||
mailHops.getRoute();
|
mailHops.getRoute();
|
||||||
};
|
};
|
||||||
|
|
||||||
addEventListener ( "messagepane-loaded" , mailHops.setupEventListener , true ) ;
|
addEventListener( "messagepane-loaded" , mailHops.setupEventListener , true );
|
70
chrome/content/msgListColumn.js
Normal file
70
chrome/content/msgListColumn.js
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
var columnHandler = {
|
||||||
|
getCellText: function(row, col) {return null;},
|
||||||
|
getSortStringForRow: function(msgHdr) {
|
||||||
|
msgHdr.getStringProperty( "MH-Route" );
|
||||||
|
var countryCode = null;
|
||||||
|
var cached_results = msgHdr.getStringProperty( "MH-Route" );
|
||||||
|
if(cached_results){
|
||||||
|
try {
|
||||||
|
cached_results = JSON.parse(cached_results);
|
||||||
|
if(cached_results.sender && cached_results.sender.countryCode){
|
||||||
|
countryCode = cached_results.sender.countryCode;
|
||||||
|
} else {
|
||||||
|
countryCode = mailHopsUtils.getOriginatingCountryCode(cached_results.response.route);
|
||||||
|
}
|
||||||
|
if(countryCode){
|
||||||
|
return 'chrome://mailhops/content/images/flags/'+countryCode.toLowerCase()+'.png';
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
return countryCode;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return countryCode;
|
||||||
|
},
|
||||||
|
isString: function() {return true;},
|
||||||
|
|
||||||
|
getCellProperties: function(row, col, props){},
|
||||||
|
getRowProperties: function(row, props){},
|
||||||
|
getImageSrc: function(row, col) {
|
||||||
|
var msgKey = gDBView.getKeyAt(row);
|
||||||
|
var msgHdr = gDBView.db.GetMsgHdrForKey(msgKey);
|
||||||
|
var countryCode = null;
|
||||||
|
var cached_results = msgHdr.getStringProperty( "MH-Route" );
|
||||||
|
if(cached_results){
|
||||||
|
try {
|
||||||
|
cached_results = JSON.parse(cached_results);
|
||||||
|
if(cached_results.sender && cached_results.sender.countryCode){
|
||||||
|
countryCode = cached_results.sender.countryCode;
|
||||||
|
} else {
|
||||||
|
countryCode = mailHopsUtils.getOriginatingCountryCode(cached_results.response.route);
|
||||||
|
}
|
||||||
|
if(countryCode){
|
||||||
|
return 'chrome://mailhops/content/images/flags/'+countryCode.toLowerCase()+'.png';
|
||||||
|
}
|
||||||
|
} catch(e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
getSortLongForRow: function(hdr) {return 0;}
|
||||||
|
};
|
||||||
|
|
||||||
|
var CreateDbObserver = {
|
||||||
|
// Components.interfaces.nsIObserver
|
||||||
|
observe: function(aMsgFolder, aTopic, aData)
|
||||||
|
{
|
||||||
|
addCustomColumnHandler();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function doOnceLoaded() {
|
||||||
|
var ObserverService = Components.classes["@mozilla.org/observer-service;1"].getService(Components.interfaces.nsIObserverService);
|
||||||
|
ObserverService.addObserver(CreateDbObserver, "MsgCreateDBView", false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function addCustomColumnHandler() {
|
||||||
|
gDBView.addColumnHandler("colMailHops", columnHandler);
|
||||||
|
}
|
||||||
|
|
||||||
|
addEventListener( "load", doOnceLoaded, false );
|
16
chrome/content/msgListColumn.xul
Normal file
16
chrome/content/msgListColumn.xul
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<overlay id="mailhops_listcolumn"
|
||||||
|
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||||
|
<tree id="threadTree">
|
||||||
|
<treecols id="threadCols">
|
||||||
|
<splitter class="tree-splitter" />
|
||||||
|
<treecol id="colMailHops" persist="hidden ordinal width"
|
||||||
|
currentView="unthreaded" flex="2"
|
||||||
|
label="Country" tooltiptext="Click to sort by Country" />
|
||||||
|
</treecols>
|
||||||
|
</tree>
|
||||||
|
|
||||||
|
<!-- include our javascript file -->
|
||||||
|
<script type="application/x-javascript" src="chrome://mailhops/content/utils.js"/>
|
||||||
|
<script type="application/x-javascript" src="chrome://mailhops/content/msgListColumn.js"/>
|
||||||
|
</overlay>
|
@ -70,7 +70,7 @@ var mailHopPreferences = {
|
|||||||
}
|
}
|
||||||
if(!!this.api_key.value.trim()){
|
if(!!this.api_key.value.trim()){
|
||||||
document.getElementById("mailhops-membership-link").value='My Account';
|
document.getElementById("mailhops-membership-link").value='My Account';
|
||||||
document.getElementById("mailhops-membership-link").setAttribute('data-account-url','https://mailhops.com/account/'+this.api_key.value.trim());
|
document.getElementById("mailhops-membership-link").setAttribute('href','https://mailhops.com/account/'+this.api_key.value.trim());
|
||||||
}
|
}
|
||||||
if(pref.getCharPref("mail.mailHops.country_tag",'false')=='false')
|
if(pref.getCharPref("mail.mailHops.country_tag",'false')=='false')
|
||||||
document.getElementById("mailhop.country_tag").checked = false;
|
document.getElementById("mailhop.country_tag").checked = false;
|
||||||
@ -87,10 +87,6 @@ var mailHopPreferences = {
|
|||||||
else
|
else
|
||||||
document.getElementById("mailhop.hide_compact").checked = true;
|
document.getElementById("mailhop.hide_compact").checked = true;
|
||||||
|
|
||||||
document.getElementById("mailhops-membership-link").addEventListener("click", function () {
|
|
||||||
mailHopsUtils.launchExternalURL(this.getAttribute('data-account-url'));
|
|
||||||
});
|
|
||||||
|
|
||||||
this.saveAPIKey();
|
this.saveAPIKey();
|
||||||
|
|
||||||
document.getElementById("mailhop.bar_color").addEventListener("input", function () {
|
document.getElementById("mailhop.bar_color").addEventListener("input", function () {
|
||||||
@ -152,11 +148,17 @@ var mailHopPreferences = {
|
|||||||
document.getElementById("rate-remaining").value='';
|
document.getElementById("rate-remaining").value='';
|
||||||
document.getElementById("rate-reset").value='';
|
document.getElementById("rate-reset").value='';
|
||||||
document.getElementById("mailhops-membership-link").value='Join MailHops';
|
document.getElementById("mailhops-membership-link").value='Join MailHops';
|
||||||
document.getElementById("mailhops-membership-link").setAttribute('data-account-url','https://mailhops.com');
|
document.getElementById("mailhops-membership-link").setAttribute('href','https://mailhops.com');
|
||||||
var items = document.getElementsByClassName('filters');
|
var items = document.getElementsByClassName('filters');
|
||||||
for(x in items){ items[x].disabled = true; }
|
for(x in items){
|
||||||
|
items[x].disabled = true;
|
||||||
|
}
|
||||||
var items = document.getElementsByClassName('country');
|
var items = document.getElementsByClassName('country');
|
||||||
for(x in items){ items[x].disabled = true; if(items[x].label) items[x].label = items[x].label.toUpperCase();}
|
for(x in items){
|
||||||
|
items[x].disabled = true;
|
||||||
|
if(items[x].label)
|
||||||
|
items[x].label = items[x].label.toUpperCase();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
saveAPIKey: function() {
|
saveAPIKey: function() {
|
||||||
|
|
||||||
@ -185,7 +187,7 @@ var mailHopPreferences = {
|
|||||||
else
|
else
|
||||||
document.getElementById("rate-reset").value = "Resets in: "+Math.round(data.account.rate.reset/60/60)+" hr.";
|
document.getElementById("rate-reset").value = "Resets in: "+Math.round(data.account.rate.reset/60/60)+" hr.";
|
||||||
document.getElementById("mailhops-membership-link").value='My Account';
|
document.getElementById("mailhops-membership-link").value='My Account';
|
||||||
document.getElementById("mailhops-membership-link").setAttribute('data-account-url','https://mailhops.com/account/'+api_key);
|
document.getElementById("mailhops-membership-link").setAttribute('href','https://mailhops.com/account/'+api_key);
|
||||||
|
|
||||||
var items = document.getElementsByClassName('filters');
|
var items = document.getElementsByClassName('filters');
|
||||||
for(x in items){ items[x].disabled = false;}
|
for(x in items){ items[x].disabled = false;}
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
<groupbox flex="1">
|
<groupbox flex="1">
|
||||||
<caption label="MailHops &mailhops_tab_member_label;"/>
|
<caption label="MailHops &mailhops_tab_member_label;"/>
|
||||||
<description>
|
<description>
|
||||||
API Key <label id="mailhops-membership-link" class="text-link plain" value="Join MailHops" data-account-url="https://mailhops.com"/>
|
API Key <label id="mailhops-membership-link" class="text-link plain" value="Join MailHops" href="https://mailhops.com"/>
|
||||||
</description>
|
</description>
|
||||||
<hbox align="center">
|
<hbox align="center">
|
||||||
<textbox id="mailhop.api_key" placeholder="Enter your MailHops API Member Key" width="500"/>
|
<textbox id="mailhop.api_key" placeholder="Enter your MailHops API Member Key" width="500"/>
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
<Description about="urn:mozilla:install-manifest">
|
<Description about="urn:mozilla:install-manifest">
|
||||||
<em:type>2</em:type>
|
<em:type>2</em:type>
|
||||||
<em:id>thunderbird@mailhops.com</em:id>
|
<em:id>thunderbird@mailhops.com</em:id>
|
||||||
<em:version>3.1.8</em:version>
|
<em:version>3.2.0</em:version>
|
||||||
|
|
||||||
<em:name>MailHops</em:name>
|
<em:name>MailHops</em:name>
|
||||||
<em:description>MailHops maps the route an email took to get to you. Displaying the senders location, weather, user-agent and authentication used.</em:description>
|
<em:description>MailHops maps the route an email took to get to you. Displaying the senders location, weather, user-agent and authentication used.</em:description>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user