diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 17:32:43 +0000 |
commit | 6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch) | |
tree | a68f146d7fa01f0134297619fbe7e33db084e0aa /comm/mail/extensions/openpgp/content/modules/singletons.jsm | |
parent | Initial commit. (diff) | |
download | thunderbird-upstream.tar.xz thunderbird-upstream.zip |
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'comm/mail/extensions/openpgp/content/modules/singletons.jsm')
-rw-r--r-- | comm/mail/extensions/openpgp/content/modules/singletons.jsm | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/comm/mail/extensions/openpgp/content/modules/singletons.jsm b/comm/mail/extensions/openpgp/content/modules/singletons.jsm new file mode 100644 index 0000000000..eb1d6f45df --- /dev/null +++ b/comm/mail/extensions/openpgp/content/modules/singletons.jsm @@ -0,0 +1,54 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ + +"use strict"; + +var EXPORTED_SYMBOLS = ["EnigmailSingletons"]; + +var EnigmailSingletons = { + // handle to most recent message reader window + messageReader: null, + + // information about the last PGP/MIME decrypted message (mimeDecrypt) + lastDecryptedMessage: {}, + lastMessageDecryptTime: 0, + + clearLastDecryptedMessage() { + let lm = this.lastDecryptedMessage; + lm.lastMessageData = ""; + lm.lastMessageURI = null; + lm.mimePartNumber = ""; + lm.lastStatus = {}; + lm.gossip = []; + }, + + isLastDecryptedMessagePart(folder, msgNum, mimePartNumber) { + let reval = + this.lastDecryptedMessage.lastMessageURI && + this.lastDecryptedMessage.lastMessageURI.folder == folder && + this.lastDecryptedMessage.lastMessageURI.msgNum == msgNum && + this.lastDecryptedMessage.mimePartNumber == mimePartNumber; + return reval; + }, + + urisWithNestedEncryptedParts: [], + + maxRecentSubEncryptionUrisToRemember: 10, + + addUriWithNestedEncryptedPart(uri) { + if ( + this.urisWithNestedEncryptedParts.length > + this.maxRecentSubEncryptionUrisToRemember + ) { + this.urisWithNestedEncryptedParts.shift(); // remove oldest + } + this.urisWithNestedEncryptedParts.push(uri); + }, + + isRecentUriWithNestedEncryptedPart(uri) { + return this.urisWithNestedEncryptedParts.includes(uri); + }, +}; + +EnigmailSingletons.clearLastDecryptedMessage(); |