Skip to content

Commit

Permalink
Add compatibility with older Thunderbird versions.
Browse files Browse the repository at this point in the history
This also reverts commit 01c133a "Remove unneeded prefs variable reassignments."
  • Loading branch information
moisseev committed Feb 2, 2016
1 parent 73e78d2 commit 75d7bfb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions chrome/content/scripts/column.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ var RspamdSpamnessColumn = {};

RspamdSpamnessColumn.handler = {
getCellText: function(row, col) {
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
if (prefs.getIntPref("extensions.rspamd-spamness.display.column") == 2)
return null;

Expand All @@ -22,6 +24,8 @@ RspamdSpamnessColumn.handler = {
getRowProperties: function(row, props) {},

getImageSrc: function(row, col) {
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
if (prefs.getIntPref("extensions.rspamd-spamness.display.column") == 1)
return null;

Expand Down
2 changes: 2 additions & 0 deletions chrome/content/scripts/messageHeader.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
RspamdSpamness.Message = {};

RspamdSpamness.Message.displayHeaders = function() {
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var showScore = prefs.getBoolPref("extensions.rspamd-spamness.display.messageScore");
var rowElScore = document.getElementById("expandedRspamdSpamnessRow");
var hdrElScore = document.getElementById("rspamdSpamnessScoreHeader");
Expand Down
6 changes: 4 additions & 2 deletions chrome/content/scripts/spamness-load.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
const myAddonId = 'rspamd-spamness@alexander.moisseev'

var optionObserver = {
observe(aSubject, aTopic, aData) {
observe: function(aSubject, aTopic, aData) {
if (aTopic !== 'addon-options-displayed' || aData !== myAddonId)
return;
var doc = aSubject;
var elem = doc.getElementById("advanced-options-button");
elem.addEventListener('command', this.eventHandler, true);
},
eventHandler(event) {
eventHandler: function(event) {
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var previousSpamnessHeader = prefs.getCharPref("extensions.rspamd-spamness.header").toLowerCase();
window.openDialog(
"chrome://rspamd-spamness/content/advancedOptions.xul", "",
Expand Down
2 changes: 2 additions & 0 deletions chrome/content/scripts/spamness.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ RspamdSpamness.getMetricClass = function(rule) {
}

RspamdSpamness.getHeaderStr = function(hdr) {
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch);
var header = prefs.getCharPref("extensions.rspamd-spamness.header").toLowerCase();
var headerStr = hdr.getStringProperty(header);
return (headerStr) ? headerStr : null;
Expand Down

0 comments on commit 75d7bfb

Please sign in to comment.