Commit 7a1d01de authored by bertagaz's avatar bertagaz
Browse files

Remove upstreamed Torbirdy patches (Will-fix: #11619).

parent 8532b3de
--- /usr/share/xul-ext/torbirdy/chrome/content/emailwizard.js.orig
+++ /usr/share/xul-ext/torbirdy/chrome/content/emailwizard.js
@@ -1,28 +1,46 @@
+Components.utils.import("resource://gre/modules/Preferences.jsm");
+
if (!org) var org = {};
if (!org.torbirdy) org.torbirdy = {};
if(!org.torbirdy.emailwizard) 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;
- }
+ var disableAutoConfiguration = false;
+ if (Preferences.get("extensions.torbirdy.emailwizard", false)) {
+ disableAutoConfiguration = true;
}
- if (prefs.getBoolPref("extensions.torbirdy.emailwizard")) {
- disableWizard = true;
+
+ fixupTorbirdySettingsOnNewAccount = function(account) {
+ var idkey = account.defaultIdentity.key;
+ var serverkey = account.incomingServer.key;
+ var protocol = account.incomingServer.type;
+
+ var pref_spec = [
+ ['mail.server.%serverkey%.check_new_mail', false],
+ ['mail.server.%serverkey%.login_at_startup', false]
+ ];
+
+ // Make sure that drafts are saved to Local Folders if it is an IMAP account.
+ if (protocol === "imap") {
+ pref_spec.push(['mail.identity.%idkey%.draft_folder',
+ 'mailbox://nobody@Local%20Folders/Drafts']);
+ }
+
+ // Do not automatically download new messages in POP accounts.
+ if (protocol === "pop3") {
+ pref_spec.push(['mail.server.%serverkey%.download_on_biff', false]);
+ }
+
+ for each (var [pref_template, value] in pref_spec) {
+ var pref = pref_template.replace("%idkey%", idkey);
+ pref = pref.replace("%serverkey%", serverkey);
+ Preferences.set(pref, value);
+ }
}
- pub.disableAutoWizard = function() {
- if (!disableWizard) {
+ pub.adjustAutoWizard = function() {
+ if (!disableAutoConfiguration) {
var realname = document.getElementById("realname").value;
var email = document.getElementById("email").value;
var password = document.getElementById("password").value;
@@ -63,10 +81,6 @@ if(!org.torbirdy.emailwizard) org.torbirdy.emailwizard = new function() {
config.incoming.auth = 3;
config.outgoing.auth = 3;
- // Set default values to disable automatic email fetching.
- config.incoming.loginAtStartup = false;
- config.incoming.downloadOnBiff = false;
-
// Default the outgoing SMTP port.
config.outgoing.port = 465;
@@ -75,31 +89,8 @@ if(!org.torbirdy.emailwizard) org.torbirdy.emailwizard = new function() {
replaceVariables(config, realname, email, password);
config.rememberPassword = rememberPassword && !!password;
- var newAccount = createAccountInBackend(config);
-
- // Set check_new_mail to false. We can't do this through the account setup, so let's do it here.
- var checkNewMail = 'mail.server.%serverkey%.check_new_mail';
- var serverkey = newAccount.incomingServer.key;
- var checkNewMailPref = checkNewMail.replace("%serverkey%", serverkey);
- prefs.setBoolPref(checkNewMailPref, false);
-
- // Make sure that drafts are saved to Local Folders if it is an IMAP account.
- if (protocol === "imap") {
- var identity = newAccount.defaultIdentity;
- identity.draftFolder = "mailbox://nobody@Local%20Folders/Drafts";
- }
-
- // Do not check for new messages at startup.
- var loginAtStartup = 'mail.server.%serverkey%.login_at_startup';
- var loginAtStartupPref = loginAtStartup.replace("%serverkey%", serverkey);
- prefs.setBoolPref(loginAtStartupPref, false);
-
- // Do not automatically download new messages.
- if (protocol === "pop3") {
- var downloadOnBiff = 'mail.server.%serverkey%.download_on_biff';
- var downloadOnBiffPref = downloadOnBiff.replace("%serverkey%", serverkey);
- prefs.setBoolPref(downloadOnBiffPref, false);
- }
+ var new_account = createAccountInBackend(config);
+ fixupTorbirdySettingsOnNewAccount(new_account);
// From comm-release/mailnews/base/prefs/content/accountcreation/emailWizard.js : onAdvancedSetup().
var windowManager = Cc["@mozilla.org/appshell/window-mediator;1"]
@@ -111,12 +102,23 @@ if(!org.torbirdy.emailwizard) org.torbirdy.emailwizard = new function() {
} else {
window.openDialog("chrome://messenger/content/AccountManager.xul",
"AccountManager", "chrome,centerscreen,modal,titlebar",
- { server: newAccount.incomingServer,
+ { server: new_account.incomingServer,
selectPage: "am-server.xul" });
}
window.close();
}
else {
+ // From comm-release/mailnews/base/prefs/content/accountcreation/emailWizard.js : finish().
+ // We need somewhere to hook in, so we can access the new
+ // account object created through the autoconfig wizard, and
+ // apply Torbirdy's settings on it.
+ gEmailConfigWizard.finish = function() {
+ gEmailWizardLogger.info("creating account in backend");
+ var account = createAccountInBackend(this.getConcreteConfig());
+ fixupTorbirdySettingsOnNewAccount(account);
+ window.close();
+ }
+
gEmailConfigWizard.onNext();
}
};
@@ -125,25 +127,17 @@ if(!org.torbirdy.emailwizard) org.torbirdy.emailwizard = new function() {
var keycode = event.keyCode;
if (keycode == 13) {
if (document.getElementById("next_button").disabled === false) {
- if (!disableWizard) {
- pub.disableAutoWizard();
- }
- else {
- gEmailConfigWizard.onNext();
- }
+ pub.adjustAutoWizard();
}
}
};
pub.onLoad = function() {
- if (disableWizard) {
+ if (disableAutoConfiguration) {
document.getElementById("torbirdy-protocol-box").collapsed = true;
- document.getElementById("provisioner_button").disabled = false;
- document.getElementById("provisioner_button").hidden = false;
- } else {
- document.getElementById("provisioner_button").disabled = true;
- document.getElementById("provisioner_button").hidden = true;
}
+ document.getElementById("provisioner_button").disabled = true;
+ document.getElementById("provisioner_button").hidden = true;
};
return pub;
--- /usr/share/xul-ext/torbirdy/chrome/content/emailwizard.xul.orig
+++ /usr/share/xul-ext/torbirdy/chrome/content/emailwizard.xul
@@ -9,7 +9,7 @@
</stringbundleset>
<button id="next_button"
- oncommand="org.torbirdy.emailwizard.disableAutoWizard();" />
+ oncommand="org.torbirdy.emailwizard.adjustAutoWizard();" />
<vbox id="mastervbox" flex="1">
<groupbox id="torbirdy-protocol-box" class="indent" insertafter="initialSettings">
--- /usr/share/xul-ext/torbirdy/chrome/content/preferences.js.orig
+++ /usr/share/xul-ext/torbirdy/chrome/content/preferences.js
@@ -37,36 +37,20 @@ if (!org.torbirdy.prefs) org.torbirdy.prefs = new function() {
};
pub.setEnigmailPrefs = function(anonService) {
+ var opts = "";
if (pub.prefs.getBoolPref("extensions.torbirdy.enigmail.throwkeyid")) {
- if (anonService === "tor") {
- return "--no-emit-version " +
- "--no-comments " +
- "--throw-keyids " +
- "--display-charset utf-8 " +
- "--keyserver-options no-auto-key-retrieve,no-try-dns-srv,http-proxy=http://127.0.0.1:8118";
- }
- if (anonService === "jondo") {
- return "--no-emit-version " +
- "--no-comments " +
- "--throw-keyids " +
- "--display-charset utf-8 " +
- "--keyserver-options no-auto-key-retrieve,no-try-dns-srv,http-proxy=http://127.0.0.1:4001";
- }
- }
- else {
- if (anonService === "tor") {
- return "--no-emit-version " +
- "--no-comments " +
- "--display-charset utf-8 " +
- "--keyserver-options no-auto-key-retrieve,no-try-dns-srv,http-proxy=http://127.0.0.1:8118";
- }
- if (anonService === "jondo") {
- return "--no-emit-version " +
- "--no-comments " +
- "--display-charset utf-8 " +
- "--keyserver-options no-auto-key-retrieve,no-try-dns-srv,http-proxy=http://127.0.0.1:4001";
- }
+ opts += "--throw-keyids ";
}
+ var proxy = "socks5h://127.0.0.1:9050";
+ if (anonService === "jondo") {
+ proxy = "http://127.0.0.1:4001";
+ }
+ return opts +
+ "--no-emit-version " +
+ "--no-comments " +
+ "--display-charset utf-8 " +
+ "--keyserver-options no-auto-key-retrieve,no-try-dns-srv,http-proxy=" +
+ proxy;
};
pub.updateKeyserver = function(anonService) {
--- /usr/share/xul-ext/torbirdy/components/torbirdy.js.orig
+++ /usr/share/xul-ext/torbirdy/components/torbirdy.js
@@ -181,6 +181,14 @@ const TorBirdyPrefs = {
"mail.inline_attachments": false,
// Do not IDLE (disable push mail).
"mail.server.default.use_idle": false,
+ // Thunderbird's autoconfig wizard is designed to enable an initial
+ // mail fetch (by setting login_at_start) for the first account it
+ // creates (which will become the "default" account, see
+ // msgMail3PaneWindow.js for details) which side-steps the settings
+ // we apply in fixupTorbirdySettingsOnNewAccount(). Hence, fool
+ // Thunderbird to think that this initial mail fetch has already
+ // been done so we get the settings we want.
+ "mail.startup.enabledMailCheckOnce": true,
/*
Browser
@@ -215,7 +223,7 @@ const TorBirdyPrefs = {
// We want to force UTF-8 everywhere
"--display-charset utf-8 " +
// We want to ensure that Enigmail is proxy aware even when it runs gpg in a shell
- "--keyserver-options http-proxy=http://127.0.0.1:8118 ",
+ "--keyserver-options http-proxy=socks5h://127.0.0.1:9050 ",
// The default key server should be a hidden service and this is the only known one (it's part of the normal SKS network)
"extensions.enigmail.keyserver": "hkp://qdigse2yzvuglcix.onion",
--- /usr/share/xul-ext/torbirdy/chrome/content/emailwizard.js.orig
+++ /usr/share/xul-ext/torbirdy/chrome/content/emailwizard.js
@@ -108,6 +108,39 @@ if(!org.torbirdy.emailwizard) org.torbirdy.emailwizard = new function() {
window.close();
}
else {
+ var prefer_pop = Preferences.get("extensions.torbirdy.defaultprotocol") != 1;
+ // Both of these monkeypatches hook in only to change the
+ // selection default (POP vs IMAP according to our pref) at
+ // suitable times, i.e. when the page has been pre-filled and is
+ // finally presented to user action.
+ var result_imappop_hacks_run_once = false;
+ var old_displayConfigResult = gEmailConfigWizard.displayConfigResult;
+ gEmailConfigWizard.displayConfigResult = function(config) {
+ old_displayConfigResult.call(this, config);
+ var radiogroup = document.getElementById("result_imappop");
+ if (radiogroup.hidden) return;
+ // We can only run the monkeypatch code below once -- this
+ // method is called every time we change selection, preventing
+ // us from changing the selection away from POP.
+ if (result_imappop_hacks_run_once) return;
+ result_imappop_hacks_run_once = true;
+ var imap_element = document.getElementById("result_select_imap");
+ var pop_element = document.getElementById("result_select_pop3");
+ if (prefer_pop && imap_element.selected && pop_element) {
+ radiogroup.selectedItem = pop_element;
+ gEmailConfigWizard.onResultIMAPOrPOP3();
+ }
+ }
+ var old_fillManualEditFields = gEmailConfigWizard._fillManualEditFields;
+ gEmailConfigWizard._fillManualEditFields = function(config) {
+ old_fillManualEditFields.call(this, config);
+ if (prefer_pop) {
+ // In this itemlist, POP is located at index 1.
+ document.getElementById("incoming_protocol").selectedIndex = 1;
+ gEmailConfigWizard.onChangedProtocolIncoming();
+ }
+ }
+
// From comm-release/mailnews/base/prefs/content/accountcreation/emailWizard.js : finish().
// We need somewhere to hook in, so we can access the new
// account object created through the autoconfig wizard, and
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment