[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [torbirdy/master] Enhanced global namespace pollution and removed redundant code
commit bd42cc61e7d41e408647c8448cac26996b4aac18
Author: Sukhbir Singh <sukhbir@xxxxxxxxxxxxxx>
Date: Sun Sep 8 22:32:44 2013 -0400
Enhanced global namespace pollution and removed redundant code
---
chrome/content/accountpref.js | 73 +++--
chrome/content/emailwizard.js | 64 +++--
chrome/content/firstruninfo.js | 8 +-
chrome/content/overlay.js | 132 ++++-----
chrome/content/preferences.js | 583 ++++++++++++++++++++--------------------
5 files changed, 431 insertions(+), 429 deletions(-)
diff --git a/chrome/content/accountpref.js b/chrome/content/accountpref.js
index 754abaa..bea512d 100644
--- a/chrome/content/accountpref.js
+++ b/chrome/content/accountpref.js
@@ -1,56 +1,55 @@
if (!org) var org = {};
if (!org.torbirdy) org.torbirdy = {};
-org.torbirdy.accountprefs = new function() {
- var pub = {};
- pub.account = window.arguments[0];
-
- pub.onLoad = function() {
- pub.nameLabel = document.getElementById("torbirdy-account-name");
- pub.startup = document.getElementById("torbirdy-check-startup");
- pub.dobiff = document.getElementById("torbirdy-check-new");
- pub.biffminutes = document.getElementById("torbirdy-check-minutes");
- pub.nameLabel.value = pub.account.prettyName;
-
- if (pub.account.loginAtStartUp) {
- pub.startup.checked = true;
+if (!org.torbirdy.accountprefs) org.torbirdy.accountprefs = {
+
+ account: window.arguments[0],
+
+ onLoad: function() {
+ var nameLabel = document.getElementById("torbirdy-account-name");
+ this.startup = document.getElementById("torbirdy-check-startup");
+ this.dobiff = document.getElementById("torbirdy-check-new");
+ this.biffminutes = document.getElementById("torbirdy-check-minutes");
+ nameLabel.value = this.account.prettyName;
+
+ if (this.account.loginAtStartUp) {
+ this.startup.checked = true;
} else {
- pub.startup.checked = false;
+ this.startup.checked = false;
}
- if (pub.account.doBiff) {
- pub.dobiff.checked = true;
- pub.biffminutes.disabled = false;
- pub.biffminutes.value = pub.account.biffMinutes;
+ if (this.account.doBiff) {
+ this.dobiff.checked = true;
+ this.biffminutes.disabled = false;
+ this.biffminutes.value = this.account.biffMinutes;
} else {
- pub.dobiff.checked = false;
- pub.biffminutes.disabled = true;
- pub.biffminutes.value = pub.account.biffMinutes;
+ this.dobiff.checked = false;
+ this.biffminutes.disabled = true;
+ this.biffminutes.value = this.account.biffMinutes;
}
- };
+ },
- pub.onAccept = function() {
- if (pub.startup.checked) {
- pub.account.loginAtStartUp = true;
+ onAccept: function() {
+ if (this.startup.checked) {
+ this.account.loginAtStartUp = true;
} else {
- pub.account.loginAtStartUp = false;
+ this.account.loginAtStartUp = false;
}
- if (pub.dobiff.checked) {
- pub.account.doBiff = true;
- pub.account.biffMinutes = pub.biffminutes.value;
+ if (this.dobiff.checked) {
+ this.account.doBiff = true;
+ this.account.biffMinutes = this.biffminutes.value;
} else {
- pub.account.doBiff = false;
+ this.account.doBiff = false;
}
- };
+ },
- pub.onToggleCheck = function() {
- if (pub.biffminutes.disabled) {
- pub.biffminutes.disabled = false;
+ onToggleCheck: function() {
+ if (this.biffminutes.disabled) {
+ this.biffminutes.disabled = false;
} else {
- pub.biffminutes.disabled = true;
+ this.biffminutes.disabled = true;
}
- };
+ }
- return pub;
};
diff --git a/chrome/content/emailwizard.js b/chrome/content/emailwizard.js
index 4be26f2..9142ac4 100644
--- a/chrome/content/emailwizard.js
+++ b/chrome/content/emailwizard.js
@@ -1,32 +1,17 @@
if (!org) var org = {};
if (!org.torbirdy) org.torbirdy = {};
-org.torbirdy.emailwizard = new function() {
- var pub = {};
-
- var prefs = Cc["@mozilla.org/preferences-service;1"]
- .getService(Ci.nsIPrefBranch);
-
- // Check if we are running Tails. If yes, disable the manual account
- // configuration wizard since Tails handles that on its own. See:
- // https://tails.boum.org/todo/Return_of_Icedove__63__/#index6h2
- // This is also disabled if "extensions.torbirdy.emailwizard" is true.
- var disableWizard = false;
- if (prefs.prefHasUserValue("vendor.name")) {
- if (prefs.getCharPref("vendor.name") === "Tails") {
- disableWizard = true;
- }
- }
- if (prefs.getBoolPref("extensions.torbirdy.emailwizard")) {
- disableWizard = true;
- }
+if (!org.torbirdy.emailwizard) org.torbirdy.emailwizard = {
+
+ prefs: Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefBranch),
- pub.disableAutoWizard = function() {
- if (!disableWizard) {
+ disableAutoWizard: function() {
+ if (!this.disableWizard) {
var realname = document.getElementById("realname").value;
var email = document.getElementById("email").value;
var password = document.getElementById("password").value;
- var remember_password = document.getElementById("remember_password").checked;
+ var rememberPassword = document.getElementById("remember_password").checked;
var protocol = document.getElementById("torbirdy-protocol").value;
var prompts = Cc["@mozilla.org/embedcomp/prompt-service;1"]
@@ -73,7 +58,7 @@ org.torbirdy.emailwizard = new function() {
config.outgoing.hostname = "smtp.%EMAILDOMAIN%";
replaceVariables(config, realname, email, password);
- config.rememberPassword = remember_password && !!password;
+ config.rememberPassword = rememberPassword && !!password;
var newAccount = createAccountInBackend(config);
@@ -81,7 +66,7 @@ org.torbirdy.emailwizard = new function() {
const checkNewMail = 'mail.server.%serverkey%.check_new_mail';
const serverkey = newAccount.incomingServer.key;
var checkNewMailPref = checkNewMail.replace("%serverkey%", serverkey);
- prefs.setBoolPref(checkNewMailPref, false);
+ this.prefs.setBoolPref(checkNewMailPref, false);
// From comm-release/mailnews/base/prefs/content/accountcreation/emailWizard.js : onAdvancedSetup().
var windowManager = Cc["@mozilla.org/appshell/window-mediator;1"]
@@ -101,30 +86,43 @@ org.torbirdy.emailwizard = new function() {
else {
gEmailConfigWizard.onNext();
}
- };
+ },
- pub.onKeyEnter = function(event) {
+ onKeyEnter: function(event) {
var keycode = event.keyCode;
if (keycode == 13) {
if (document.getElementById("next_button").disabled === false) {
- if (!disableWizard) {
- pub.disableAutoWizard();
+ if (!this.disableWizard) {
+ this.disableAutoWizard();
}
else {
gEmailConfigWizard.onNext();
}
}
}
- };
+ },
+
+ onLoad: function() {
+ // Check if we are running Tails. If yes, disable the manual account
+ // configuration wizard since Tails handles that on its own. See:
+ // https://tails.boum.org/todo/Return_of_Icedove__63__/#index6h2
+ // This is also disabled if "extensions.torbirdy.emailwizard" is true.
+ this.disableWizard = false;
+ if (this.prefs.prefHasUserValue("vendor.name")) {
+ if (this.prefs.getCharPref("vendor.name") === "Tails") {
+ this.disableWizard = true;
+ }
+ }
+ if (this.prefs.getBoolPref("extensions.torbirdy.emailwizard")) {
+ this.disableWizard = true;
+ }
- pub.onLoad = function() {
document.getElementById("provisioner_button").disabled = true;
- if (disableWizard) {
+ if (this.disableWizard) {
document.getElementById("torbirdy-protocol-box").collapsed = true;
}
- };
+ }
- return pub;
};
window.addEventListener("keypress", org.torbirdy.emailwizard.onKeyEnter, true);
diff --git a/chrome/content/firstruninfo.js b/chrome/content/firstruninfo.js
index 91f7c10..6574529 100644
--- a/chrome/content/firstruninfo.js
+++ b/chrome/content/firstruninfo.js
@@ -1,10 +1,9 @@
if (!org) var org = {};
if (!org.torbirdy) org.torbirdy = {};
-org.torbirdy.firstrun = new function() {
- var pub = {};
+if (!org.torbirdy.firstrun) org.torbirdy.firstrun = {
- pub.onLoad = function() {
+ onLoad: function() {
var strings = document.getElementById("torbirdy-strings-firstrun");
var description = document.getElementById("torbirdy-firstrun-info");
@@ -13,7 +12,6 @@ org.torbirdy.firstrun = new function() {
var torbirdyWebsite = strings.getString("torbirdy.website");
var website = document.getElementById("torbirdy-website");
website.value = torbirdyWebsite;
- };
+ }
- return pub;
};
diff --git a/chrome/content/overlay.js b/chrome/content/overlay.js
index 41e6684..0b3dd2e 100644
--- a/chrome/content/overlay.js
+++ b/chrome/content/overlay.js
@@ -1,6 +1,12 @@
-(function initOverlayWindow() {
- var prefs = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
+(function() {
+ const Cc = Components.classes;
+ const Ci = Components.interfaces;
+
+ var prefs = Cc["@mozilla.org/preferences-service;1"]
+ .getService(Ci.nsIPrefBranch);
+ var env = Cc["@mozilla.org/process/environment;1"]
+ .getService(Ci.nsIEnvironment);
+
if (!(prefs.getBoolPref('extensions.torbirdy.startup_folder'))) {
window.loadStartFolder = function() {
var startupFolder = GetMsgFolderFromUri("mailbox://nobody@Local%20Folders");
@@ -11,74 +17,72 @@
}
};
}
-})();
-function torbirdyStartup() {
- var prefs = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
- var env = Components.classes["@mozilla.org/process/environment;1"]
- .getService(Components.interfaces.nsIEnvironment);
-
- var infoRun = "extensions.torbirdy.info_run";
- if (prefs.getBoolPref(infoRun)) {
- window.open("chrome://castironthunderbirdclub/content/firstruninfo.xul",
- "FirstRunWindow",
- "chrome, dialog, centerscreen, resizable=no");
- prefs.setBoolPref(infoRun, false);
- }
+ window.TorBirdy = {
+ onLoad: function() {
+ var infoRun = "extensions.torbirdy.info_run";
+ if (prefs.getBoolPref(infoRun)) {
+ window.open("chrome://castironthunderbirdclub/content/firstruninfo.xul",
+ "FirstRunWindow",
+ "chrome, dialog, centerscreen, resizable=no");
+ prefs.setBoolPref(infoRun, false);
+ }
- // Set the time zone to UTC if the preference is true.
- if (prefs.getBoolPref("extensions.torbirdy.timezone")) {
- env.set('TZ', 'UTC');
- }
+ // Set the time zone to UTC if the preference is true.
+ if (prefs.getBoolPref("extensions.torbirdy.timezone")) {
+ env.set('TZ', 'UTC');
+ }
- // Check if we are running Whonix.
- var whonix = false;
- if (env.exists("WHONIX")) {
- whonix = true;
- }
+ // Check if we are running Whonix.
+ var whonix = false;
+ if (env.exists("WHONIX")) {
+ whonix = true;
+ }
- var myPanel = document.getElementById("torbirdy-my-panel");
- var strbundle = document.getElementById("torbirdy-strings-overlay");
+ var myPanel = document.getElementById("torbirdy-my-panel");
+ var strbundle = document.getElementById("torbirdy-strings-overlay");
- // If all other preferences have been set in `components/torbirdy.js'
- if (prefs.getBoolPref("extensions.torbirdy.protected")) {
- var type = prefs.getIntPref("extensions.torbirdy.proxy");
- myPanel.style.color = "green";
+ // If all other preferences have been set in `components/torbirdy.js'
+ if (prefs.getBoolPref("extensions.torbirdy.protected")) {
+ var type = prefs.getIntPref("extensions.torbirdy.proxy");
+ myPanel.style.color = "green";
- // Tor.
- if (type === 0) {
- myPanel.label = strbundle.getString("torbirdy.enabled.tor");
- }
- // JonDo/Whonix.
- if (type === 1) {
- if (prefs.getIntPref("extensions.torbirdy.proxy.type") === 0) {
- myPanel.label = strbundle.getString("torbirdy.enabled.jondo");
+ // Tor.
+ if (type === 0) {
+ myPanel.label = strbundle.getString("torbirdy.enabled.tor");
+ }
+ // JonDo/Whonix.
+ if (type === 1) {
+ if (prefs.getIntPref("extensions.torbirdy.proxy.type") === 0) {
+ myPanel.label = strbundle.getString("torbirdy.enabled.jondo");
+ }
+ if (prefs.getIntPref("extensions.torbirdy.proxy.type") === 1) {
+ myPanel.label = strbundle.getString("torbirdy.enabled.whonix");
+ }
+ }
+ // Custom.
+ if (type === 2) {
+ myPanel.label = strbundle.getString("torbirdy.enabled.custom");
+ }
+ // Whonix.
+ if (whonix && prefs.getBoolPref("extensions.torbirdy.whonix_run")) {
+ myPanel.label = strbundle.getString("torbirdy.enabled.whonix");
+ org.torbirdy.prefs.setProxyWhonix();
+ }
+ // Transparent Torification.
+ if (type === 3) {
+ myPanel.label = strbundle.getString("torbirdy.enabled.torification");
+ myPanel.style.color = "red";
+ }
+ prefs.setBoolPref("extensions.torbirdy.whonix_run", false);
}
- if (prefs.getIntPref("extensions.torbirdy.proxy.type") === 1) {
- myPanel.label = strbundle.getString("torbirdy.enabled.whonix");
+ else {
+ myPanel.label = strbundle.getString("torbirdy.enabled.disabled");
+ myPanel.style.color = "red";
}
}
- // Custom.
- if (type === 2) {
- myPanel.label = strbundle.getString("torbirdy.enabled.custom");
- }
- // Whonix.
- if (whonix && prefs.getBoolPref("extensions.torbirdy.whonix_run")) {
- myPanel.label = strbundle.getString("torbirdy.enabled.whonix");
- org.torbirdy.prefs.setProxyWhonix();
- }
- // Transparent Torification.
- if (type === 3) {
- myPanel.label = strbundle.getString("torbirdy.enabled.torification");
- myPanel.style.color = "red";
- }
- prefs.setBoolPref("extensions.torbirdy.whonix_run", false);
- }
- else {
- myPanel.label = strbundle.getString("torbirdy.enabled.disabled");
- myPanel.style.color = "red";
- }
-}
+ };
+
+})();
-window.addEventListener("load", torbirdyStartup, false);
+window.addEventListener("load", function() { TorBirdy.onLoad(); }, false);
diff --git a/chrome/content/preferences.js b/chrome/content/preferences.js
index f2f6b32..c61259f 100644
--- a/chrome/content/preferences.js
+++ b/chrome/content/preferences.js
@@ -1,43 +1,42 @@
if (!org) var org = {};
if (!org.torbirdy) org.torbirdy = {};
-if (!org.torbirdy.prefs) org.torbirdy.prefs = new function() {
- var pub = {};
+if (!org.torbirdy.prefs) org.torbirdy.prefs = {
- pub.prefBranch = "extensions.torbirdy.";
- pub.customBranch = "extensions.torbirdy.custom.";
+ prefBranch: "extensions.torbirdy.",
+ customBranch: "extensions.torbirdy.custom.",
- pub.torKeyserver = "hkp://2eghzlv2wwcq7u7y.onion";
- pub.jondoKeyserver = "hkp://pool.sks-keyservers.net";
+ torKeyserver: "hkp://2eghzlv2wwcq7u7y.onion",
+ jondoKeyserver: "hkp://pool.sks-keyservers.net",
- pub.prefs = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefBranch);
+ prefs: Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefBranch),
- pub.torBirdyPref = Components.classes["@mozilla.org/preferences-service;1"]
- .getService(Components.interfaces.nsIPrefService).getBranch(pub.customBranch);
+ torBirdyPref: Components.classes["@mozilla.org/preferences-service;1"]
+ .getService(Components.interfaces.nsIPrefService).getBranch(this.customBranch),
- pub.acctMgr = Components.classes["@mozilla.org/messenger/account-manager;1"]
- .getService(Components.interfaces.nsIMsgAccountManager);
+ acctMgr: Components.classes["@mozilla.org/messenger/account-manager;1"]
+ .getService(Components.interfaces.nsIMsgAccountManager),
- var bundles = Components.classes["@mozilla.org/intl/stringbundle;1"]
- .getService(Components.interfaces.nsIStringBundleService);
- pub.strbundle = bundles.createBundle("chrome://castironthunderbirdclub/locale/torbirdy.properties");
+ strBundle: Components.classes["@mozilla.org/intl/stringbundle;1"]
+ .getService(Components.interfaces.nsIStringBundleService)
+ .createBundle("chrome://castironthunderbirdclub/locale/torbirdy.properties"),
- pub.setDefaultPrefs = function() {
- pub.prefs.setCharPref("network.proxy.socks", "127.0.0.1");
- pub.prefs.setIntPref("network.proxy.socks_port", 9150);
- pub.prefs.clearUserPref("network.proxy.http");
- pub.prefs.clearUserPref("network.proxy.http_port");
- pub.prefs.clearUserPref("network.proxy.ssl");
- pub.prefs.clearUserPref("network.proxy.ssl_port");
- };
+ setDefaultPrefs: function() {
+ this.prefs.setCharPref("network.proxy.socks", "127.0.0.1");
+ this.prefs.setIntPref("network.proxy.socks_port", 9150);
+ this.prefs.clearUserPref("network.proxy.http");
+ this.prefs.clearUserPref("network.proxy.http_port");
+ this.prefs.clearUserPref("network.proxy.ssl");
+ this.prefs.clearUserPref("network.proxy.ssl_port");
+ },
- pub.resetNetworkProxy = function() {
- pub.prefs.setIntPref("network.proxy.type", 1);
- };
+ resetNetworkProxy: function() {
+ this.prefs.setIntPref("network.proxy.type", 1);
+ },
- pub.setEnigmailPrefs = function(anonService) {
- if (pub.prefs.getBoolPref("extensions.torbirdy.enigmail.throwkeyid")) {
+ setEnigmailPrefs: function(anonService) {
+ if (this.prefs.getBoolPref("extensions.torbirdy.enigmail.throwkeyid")) {
if (anonService === "tor") {
return "--no-emit-version " +
"--no-comments " +
@@ -67,82 +66,82 @@ if (!org.torbirdy.prefs) org.torbirdy.prefs = new function() {
"--keyserver-options no-auto-key-retrieve,no-try-dns-srv,http-proxy=http://127.0.0.1:4001";
}
}
- };
+ },
- pub.updateKeyserver = function(anonService) {
+ updateKeyserver: function(anonService) {
var extension = "extensions.enigmail.keyserver";
- var keyserver = pub.keyserver;
+ var keyserver = this.enigmailKeyserver;
if (typeof keyserver === "undefined") {
- var keyserverValue = (anonService === "tor") ? pub.torKeyserver : pub.jondoKeyserver;
+ var keyserverValue = (anonService === "tor") ? this.torKeyserver : this.jondoKeyserver;
} else {
- var keyserverValue = keyserver.value;
+ var keyserverValue = this.enigmailKeyserver.value;
}
if (anonService === "tor") {
- pub.setPreferences(extension, keyserverValue);
+ this.setPreferences(extension, keyserverValue);
}
if (anonService === "jondo") {
- pub.setPreferences(extension, keyserverValue);
+ this.setPreferences(extension, keyserverValue);
}
- };
+ },
- pub.restoreEnigmailPrefs = function() {
- pub.prefs.setCharPref("extensions.enigmail.agentAdditionalParam", pub.setEnigmailPrefs("tor"));
- pub.updateKeyserver("tor");
- };
+ restoreEnigmailPrefs: function() {
+ this.prefs.setCharPref("extensions.enigmail.agentAdditionalParam", this.setEnigmailPrefs("tor"));
+ this.updateKeyserver("tor");
+ },
- pub.clearCustomPrefs = function() {
- var customPrefs = pub.torBirdyPref.getChildList("", {});
+ clearCustomPrefs: function() {
+ var customPrefs = this.torBirdyPref.getChildList("", {});
for (var i = 0; i < customPrefs.length; i++) {
- pub.prefs.clearUserPref(pub.customBranch + customPrefs[i]);
+ this.prefs.clearUserPref(this.customBranch + customPrefs[i]);
}
- };
+ },
- pub.clearSinglePref = function(pref) {
- pub.prefs.clearUserPref(pub.customBranch + pref);
- };
+ clearSinglePref: function(pref) {
+ this.prefs.clearUserPref(this.customBranch + pref);
+ },
- pub.fetchAllMessages = function() {
- if (pub.fetchAll.checked) {
- pub.idle.checked = true;
- pub.startupFolder.checked = true;
+ fetchAllMessages: function() {
+ if (this.fetchAllMails.checked) {
+ this.imapIdle.checked = true;
+ this.startupFolder.checked = true;
}
else {
- pub.idle.checked = false;
- pub.startupFolder.checked = false;
+ this.imapIdle.checked = false;
+ this.startupFolder.checked = false;
}
- };
+ },
- pub.checkSetting = function() {
- var index = pub.anonService.selectedIndex;
+ checkSetting: function() {
+ var index = this.anonService.selectedIndex;
if (index === 2) {
- pub.socksHost.disabled = false;
- pub.socksPort.disabled = false;
+ this.socksHost.disabled = false;
+ this.socksPort.disabled = false;
}
else {
- pub.socksHost.disabled = true;
- pub.socksPort.disabled = true;
+ this.socksHost.disabled = true;
+ this.socksPort.disabled = true;
}
if (index === 1) {
- pub.anonCustomService.disabled = false;
- var service = pub.anonCustomService.selectedIndex;
- if (pub.anonCustomService.selectedIndex === 0) {
- pub.keyserver.value = pub.jondoKeyserver;
+ this.anonCustomService.disabled = false;
+ var service = this.anonCustomService.selectedIndex;
+ if (this.anonCustomService.selectedIndex === 0) {
+ this.enigmailKeyserver.value = this.jondoKeyserver;
}
- if (pub.anonCustomService.selectedIndex === 1) {
- pub.keyserver.value = pub.torKeyserver;
+ if (this.anonCustomService.selectedIndex === 1) {
+ this.enigmailKeyserver.value = this.torKeyserver;
}
} else {
- pub.anonCustomService.disabled = true;
+ this.anonCustomService.disabled = true;
}
if (index === 0 || index === 2 || index === 3) {
- pub.keyserver.value = pub.torKeyserver;
+ this.enigmailKeyserver.value = this.torKeyserver;
}
- };
+ },
- pub.getAccount = function() {
+ getAccount: function() {
var mailAccounts = [];
- var accounts = pub.acctMgr.accounts;
+ var accounts = this.acctMgr.accounts;
for (var i = 0; i < accounts.Count(); i++) {
var account = accounts.QueryElementAt(i, Components.interfaces.nsIMsgAccount).incomingServer;
var name = account.prettyName;
@@ -151,17 +150,17 @@ if (!org.torbirdy.prefs) org.torbirdy.prefs = new function() {
}
}
return mailAccounts;
- };
+ },
- pub.selectMailAccount = function() {
- var index = pub.mailAccount.selectedIndex;
+ selectMailAccount: function() {
+ var index = this.mailAccount.selectedIndex;
if (!(index === 0)) {
// For email accounts, configure accordingly.
var sAccount = null;
- var account = pub.getAccount();
+ var account = this.getAccount();
for (var i = 0; i < account.length; i++) {
- if (account[i].key === pub.mailAccount.value) {
+ if (account[i].key === this.mailAccount.value) {
sAccount = i;
}
}
@@ -171,175 +170,175 @@ if (!org.torbirdy.prefs) org.torbirdy.prefs = new function() {
"chrome, centerscreen, modal, resizable=yes",
account[sAccount]).focus();
}
- pub.mailAccount.selectedIndex = 0;
- };
+ this.mailAccount.selectedIndex = 0;
+ },
- pub.setPanelSettings = function(proxyname, color) {
+ setPanelSettings: function(proxyname, color) {
var win = Components.classes['@mozilla.org/appshell/window-mediator;1']
.getService(Components.interfaces.nsIWindowMediator)
.getMostRecentWindow('mail:3pane');
- pub.myPanel = win.document.getElementById("torbirdy-my-panel");
- pub.myPanel.label = proxyname;
- pub.myPanel.style.color = color;
- };
-
- pub.resetAll = function() {
- pub.resetNetworkProxy();
- pub.setDefaultPrefs();
- pub.clearCustomPrefs();
- pub.restoreEnigmailPrefs();
- };
-
- pub.setPreferences = function(preference, value) {
+ this.myPanel = win.document.getElementById("torbirdy-my-panel");
+ this.myPanel.label = proxyname;
+ this.myPanel.style.color = color;
+ },
+
+ resetAll: function() {
+ this.resetNetworkProxy();
+ this.setDefaultPrefs();
+ this.clearCustomPrefs();
+ this.restoreEnigmailPrefs();
+ },
+
+ setPreferences: function(preference, value) {
// Set the preferences both for Thunderbird and our custom branch.
if (typeof value === "string") {
- pub.prefs.setCharPref(preference, value);
- pub.prefs.setCharPref(pub.customBranch + preference, value);
+ this.prefs.setCharPref(preference, value);
+ this.prefs.setCharPref(this.customBranch + preference, value);
}
if (typeof value === "boolean") {
- pub.prefs.setBoolPref(preference, value);
- pub.prefs.setBoolPref(pub.customBranch + preference, value);
+ this.prefs.setBoolPref(preference, value);
+ this.prefs.setBoolPref(this.customBranch + preference, value);
}
if (typeof value === "number") {
- pub.prefs.setIntPref(preference, value);
- pub.prefs.setIntPref(pub.customBranch + preference, value);
+ this.prefs.setIntPref(preference, value);
+ this.prefs.setIntPref(this.customBranch + preference, value);
}
- };
+ },
- pub.setProxyTor = function() {
+ setProxyTor: function() {
// Set Tor proxy
- pub.resetAll();
+ this.resetAll();
- pub.setPanelSettings(pub.strbundle.GetStringFromName("torbirdy.enabled.tor"), "green");
- pub.prefs.setIntPref(pub.prefBranch + 'proxy', 0);
- };
+ this.setPanelSettings(this.strBundle.GetStringFromName("torbirdy.enabled.tor"), "green");
+ this.prefs.setIntPref(this.prefBranch + 'proxy', 0);
+ },
- pub.setProxyJonDo = function() {
- pub.resetNetworkProxy();
- pub.clearCustomPrefs();
+ setProxyJonDo: function() {
+ this.resetNetworkProxy();
+ this.clearCustomPrefs();
- pub.setPreferences("network.proxy.socks", "127.0.0.1");
- pub.setPreferences("network.proxy.socks_port", 4001);
+ this.setPreferences("network.proxy.socks", "127.0.0.1");
+ this.setPreferences("network.proxy.socks_port", 4001);
// SSL.
- pub.setPreferences("network.proxy.ssl", "127.0.0.1");
- pub.setPreferences("network.proxy.ssl_port", 4001);
+ this.setPreferences("network.proxy.ssl", "127.0.0.1");
+ this.setPreferences("network.proxy.ssl_port", 4001);
// HTTP.
- pub.setPreferences("network.proxy.http", "127.0.0.1");
- pub.setPreferences("network.proxy.http_port", 4001);
+ this.setPreferences("network.proxy.http", "127.0.0.1");
+ this.setPreferences("network.proxy.http_port", 4001);
// Disable pipelining.
- pub.setPreferences("network.http.pipelining", false);
- pub.setPreferences("network.http.pipelining.ssl", false);
- pub.setPreferences("network.http.proxy.pipelining", false);
+ this.setPreferences("network.http.pipelining", false);
+ this.setPreferences("network.http.pipelining.ssl", false);
+ this.setPreferences("network.http.proxy.pipelining", false);
// Enigmail.
- pub.setPreferences("extensions.enigmail.agentAdditionalParam", pub.setEnigmailPrefs("jondo"));
- pub.updateKeyserver("jondo");
+ this.setPreferences("extensions.enigmail.agentAdditionalParam", this.setEnigmailPrefs("jondo"));
+ this.updateKeyserver("jondo");
- pub.setPanelSettings(pub.strbundle.GetStringFromName("torbirdy.enabled.jondo"), "green");
- pub.prefs.setIntPref(pub.prefBranch + 'proxy', 1);
- pub.prefs.setIntPref(pub.prefBranch + 'proxy.type', 0);
- };
+ this.setPanelSettings(this.strBundle.GetStringFromName("torbirdy.enabled.jondo"), "green");
+ this.prefs.setIntPref(this.prefBranch + 'proxy', 1);
+ this.prefs.setIntPref(this.prefBranch + 'proxy.type', 0);
+ },
- pub.setProxyWhonix = function() {
- pub.resetAll();
+ setProxyWhonix: function() {
+ this.resetAll();
- pub.setPreferences("network.proxy.socks", "192.168.0.10");
- pub.setPreferences("network.proxy.socks_port", 9102);
+ this.setPreferences("network.proxy.socks", "192.168.0.10");
+ this.setPreferences("network.proxy.socks_port", 9102);
- pub.setPanelSettings(pub.strbundle.GetStringFromName("torbirdy.enabled.whonix"), "green");
- pub.prefs.setIntPref(pub.prefBranch + 'proxy', 1);
- pub.prefs.setIntPref(pub.prefBranch + 'proxy.type', 1);
- };
+ this.setPanelSettings(this.strBundle.GetStringFromName("torbirdy.enabled.whonix"), "green");
+ this.prefs.setIntPref(this.prefBranch + 'proxy', 1);
+ this.prefs.setIntPref(this.prefBranch + 'proxy.type', 1);
+ },
- pub.setProxyCustom = function() {
- pub.resetAll();
+ setProxyCustom: function() {
+ this.resetAll();
- var socks_host = pub.socksHost.value;
- var socks_port = pub.socksPort.value;
+ var socks_host = this.socksHost.value;
+ var socks_port = this.socksPort.value;
// Set them now.
- pub.setPreferences("network.proxy.socks", socks_host);
- pub.setPreferences("network.proxy.socks_port", parseInt(socks_port, 10));
+ this.setPreferences("network.proxy.socks", socks_host);
+ this.setPreferences("network.proxy.socks_port", parseInt(socks_port, 10));
- pub.setPanelSettings(pub.strbundle.GetStringFromName("torbirdy.enabled.custom"), "green");
- pub.prefs.setIntPref(pub.prefBranch + 'proxy', 2);
- };
+ this.setPanelSettings(this.strBundle.GetStringFromName("torbirdy.enabled.custom"), "green");
+ this.prefs.setIntPref(this.prefBranch + 'proxy', 2);
+ },
- pub.setProxyTransparent = function() {
- pub.setPreferences("network.proxy.type", 0);
+ setProxyTransparent: function() {
+ this.setPreferences("network.proxy.type", 0);
- pub.setPanelSettings(pub.strbundle.GetStringFromName("torbirdy.enabled.torification"), "red");
- pub.prefs.setIntPref(pub.prefBranch + 'proxy', 3);
- };
+ this.setPanelSettings(this.strBundle.GetStringFromName("torbirdy.enabled.torification"), "red");
+ this.prefs.setIntPref(this.prefBranch + 'proxy', 3);
+ },
/*
Save
*/
- pub.onAccept = function() {
- var index = pub.anonService.selectedIndex;
+ onAccept: function() {
+ var index = this.anonService.selectedIndex;
// Default (recommended) settings for TorBirdy.
if (index === 0) {
// Set proxies for Tor.
- pub.setProxyTor();
+ this.setProxyTor();
}
// Anonymization service.
if (index === 1) {
- var anonServiceType = pub.anonCustomService.selectedIndex;
+ var anonServiceType = this.anonCustomService.selectedIndex;
if (anonServiceType === 0 || typeof anonServiceType === "undefined") {
// Set proxies for JonDo.
- pub.setProxyJonDo();
+ this.setProxyJonDo();
}
if (anonServiceType === 1) {
// Set Whonix.
- pub.setProxyWhonix();
+ this.setProxyWhonix();
}
}
// Custom proxy.
if (index === 2) {
- pub.setProxyCustom();
+ this.setProxyCustom();
}
// Transparent Anonymisation.
if (index === 3) {
// Disable the proxy.
- pub.setProxyTransparent();
+ this.setProxyTransparent();
}
/*
Privacy
*/
var idlePref = 'mail.server.default.use_idle';
- if (pub.idle.checked) {
- pub.setPreferences(idlePref, true);
+ if (this.imapIdle.checked) {
+ this.setPreferences(idlePref, true);
}
else {
- pub.setPreferences(idlePref, false);
+ this.setPreferences(idlePref, false);
}
// Last accessed folder.
// default: false
- if (pub.startupFolder.checked) {
- pub.prefs.setBoolPref(pub.prefBranch + 'startup_folder', true);
+ if (this.startupFolder.checked) {
+ this.prefs.setBoolPref(this.prefBranch + 'startup_folder', true);
} else {
- pub.prefs.setBoolPref(pub.prefBranch + 'startup_folder', false);
+ this.prefs.setBoolPref(this.prefBranch + 'startup_folder', false);
}
// Time zone.
// default: true
- var timezone = pub.timezone.checked;
+ var timezone = this.timezone.checked;
// Only update this if required.
- if (timezone === pub.prefs.getBoolPref(pub.prefBranch + 'timezone')) {
+ if (timezone === this.prefs.getBoolPref(this.prefBranch + 'timezone')) {
var env = Components.classes["@mozilla.org/process/environment;1"]
.getService(Components.interfaces.nsIEnvironment);
if (timezone) {
- pub.prefs.setBoolPref(pub.prefBranch + 'timezone', false);
+ this.prefs.setBoolPref(this.prefBranch + 'timezone', false);
env.set('TZ', '');
} else {
- pub.prefs.setBoolPref(pub.prefBranch + 'timezone', true);
+ this.prefs.setBoolPref(this.prefBranch + 'timezone', true);
env.set('TZ', 'UTC');
}
@@ -348,24 +347,24 @@ if (!org.torbirdy.prefs) org.torbirdy.prefs = new function() {
// Thunderbird and starting it again.
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
- prompts.alert(null, pub.strbundle.GetStringFromName("torbirdy.name"),
- pub.strbundle.GetStringFromName("torbirdy.restart"));
+ prompts.alert(null, this.strBundle.GetStringFromName("torbirdy.name"),
+ this.strBundle.GetStringFromName("torbirdy.restart"));
}
// Fetch all messages for all accounts.
// default: false
// Only change the state if it is required.
- if (pub.fetchAll.checked !== pub.prefs.getBoolPref(pub.prefBranch + 'fetchall')) {
- var accounts = pub.getAccount();
- if (pub.fetchAll.checked) {
- pub.prefs.setBoolPref(pub.prefBranch + 'fetchall', true);
+ if (this.fetchAllMails.checked !== this.prefs.getBoolPref(this.prefBranch + 'fetchall')) {
+ var accounts = this.getAccount();
+ if (this.fetchAllMails.checked) {
+ this.prefs.setBoolPref(this.prefBranch + 'fetchall', true);
for (var i = 0; i < accounts.length; i++) {
accounts[i].loginAtStartUp = true;
accounts[i].doBiff = true;
}
}
else {
- pub.prefs.setBoolPref(pub.prefBranch + 'fetchall', false);
+ this.prefs.setBoolPref(this.prefBranch + 'fetchall', false);
for (var i = 0; i < accounts.length; i++) {
accounts[i].loginAtStartUp = false;
accounts[i].doBiff = false;
@@ -375,95 +374,100 @@ if (!org.torbirdy.prefs) org.torbirdy.prefs = new function() {
// Enigmail.
// --throw-keyids - default: false
- if (pub.enigmail.checked) {
- pub.prefs.setBoolPref(pub.prefBranch + 'enigmail.throwkeyid', true);
+ if (this.enigmailKeyId.checked) {
+ this.prefs.setBoolPref(this.prefBranch + 'enigmail.throwkeyid', true);
}
else {
- pub.prefs.setBoolPref(pub.prefBranch + 'enigmail.throwkeyid', false);
+ this.prefs.setBoolPref(this.prefBranch + 'enigmail.throwkeyid', false);
}
// Confirm before sending - default: false
var enigmailConfirmPref = "extensions.enigmail.confirmBeforeSend";
- if (pub.confirmemail.checked) {
- pub.prefs.setBoolPref(enigmailConfirmPref, true);
- pub.prefs.setBoolPref(pub.prefBranch + 'enigmail.confirmemail', true);
+ if (this.enigmailConfirmEmail.checked) {
+ this.prefs.setBoolPref(enigmailConfirmPref, true);
+ this.prefs.setBoolPref(this.prefBranch + 'enigmail.confirmemail', true);
} else {
- pub.prefs.setBoolPref(enigmailConfirmPref, false);
- pub.prefs.setBoolPref(pub.prefBranch + 'enigmail.confirmemail', false);
+ this.prefs.setBoolPref(enigmailConfirmPref, false);
+ this.prefs.setBoolPref(this.prefBranch + 'enigmail.confirmemail', false);
}
// Thunderbird's email wizard - default: false
- if (pub.emailwizard.checked) {
- pub.prefs.setBoolPref(pub.prefBranch + 'emailwizard', true);
+ if (this.emailWizard.checked) {
+ this.prefs.setBoolPref(this.prefBranch + 'emailwizard', true);
} else {
- pub.prefs.setBoolPref(pub.prefBranch + 'emailwizard', false);
+ this.prefs.setBoolPref(this.prefBranch + 'emailwizard', false);
}
// Insecure renegotiation - default: false (opt-out for mailservers that do
// not support secure renegotiation yet)
var securityRenegotiation = 'security.ssl.require_safe_negotiation';
var securityWarn = 'security.ssl.treat_unsafe_negotiation_as_broken';
- if (pub.renegotiation.checked) {
- pub.setPreferences(securityRenegotiation, false);
- pub.setPreferences(securityWarn, false);
+ if (this.secureRenegotiation.checked) {
+ this.setPreferences(securityRenegotiation, false);
+ this.setPreferences(securityWarn, false);
} else {
- pub.clearSinglePref(securityRenegotiation);
- pub.clearSinglePref(securityWarn);
+ this.clearSinglePref(securityRenegotiation);
+ this.clearSinglePref(securityWarn);
}
if (index === 1) {
// JonDo.
- if (pub.anonCustomService.selectedIndex === 0) {
- pub.setPreferences("extensions.enigmail.agentAdditionalParam", pub.setEnigmailPrefs("jondo"));
+ if (this.anonCustomService.selectedIndex === 0) {
+ this.setPreferences("extensions.enigmail.agentAdditionalParam", this.setEnigmailPrefs("jondo"));
}
// Whonix.
- if (pub.anonCustomService.selectedIndex === 1) {
- pub.setPreferences("extensions.enigmail.agentAdditionalParam", pub.setEnigmailPrefs("tor"));
+ if (this.anonCustomService.selectedIndex === 1) {
+ this.setPreferences("extensions.enigmail.agentAdditionalParam", this.setEnigmailPrefs("tor"));
}
}
if (index === 0 || index === 2 || index === 3) {
- pub.setPreferences("extensions.enigmail.agentAdditionalParam", pub.setEnigmailPrefs("tor"));
+ this.setPreferences("extensions.enigmail.agentAdditionalParam", this.setEnigmailPrefs("tor"));
}
- };
+ },
/*
Load
*/
- pub.onLoad = function() {
- pub.anonService = document.getElementById('torbirdy-proxy-settings');
- pub.socksHost = document.getElementById('torbirdy-socks-host');
- pub.socksPort = document.getElementById('torbirdy-socks-port');
- pub.mailAccount = document.getElementById('torbirdy-mail-accounts');
- pub.anonType = document.getElementById('torbirdy-anon-settings');
- pub.idle = document.getElementById('torbirdy-idle');
- pub.startupFolder = document.getElementById('torbirdy-startup-folder');
- pub.anonCustomService = document.getElementById('torbirdy-anonservice');
- pub.enigmail = document.getElementById('torbirdy-enigmail-throwkeyid');
- pub.torification = document.getElementById('torbirdy-torification');
- pub.timezone = document.getElementById('torbirdy-timezone');
- pub.confirmemail = document.getElementById('torbirdy-confirm-email');
- pub.emailwizard = document.getElementById('torbirdy-email-wizard');
- pub.renegotiation = document.getElementById('torbirdy-renegotiation');
- pub.keyserver = document.getElementById('torbirdy-enigmail-keyserver');
- pub.fetchAll = document.getElementById('torbirdy-email-automatic');
+ onLoad: function() {
+ // Proxy.
+ this.anonCustomService = document.getElementById('torbirdy-anonservice');
+ this.anonService = document.getElementById('torbirdy-proxy-settings');
+ this.anonCustomService = document.getElementById('torbirdy-anonservice');
+ this.anonType = document.getElementById('torbirdy-anon-settings');
+ this.socksHost = document.getElementById('torbirdy-socks-host');
+ this.socksPort = document.getElementById('torbirdy-socks-port');
+ this.torification = document.getElementById('torbirdy-torification');
+ // Privacy.
+ this.mailAccount = document.getElementById('torbirdy-mail-accounts');
+ this.imapIdle = document.getElementById('torbirdy-idle');
+ this.startupFolder = document.getElementById('torbirdy-startup-folder');
+ this.timezone = document.getElementById('torbirdy-timezone');
+ this.emailWizard = document.getElementById('torbirdy-email-wizard');
+ this.fetchAllMails = document.getElementById('torbirdy-email-automatic');
+ // Enigmail.
+ this.enigmailKeyId = document.getElementById('torbirdy-enigmail-throwkeyid');
+ this.enigmailKeyserver = document.getElementById('torbirdy-enigmail-keyserver');
+ this.enigmailConfirmEmail = document.getElementById('torbirdy-confirm-email');
+ // Security.
+ this.secureRenegotiation = document.getElementById('torbirdy-renegotiation');
// Make sure the user really wants to change these settings.
- var warnPrompt = pub.prefs.getBoolPref("extensions.torbirdy.warn");
+ var warnPrompt = this.prefs.getBoolPref("extensions.torbirdy.warn");
if (warnPrompt) {
var prompts = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
.getService(Components.interfaces.nsIPromptService);
var check = {value: true};
- var result = prompts.confirmCheck(null, pub.strbundle.GetStringFromName('torbirdy.email.advanced.title'),
- pub.strbundle.GetStringFromName('torbirdy.email.advanced'),
- pub.strbundle.GetStringFromName('torbirdy.email.advanced.nextwarning'),
+ var result = prompts.confirmCheck(null, this.strBundle.GetStringFromName('torbirdy.email.advanced.title'),
+ this.strBundle.GetStringFromName('torbirdy.email.advanced'),
+ this.strBundle.GetStringFromName('torbirdy.email.advanced.nextwarning'),
check);
if (!result) {
window.close();
} else {
if (!check.value) {
- pub.prefs.setBoolPref("extensions.torbirdy.warn", false);
+ this.prefs.setBoolPref("extensions.torbirdy.warn", false);
}
}
}
@@ -472,36 +476,36 @@ if (!org.torbirdy.prefs) org.torbirdy.prefs = new function() {
PROXY
*/
// Load the preference values.
- var anonService = pub.prefs.getIntPref(pub.prefBranch + 'proxy');
- pub.anonService.selectedIndex = anonService;
+ var anonService = this.prefs.getIntPref(this.prefBranch + 'proxy');
+ this.anonService.selectedIndex = anonService;
- pub.socksHost.value = pub.prefs.getCharPref("network.proxy.socks");
- pub.socksPort.value = pub.prefs.getIntPref("network.proxy.socks_port");
+ this.socksHost.value = this.prefs.getCharPref("network.proxy.socks");
+ this.socksPort.value = this.prefs.getIntPref("network.proxy.socks_port");
// Tor.
if (anonService === 0) {
- pub.socksHost.value = '127.0.0.1';
- pub.socksPort.value = '9150';
+ this.socksHost.value = '127.0.0.1';
+ this.socksPort.value = '9150';
}
// JonDo/Whonix.
if (anonService === 1) {
- var anonCustomService = pub.prefs.getIntPref(pub.prefBranch + 'proxy.type');
- pub.anonType.disabled = false;
- pub.anonCustomService.disabled = false;
- pub.anonCustomService.selectedIndex = anonCustomService;
+ var anonCustomService = this.prefs.getIntPref(this.prefBranch + 'proxy.type');
+ this.anonType.disabled = false;
+ this.anonCustomService.disabled = false;
+ this.anonCustomService.selectedIndex = anonCustomService;
}
// Custom.
if (anonService === 2) {
- var socks_host = pub.prefs.getCharPref(pub.customBranch + 'network.proxy.socks');
- var socks_port = pub.prefs.getIntPref(pub.customBranch + 'network.proxy.socks_port');
+ var socks_host = this.prefs.getCharPref(this.customBranch + 'network.proxy.socks');
+ var socks_port = this.prefs.getIntPref(this.customBranch + 'network.proxy.socks_port');
- pub.socksHost.value = socks_host;
- pub.socksPort.value = socks_port;
+ this.socksHost.value = socks_host;
+ this.socksPort.value = socks_port;
// Enable the settings.
- pub.socksHost.disabled = false;
- pub.socksPort.disabled = false;
+ this.socksHost.disabled = false;
+ this.socksPort.disabled = false;
}
/*
@@ -509,130 +513,129 @@ if (!org.torbirdy.prefs) org.torbirdy.prefs = new function() {
*/
// Global settings.
// IDLE.
- var idlePref = pub.customBranch + 'mail.server.default.use_idle';
- if (pub.prefs.prefHasUserValue(idlePref)) {
- var idlePrefValue = pub.prefs.getBoolPref(idlePref);
+ var idlePref = this.customBranch + 'mail.server.default.use_idle';
+ if (this.prefs.prefHasUserValue(idlePref)) {
+ var idlePrefValue = this.prefs.getBoolPref(idlePref);
}
if (idlePrefValue) {
- pub.idle.checked = true;
+ this.imapIdle.checked = true;
} else {
- pub.idle.checked = false;
+ this.imapIdle.checked = false;
}
// Select last accessed folder.
// default: false
- if (!pub.prefs.getBoolPref(pub.prefBranch + 'startup_folder')) {
- pub.startupFolder.checked = false;
+ if (!this.prefs.getBoolPref(this.prefBranch + 'startup_folder')) {
+ this.startupFolder.checked = false;
} else {
- pub.startupFolder.checked = true;
+ this.startupFolder.checked = true;
}
// Time zone settings.
// default: true
- if (pub.prefs.getBoolPref(pub.prefBranch + 'timezone')) {
- pub.timezone.checked = false;
+ if (this.prefs.getBoolPref(this.prefBranch + 'timezone')) {
+ this.timezone.checked = false;
} else {
- pub.timezone.checked = true;
+ this.timezone.checked = true;
}
// Fetch all messages for all accounts.
// default: false
- if (pub.prefs.getBoolPref(pub.prefBranch + 'fetchall')) {
- pub.fetchAll.checked = true;
+ if (this.prefs.getBoolPref(this.prefBranch + 'fetchall')) {
+ this.fetchAllMails.checked = true;
} else {
- pub.fetchAll.checked = false;
+ this.fetchAllMails.checked = false;
}
// Enigmal settings
// --throw-keyids - default: false
- if (pub.prefs.getBoolPref(pub.prefBranch + 'enigmail.throwkeyid')) {
- pub.enigmail.checked = true;
+ if (this.prefs.getBoolPref(this.prefBranch + 'enigmail.throwkeyid')) {
+ this.enigmailKeyId.checked = true;
} else {
- pub.enigmail.checked = false;
+ this.enigmailKeyId.checked = false;
}
// Confirm before sending - default: false
- if (pub.prefs.getBoolPref(pub.prefBranch + 'enigmail.confirmemail')) {
- pub.confirmemail.checked = true;
+ if (this.prefs.getBoolPref(this.prefBranch + 'enigmail.confirmemail')) {
+ this.enigmailConfirmEmail.checked = true;
} else {
- pub.confirmemail.checked = false;
+ this.enigmailConfirmEmail.checked = false;
}
// Keyserver.
- var enigmailKeyserver = pub.customBranch + 'extensions.enigmail.keyserver';
- if (pub.prefs.prefHasUserValue(enigmailKeyserver)) {
- pub.keyserver.value = pub.prefs.getCharPref(enigmailKeyserver);
+ var enigmailKeyserver = this.customBranch + 'extensions.enigmail.keyserver';
+ if (this.prefs.prefHasUserValue(enigmailKeyserver)) {
+ this.enigmailKeyserver.value = this.prefs.getCharPref(enigmailKeyserver);
} else {
- pub.keyserver.value = pub.prefs.getCharPref('extensions.enigmail.keyserver');
+ this.enigmailKeyserver.value = this.prefs.getCharPref('extensions.enigmail.keyserver');
}
// Thunderbird's email wizard - default: false
- if (pub.prefs.getBoolPref(pub.prefBranch + 'emailwizard')) {
- pub.emailwizard.checked = true;
+ if (this.prefs.getBoolPref(this.prefBranch + 'emailwizard')) {
+ this.emailWizard.checked = true;
} else {
- pub.emailwizard.checked = false;
+ this.emailWizard.checked = false;
}
/*
Security
*/
// Allow insecure renegotiation - default: false
- if (pub.prefs.prefHasUserValue(pub.customBranch + 'security.ssl.require_safe_negotiation')) {
- pub.renegotiation.checked = true;
+ if (this.prefs.prefHasUserValue(this.customBranch + 'security.ssl.require_safe_negotiation')) {
+ this.secureRenegotiation.checked = true;
} else {
- pub.renegotiation.checked = false;
+ this.secureRenegotiation.checked = false;
}
// Load the email accounts.
- var accounts = pub.getAccount();
+ var accounts = this.getAccount();
if (accounts.length !== 0) {
- pub.mailAccount.appendItem('...', 'select-account');
+ this.mailAccount.appendItem('...', 'select-account');
for (var i = 0; i < accounts.length; i++) {
- pub.mailAccount.appendItem(accounts[i].prettyName, accounts[i].key, accounts[i].type.toUpperCase());
+ this.mailAccount.appendItem(accounts[i].prettyName, accounts[i].key, accounts[i].type.toUpperCase());
}
- pub.mailAccount.selectedIndex = 0;
+ this.mailAccount.selectedIndex = 0;
} else {
- pub.mailAccount.disabled = true;
- pub.mailAccount.appendItem('No email accounts found');
- pub.mailAccount.selectedIndex = 0;
+ this.mailAccount.disabled = true;
+ this.mailAccount.appendItem('No email accounts found');
+ this.mailAccount.selectedIndex = 0;
}
- };
+ },
- pub.displayTestPage = function(service) {
+ displayTestPage: function(service) {
Components.classes['@mozilla.org/appshell/window-mediator;1'].getService(Components.interfaces.nsIWindowMediator).
getMostRecentWindow("mail:3pane").
document.getElementById("tabmail").
openTab("contentTab", {contentPage: service});
- };
+ },
- pub.testSettings = function() {
- pub.onAccept();
- var index = pub.anonService.selectedIndex;
- var anonCustomService = pub.anonCustomService.selectedIndex;
+ testSettings: function() {
+ this.onAccept();
+ var index = this.anonService.selectedIndex;
+ var anonCustomService = this.anonCustomService.selectedIndex;
if ((index === 1) && (anonCustomService === 0 || typeof anonCustomService === "undefined")) {
// Use "http://ip-check.info/tb.php?lang=en" for JonDo.
- pub.displayTestPage("https://ip-check.info/tb.php?lang=en");
+ this.displayTestPage("https://ip-check.info/tb.php?lang=en");
} else {
- pub.displayTestPage("https://check.torproject.org/");
+ this.displayTestPage("https://check.torproject.org/");
}
- };
+ },
- pub.restoreDefaults = function() {
+ restoreDefaults: function() {
// Set the values to their default state.
- pub.anonService.selectedIndex = 0;
- pub.timezone.checked = false;
- pub.enigmail.checked = false;
- pub.confirmemail.checked = false;
- pub.emailwizard.checked = false;
- pub.renegotiation.checked = false;
- pub.idle.checked = false;
- pub.startupFolder.checked = false;
- pub.fetchAll.checked = false;
+ this.anonService.selectedIndex = 0;
+ this.timezone.checked = false;
+ this.enigmailKeyId.checked = false;
+ this.enigmailConfirmEmail.checked = false;
+ this.emailWizard.checked = false;
+ this.secureRenegotiation.checked = false;
+ this.imapIdle.checked = false;
+ this.startupFolder.checked = false;
+ this.fetchAllMails.checked = false;
// Save the settings and close the window.
- pub.checkSetting();
- pub.onAccept();
- };
+ this.checkSetting();
+ this.onAccept();
+ }
- return pub;
};
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits