Avoid initializing Mailvelope if we don't need to

pull/7348/head
Christopher Gurnee 4 years ago
parent cec240d2b9
commit 7f64384bfb

@ -347,6 +347,8 @@ function rcube_webmail()
dt.setData('roundcube-name', n.text().trim());
}
});
this.check_mailvelope(this.env.action);
}
else if (this.env.action == 'compose') {
this.env.address_group_stack = [];
@ -395,6 +397,8 @@ function rcube_webmail()
// init message compose form
this.init_messageform();
this.check_mailvelope(this.env.action);
}
else if (this.env.action == 'bounce') {
this.init_messageform_inputs();
@ -431,11 +435,12 @@ function rcube_webmail()
);
});
}
// show printing dialog
else if (this.env.action == 'print' && this.env.uid
&& !this.env.is_pgp_content && !this.env.pgp_mime_part
) {
this.print_dialog();
// show printing dialog unless decryption must be done first
else if (this.env.action == 'print' && this.env.uid) {
this.check_mailvelope(this.env.action);
if (!this.env.is_pgp_content && !this.env.pgp_mime_part) {
this.print_dialog();
}
}
// get unread count for each mailbox
@ -485,8 +490,6 @@ function rcube_webmail()
this.http_post(postact, postdata);
}
this.check_mailvelope(this.env.action);
// detect browser capabilities
if (!this.is_framed() && !this.env.extwin)
this.browser_capabilities_check();
@ -567,7 +570,9 @@ function rcube_webmail()
// initialize HTML editor
this.editor_init(this.env.editor_config, 'rcmfd_signature');
this.check_mailvelope(this.env.action);
if (this.env.action == 'edit-identity') {
this.check_mailvelope(this.env.action);
}
}
else if (this.env.action == 'folders') {
this.enable_command('subscribe', 'unsubscribe', 'create-folder', 'rename-folder', true);
@ -3706,9 +3711,6 @@ function rcube_webmail()
// Load Mailvelope functionality (and initialize keyring if needed)
this.mailvelope_load = function(action)
{
if (this.env.browser_capabilities)
this.env.browser_capabilities['pgpmime'] = 1;
var keyring = this.env.user_id,
fn = function(kr) {
ref.mailvelope_keyring = kr;
@ -9908,7 +9910,7 @@ function rcube_webmail()
if (!this.env.browser_capabilities)
this.env.browser_capabilities = {};
$.each(['pdf', 'flash', 'tiff', 'webp'], function() {
$.each(['pdf', 'flash', 'tiff', 'webp', 'pgpmime'], function() {
if (ref.env.browser_capabilities[this] === undefined)
ref.env.browser_capabilities[this] = ref[this + '_support_check']();
});
@ -10017,6 +10019,19 @@ function rcube_webmail()
return 0;
};
// check for mailvelope API
this.pgpmime_support_check = function(action)
{
if (typeof window.mailvelope !== 'undefined')
return 1;
$(window).on('mailvelope', function() {
ref.env.browser_capabilities['pgpmime'] = 1;
});
return 0;
};
this.assets_path = function(path)
{
if (this.env.assets_path && !path.startsWith(this.env.assets_path)) {

Loading…
Cancel
Save